Repository navigation
Fix mid-stream disconnect hang; default /break off - #86
Merged
Merged
Conversation
A server dropping the connection mid-stream surfaced as a non-EOF read error in stream(), which reported EventError and returned nil without ever emitting EventFinish. Client.Chat's own doc comment promises exactly one EventFinish per call, and callers (the TUI included) drive their turn state off it, so a caller was left waiting on a turn that had actually already stopped: the disconnect disrupted the session. Hold the read error the same way a reported failure is already held, and let it flow through the same retry and finish logic: a disconnect before anything was delivered costs nothing and is retried like any other undelivered failure, and a disconnect after partial text still ends in exactly one EventFinish with Finished false. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KCaxpUCVhMswb9NsLjzZxS
Periodic screen-break reminders defaulted to on, with no setting in a user's own config file to override it silently - a file predating this field got the reminders whether it wanted them or not. Flip the default to off; /break on, and /break on save, still turn it on for whoever wants it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KCaxpUCVhMswb9NsLjzZxS
glenjbarber
marked this pull request as ready for review
October 14, 2026 20:52
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
stream()reported anEventErrorand returned immediately without ever emittingEventFinish.Client.Chat's own contract promises exactly oneEventFinishper call, and callers (the TUI's turn state included) drive off it, so a dropped connection left the session waiting on a turn that had actually already stopped. The read error is now held and routed through the same finish/retry logic as every other failure: a disconnect before anything was delivered is retried like any other undelivered failure, and a disconnect after partial text still ends in exactly oneEventFinishwithFinished: false.break_enabled's default tofalse(code default andorcli.json.example)./break onand/break on savestill turn the periodic screen-break reminder on for whoever wants it.Test plan
go build ./...go test ./internal/openrouter/...(addedTestStreamDisconnectBeforeDeliveryIsRetriedandTestStreamDisconnectAfterDeliveryStillFinishesregression tests)go test ./internal/config/... ./cmd/orcli/...🤖 Generated with Claude Code
https://claude.ai/code/session_01KCaxpUCVhMswb9NsLjzZxS
Generated by Claude Code