fix(llm-api-gateway): preserve long-lived SSE responses - #1064
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe LLM API gateway HTTPRoute now sets a zero-second request timeout. The route rendering test verifies this default configuration. ChangesLLM gateway timeout
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: 🟡 Moderate · up to The route-level timeout is removed, but SSE responses longer than 60 seconds can still be cut off before completion, leaving callers with incomplete responses. Merge should wait until the endpoint-level streaming deadline is addressed and covered by a regression test. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
🎉 This PR is included in version nvcf-gateway-routes-v1.15.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
SSE responses are not truncated by the ingress default
cancellation behavior
This draft currently addresses the confirmed 15-second ingress boundary. The
additional evidence below identifies a second, application-level boundary that
must also be addressed before the PR fully resolves #1060.
Root cause
The llm-api-gateway route did not specify a request timeout, so Envoy Gateway
applied its 15-second default. When that deadline expired, ingress returned 504
and disconnected llm-api-gateway; the resulting downstream cancellation then
propagated to the upstream request.
Direct upstream, request-router, and gateway-process requests all carried the
same 16-second SSE response successfully outside ingress. The failure occurred
only through the HTTPRoute.
Validation of the route fix
make testindeploy/helm/gateway-routes[DONE][DONE]received, upstream completed in16.000 seconds, no caller or upstream error
Additional long-stream evidence
A public-safe backend emitted valid SSE chunks every 10 seconds and sent
[DONE]at 75 seconds. The active stream still ended at 60.004 seconds underthe gateway's current Go HTTP server write deadline, after HTTP 200 headers but
before
[DONE], producing an incomplete caller response.With only that write deadline disabled in an isolated test harness, the same
request returned HTTP 200 in 75.004 seconds with
[DONE]; the upstreamcompleted in 75.000 seconds without a disconnect.
This confirms that disabling the HTTPRoute deadline is necessary but not
sufficient for streams longer than 60 seconds.
Remaining fix
Manage the write deadline at the SSE endpoint so streaming responses are not
limited by the server-wide total response-write duration. The implementation
must retain the server-wide deadline for ordinary requests, preserve prompt
upstream cancellation when the caller disconnects, and include a
shortened-duration regression test.
This is a focused prerequisite for completing the end-to-end validation in
#999.
Fixes #1060
Summary by CodeRabbit
Bug Fixes
Tests