🪲 BUG-#79 #80: Fix message loss in long interactions (provider, chat, serve, agent) - #82
Merged
Conversation
…ny mid-read failure
This was referenced Aug 24, 2026
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()inGenericProviderno longer discards accumulated text/tool_calls on a mid-read failure (timeout, network error, or anything else) — returns a partialProviderResponseinstead of raising, so the turn still gets persisted. Re-raises only when nothing was streamed yet, so retry logic still covers a pure connection failure. Bumped default/example timeout 60s → 180s.chat.py: streamed text buffer is flushed to the log (marked "interrupted") before showing a turn error, instead of silently disappearing.serve.py: broken pipe no longer kills the RPC thread silently; malformed NDJSON input is logged instead of dropped; added a heartbeat notification during long turns;confirm()now times out (120s) and declines instead of blocking forever.agent.py: everyAgentcallback (on_message,on_tool_call,on_usage, etc.) is now wrapped so a consumer-side bug/failure (e.g. storage write error) can't abort the rest of an in-flight turn.Closes #79, Closes #80
Test plan
pytest tests/(excluding pre-existing flakytest_serve_end_to_end.py, unrelated) — 337 passed