GeezerVison is showing github.com — fix(provider): recover stalled model streams by dcadenas · Pull Request #40010 · anomalyco/opencode
Conversation
dcadenas
commented
Aug 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Closes #37580
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
A model endpoint can return headers and then stop sending body data. OpenCode waits forever in that state, so a stalled child can pin a parent session.
This adds a provider-neutral idle watchdog for streaming responses. The default starts at 15 minutes, learns from successful streams per provider and transport, and stays between 15 and 30 minutes. An explicit chunkTimeout is still a fixed override. false, 0, or a negative value turns the watchdog off.
The watchdog arms when the response is SSE or the request set stream: true. That second path matters because the ChatGPT Codex endpoint has been seen to stream without Content-Type. Non-streaming requests stay unchanged.
A timeout becomes a typed retryable provider error and goes through the existing retry and status flow. It does not change Task orchestration, durable session records, retry policy, or UI.
Related work:
How did you verify your code works?
Rebased onto current dev (no merge commit).
bun test --timeout 30000 test/provider/header-timeout.test.ts test/provider/stream-liveness.test.ts test/session/processor-effect.test.ts test/session/retry.test.ts in packages/opencode (94 passed)
bun typecheck in packages/opencode and packages/core
- Repo pre-push typecheck: 30/30 tasks passed
Not re-run after this rebase: the earlier isolated foreground Task stall E2E.
Screenshots / recordings
Not applicable. No UI changes.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
DireMunchkin reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 1, 2026
|
Rebased onto current dev so this is mergeable again.
Same two commits, no merge commit:
- recover stalled model streams
- detect unlabeled streams (Codex-style responses with no
Content-Type)
94 targeted tests plus the repo pre-push typecheck (30/30) passed on this head.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Heads up: #44677 targets the same stalled-stream problem at a different layer —
an event-level idle watchdog in @opencode-ai/llm (fixed 120s default) plus a
bounded pre-output provider-turn restart in the V2 session runner. This PR's
transport-level adaptive watchdog and that one are functionally stackable
(inner failure passes through the outer guard untouched), but they overlap in
packages/opencode/src/session/message-v2.ts and
packages/opencode/test/session/retry.test.ts, so whichever lands second needs a
rebase. Flagging for maintainer coordination on the preferred approach.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Automated PR Cleanup
Thank you for contributing to opencode.
Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.
This PR was closed because it matched the following cleanup criteria:
- The PR was created more than 1 month ago
- The PR had fewer than 2 positive reactions
- Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR
PRs created within the last month are not affected by this cleanup.
If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.
Thanks again for taking the time to contribute.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Hona
Awaiting requested review from Hona
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|