Repository navigation
Stop sessions from hanging when the model provider stops responding - #56
Open
josephschorr wants to merge 1 commit into
Open
josephschorr wants to merge 1 commit into
josephschorr wants to merge 1 commit into
Conversation
Provider SDKs were built on their default HTTP clients, which have no timeouts, and the runner sent with no deadline. A stream that went silent on a live connection could block a turn indefinitely, holding the session in Running past its maxDuration budget, because the budget was only checked between turns. - New pkg/agent/llm/llmhttp: one shared HTTP client with connect/TLS/ response-header timeouts, HTTP/2 health pings, and a stream-idle abort (ErrStreamIdle after 5m with no body bytes). Every Anthropic and OpenAI-compatible SDK client is now built through anthropic.NewSDKClient or openaicompat.NewClient, which attach it; a guard test refuses bare SDK NewClient calls anywhere in pkg/, internal/ or cmd/. - The runner bounds each provider call by the remaining time budget (maxDuration run-time or sessionExpiration, whichever is nearer), so a stuck call ends the session as BudgetExceeded instead of outliving it. A stream-idle abort flows through the existing provider-error path.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
A session could stay in Running indefinitely if the model provider stopped sending data partway through a response: the agent waited on it forever, and the session's time budget was never checked again.
Model calls now give up if a response goes silent for 5 minutes, or if the server takes more than 3 minutes to start responding. A stalled call is reported like any other provider error, so channel sessions offer the usual Retry. A call is also cut off when the session's time budget (
maxDurationorsessionExpiration) runs out, and the session fails withBudgetExceededas it would have between turns. Long responses that keep streaming are not affected.