Repository navigation
fix(app-server): bound chat-completions proxy requests in time - #6855
Merged
Hmbown merged 1 commit intoOct 5, 2026
Merged
Conversation
The `/v1/chat/completions` handler built its upstream client from the shared platform builder, which sets no timeouts. The handler rejects streaming and reads the full upstream body, so a provider that accepts the connection and then stalls — or trickles the body — wedged the handler, and with it the caller's connection, indefinitely. Bound the forward with a 10s connect budget (matching the connect bound used by the TUI client's vision requests and key verification) and a 1800s total budget (matching the TUI client's non-streaming envelope for the same request class). A unit test pins both values and their ordering; reqwest exposes no accessor for a built client's budgets, so exercising the stall path behaviorally would need a deliberately wedged upstream and a multi-second to half-hour wait, which the test comment states. Known follow-up: the runtime-bridge client in `crates/app-server/src/lib.rs` remains unbounded; that is a separate surface. Signed-off-by: asto <asto18089@126.com>
asto18089
force-pushed
the
upstream/app-server-proxy-timeouts
branch
from
October 5, 2026 14:18
a903e7b to
f180a76
Compare
Hmbown
pushed a commit
that referenced
this pull request
Oct 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
/v1/chat/completionshandler built its upstream client from the shared platform builder, which sets no timeouts. The handler rejects streaming and reads the full upstream body, so a provider that accepts the connection and then stalls — or trickles the body — wedged the handler, and with it the caller's connection, indefinitely.Bound the forward with a 10s connect budget (matching the connect bound used by the TUI client's non-streaming requests) and a 1800s total budget (matching the TUI client's non-streaming envelope for the same request class). A unit test pins both values and their ordering; reqwest exposes no accessor for a built client's budgets, so exercising the stall path behaviorally would need a deliberately wedged upstream and a multi-second to half-hour wait, which the test comment states.
Known follow-up: the runtime-bridge client in
crates/app-server/src/lib.rsremains unbounded; that is a separate surface.Testing
cargo test -p codewhale-app-server --lib upstream_deadlines_are_bounded_and_orderedcargo clippy -p codewhale-app-server --all-targets --all-features --lockedAdapted from the Pinvou fork's timeout audit (Pinvou/CodeWhale
d349f2537, the chat-completions proxy slice).Checklist
CHANGELOG.mdchanges