fix: prevent persistent Claude SDK stream hangs - #11
Open
mradwankhalil wants to merge 16 commits into
Open
Conversation
Author
|
Follow-up fix added after live validation. /compact was lowering OpenCode's local context correctly, but the next normal request resumed the old sticky Claude session, whose hidden pre-compaction context reported ~806k cached input tokens. b4d999 adds the regression; 858a34 clears the base conversation binding at a classified summary boundary so the next turn transfers compacted OpenCode history into a fresh Claude session. Focused regressions, typecheck, build, and diagnostics pass. The full suite still stops at the unchanged Windows smoke assertion in test/smoke.ts:236. |
This was referenced Sep 5, 2026
Introduce ClaudePromptInput, a long-lived AsyncIterable<SDKUserMessage> backed by an unbounded queue. Each push() resolves the next pending pull; close() releases any waiting consumer. This is the primitive the proxy uses to stream user input into a persistent Agent SDK Query.
Closing the prompt input tears the SDK stream down synchronously. Doing it inline meant every turn paid to close the previous turn's bridge before it could proceed, adding seconds to every request. Measured on Windows with Opus 5: ~11s for a trivial prompt, ~3s once deferred. The close still happens, so the stream leak this branch fixes stays fixed — it just runs on the next macrotask instead of while a request is waiting. handle.close() and removal from the pool remain synchronous. Adds test/bridge-teardown-regression.ts covering both teardown paths: deleteBridge, and putBridge superseding an earlier turn for the same conversation.
mradwankhalil
force-pushed
the
fix/compaction-usage-and-summary
branch
from
September 6, 2026 18:13
f16b23d to
d0cb807
Compare
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.
Summary
Validation
npm testpassed.npm run buildpassed.npx tsc --noEmit -p tsconfig.jsonpassed.claude-opus-5for Opus, plussonnetandclaude-sonnet-4-6controls.Live evidence:
C:\Users\Zephyrus\AppData\Local\Temp\opencode\opencode-claude-live-matrix-20260912-0316.txtScope
All changes in this PR are under
opencode-claude. The separate OMO worktree was not modified or included.