fix: graceful streaming interruption without error messages#448
Open
avoidwork wants to merge 2 commits into
Open
fix: graceful streaming interruption without error messages#448avoidwork wants to merge 2 commits into
avoidwork wants to merge 2 commits into
Conversation
- Add OpenSpec change for graceful streaming interruption handling - Proposal: fix race condition between handleChat() and handleInterrupt() - Design: use isIntentionalAbort ref to distinguish intentional from accidental aborts - Spec: define requirements for error-type-independent interruption recognition - Tasks: 5 groups covering ref flag, catch block update, early abort check, tests, and verification
- Add isIntentionalAbortRef to track intentional vs accidental aborts - Set flag in handleInterrupt() before aborting the stream - Check flag in handleChat() catch block to suppress error display - Reset flag in handleChat() finally block for clean state - Add early abort signal check in callReactAgentStreaming() - Throw named AbortError with descriptive message on early abort - Add tests for early abort check with descriptive message - Add test verifying no AbortError when signal is not aborted Fixes #447: User no longer sees error messages when interrupting streaming responses with a new message.
Owner
Author
Audit Results: Graceful Streaming Interruption — ImplementationAudit SummaryStatus: PASS — Implementation satisfies all goals, specs, and tasks. Goal Fulfillment
Spec Compliance
Task Completion
Quality Check
ConclusionAll four audit dimensions pass. Implementation is complete and correct. Proceeding to Step 10: Archive. |
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.
Description
Fix the issue where sending a new message while the agent is streaming a response causes an error message to be displayed to the user instead of a clean "Interrupted." status.
Type of Change
Testing
Coverage
Checklist
npm run lintpassesTechnical Details
Root Cause: Race condition between
handleChat()andhandleInterrupt()— both await the samedispatchPromise, and when the abort signal triggers, the error thrown doesn't always havename === "AbortError", causinghandleChat()'s catch block to treat it as a real error.Fix:
isIntentionalAbortref insrc/tui/app.js— set byhandleInterrupt()before aborting, checked byhandleChat()'s catch blocksrc/agent/react.js— throws namedAbortErrorif signal is already aborted on function entry