Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 21, 2026
LukasParke
added a commit
that referenced
this pull request
Oct 21, 2026
Port of OpenRouterTeam/typescript-sdk#773, re-implemented for the agent engine. - New client-only `streamTimeout` option ({ firstContentMs, contentIntervalMs }) on CallModelInput / GetResponseOptions. It is stripped from the API request on both resolution paths. - All five betaResponsesSend call sites (initial, tool-round follow-up, final, empty-output retry, unsent-results resume) now go through one sendModelRequest() helper, so deadlines re-arm for every request. - With a deadline configured, each request gets its own AbortController. dispatchRequestOptions composes it with the run signal, the caller signal and the replicated timeoutMs. On a stall the watchdog aborts that controller, which tears down the hung request. An abort of the composed signal (user or timeoutMs) disarms the watchdog, so it is reported as itself. - Same no-op rejection handler on executionPromise as PR #122: an early consumer exit followed by a stalled follow-up turn must not produce an unhandled rejection. Option named `streamTimeout` rather than the SDK's `timeout`: CallModelInput spreads every ResponsesRequest key, and a bare `timeout` would collide with any future API field of that name. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #113
Summary of Changes
executionPromiseinsidestartTurnBroadcasterExecution()inpackages/agent/src/lib/model-result.ts. This ensures that when a stream consumer aborts or terminates iteration early, the background promise rejection does not trigger anunhandledRejectionevent.packages/agent/tests/unit/run-cancellation.test.ts.@openrouter/agent(patch).