fix(chat): recover reliably after Stop when a turn stalls - #595
Draft
Is14w wants to merge 15 commits into
Draft
Conversation
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.
Linked issue
Closes #583
Summary
Fix a chat lifecycle failure where pressing Stop can leave the conversation stuck in
Vibing...and prevent subsequent user messages from starting.The recovery path now releases the local chat runtime when Stop intersects with independently blocking work, including provider streaming, retry and failover work, terminal history persistence, memory extraction, compaction, and diagnostic persistence. It also prevents late callbacks from an aborted run from mutating a newer run for the same conversation.
For responses that were already terminally committed before Stop, preserve the completed outcome instead of publishing a spurious cancelled Gateway state or
Cancellederror.Change scope
agent-gui/agent-uicrates/agent-gui/src/pages/chat/runtime/useSendChatTurn.tscrates/agent-gui/src/pages/chat/runtime/chatRunFinalization.tscrates/agent-gui/src/pages/chat/turns/runAgentConversationTurn.tscrates/agent-gui/src/pages/chat/turns/runTextConversationTurn.tscrates/agent-gui/src/lib/providers/runtime/streamRetry.tscrates/agent-gui/src/lib/providers/runtime/providerFailover.tscrates/agent-gui/src/lib/cancellation/abortRace.tscrates/agent-gui/src/lib/chat/compaction/controller.tscrates/agent-ui/src/pages/chat/ChatComposerBar.tsxcrates/agent-gui/test/chat/crates/agent-gui/test/providers/Screenshots / preview
Verification
Added focused regression coverage for:
Passed: