GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(provider): recover stalled model streams by dcadenas · Pull Request #40010 · anomalyco/opencode

Conversation

@dcadenas

@dcadenas dcadenas commented Aug 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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:

  • fix: time out non-SSE streams #39516 expands opt-in chunkTimeout to every response body. This change is a zero-config adaptive default, and it only wraps requests identified as streams.
  • fix(opencode): make long-lived provider streams robust to silent SSE terminations #39970 detects incomplete EOF and gaps between parsed model events, including stalls hidden by SSE keepalives. Complementary. This change is transport-level body silence.

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
All reactions
  • 👍 1 reaction
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found two potentially related PRs:

  1. PR fix(opencode): make long-lived provider streams robust to silent SSE terminations #39970 - fix(opencode): make long-lived provider streams robust to silent SSE terminations

    • fix(opencode): make long-lived provider streams robust to silent SSE terminations #39970
    • Related: Addresses similar streaming timeout/termination issues
  2. PR fix: time out non-SSE streams #39516 - fix: time out non-SSE streams

    • fix: time out non-SSE streams #39516
    • Related: Directly addresses stream timeouts for non-SSE providers

These PRs appear to be addressing overlapping concerns about streaming robustness and timeouts in provider responses. You may want to review them to ensure PR #40010 doesn't duplicate existing fixes or to coordinate any related changes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dcadenas
dcadenas marked this pull request as ready for review August 1, 2026 07:08
@axisrow axisrow mentioned this pull request Aug 1, 2026
kimi-k3 sessions hang indefinitely with no visible indication axisrow/opencode#1
Open
This was referenced Aug 1, 2026
fix(opencode): apply default header timeout to all providers #40069
Closed
fix(session): retry top-level stream request timeouts #40268
Closed
@github-actions github-actions Bot mentioned this pull request Aug 9, 2026
Http2 stream retry #41390
Closed
6 tasks
@dcadenas
dcadenas force-pushed the stream-contribute branch from d72d33c to 9bc30bb Compare August 12, 2026 19:13
@dcadenas

dcadenas commented Aug 12, 2026

Copy link
Copy Markdown
Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Aug 12, 2026
📊 AI CLI 工具社区动态日报 2026-08-13 litang9/big_model_radar#352
Open
@Duanzhoutao Duanzhoutao mentioned this pull request Aug 22, 2026
[Go plan] Empty completions (finish_reason=other) and mid-stream cutoffs on long-reasoning requests — reproduced via direct API calls across multiple models #44148
Closed
@github-actions github-actions Bot mentioned this pull request Aug 24, 2026
feat: detect stalled provider streams and auto-restart #44677
Closed
3 of 6 tasks
@wtnm

wtnm commented Aug 24, 2026

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@niStee niStee mentioned this pull request Aug 24, 2026
SSE stream silently dropped mid-response hangs session/subagents forever — chunkTimeout has no default on the openai path #37580
Closed
@github-actions github-actions Bot mentioned this pull request Aug 25, 2026
fix(provider): handle SSE reader cancel rejections #44912
Closed
3 tasks done
opencode and others added 3 commits August 28, 2026 05:58
opencode
release: v1.18.25
cb7d8b2
@dcadenas
fix(provider): recover stalled model streams
2b22e77
@dcadenas
fix(provider): detect unlabeled model streams
b865769
@dcadenas
dcadenas force-pushed the stream-contribute branch from 9bc30bb to b865769 Compare August 28, 2026 14:01
@dcadenas
dcadenas requested review from Brendonovich and Hona as code owners August 28, 2026 14:01
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Sep 1, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Sep 1, 2026
@totalolage totalolage mentioned this pull request Sep 6, 2026
fix(provider): enforce chunk timeout regardless of content type #47621
Closed
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Hona Hona Awaiting requested review from Hona
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

SSE stream silently dropped mid-response hangs session/subagents forever — chunkTimeout has no default on the openai path

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@dcadenas @wtnm
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.