fix(opencode-go): treat stream block boundaries as liveness#96526
fix(opencode-go): treat stream block boundaries as liveness#96526lin-hongkuan wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 8:05 AM ET / 12:05 UTC. Summary PR surface: Source +14, Tests +76. Total +90 across 2 files. Reproducibility: yes. source-reproducible: current main forwards boundary events but only re-arms the idle timer on deltas, and the linked issue includes a focused failing timing test. I did not run tests because this review is read-only. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the provider-owned wrapper fix after maintainer review accepts the cancellation timing tradeoff and required checks remain green; keep the linked issue open until this PR merges. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main forwards boundary events but only re-arms the idle timer on deltas, and the linked issue includes a focused failing timing test. I did not run tests because this review is read-only. Is this the best way to solve the issue? Yes, this is the best code layer: the opencode-go provider wrapper owns the stalled-stream watchdog, and the post-delta gate preserves the first-event timeout contract while treating later provider boundaries as liveness. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ecb45bf7729. Label changesLabel justifications:
Evidence reviewedPR surface: Source +14, Tests +76. Total +90 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
What Problem This Solves
The opencode-go stalled-stream watchdog only treated provider delta events as stream liveness. Live streams that emitted block-boundary events, such as tool call end/start transitions, could sit between token deltas long enough for the idle timer to abort the underlying request and replace the eventual completed answer with an error.
Why This Change Was Made
This keeps the stricter first-delta behavior intact, so synthetic start or block-start events before provider output do not shorten the first-event window. Once a real provider delta has arrived, later provider-owned block boundaries now refresh the idle timer because they prove the SSE stream is still advancing.
User Impact
Users of opencode-go models should no longer lose completed answers when a provider pauses token deltas while closing one block and opening another. Truly stalled streams are still aborted after the configured idle timeout.
Evidence
node scripts/run-vitest.mjs run extensions/opencode-go/stream-termination.test.ts& .\node_modules\.bin\oxfmt.cmd --check --threads=1 extensions/opencode-go/stream-termination.ts extensions/opencode-go/stream-termination.test.tsgit diff --checkLive opencode-go wrapper stream proof from this branch:
This exercises the actual opencode-go stalled-stream wrapper. The first stream stays live across post-delta
toolcall_endandtoolcall_startboundaries for longer than one idle window and completes withdone. The second stream has no boundary or delta after its first delta, so the wrapper still aborts and emits the provider-owned stalled-stream error.Fixes #96518