fix(desktop): interrupt running turn when user sends a message while busy - #51666
Open
raymondclowe wants to merge 1 commit into
Open
fix(desktop): interrupt running turn when user sends a message while busy#51666raymondclowe wants to merge 1 commit into
raymondclowe wants to merge 1 commit into
Conversation
…busy
The desktop composer queued messages while the agent was busy but never
fired an interrupt — so the agent kept running for minutes, ignoring the
user's correction. The queue counter grew ('4 queued', '5 queued'...)
and only ONE message drained after the turn finally ended, leaving the
rest stranded.
Now when the user presses Enter with a payload while busy, the composer
both queues the message AND fires onCancel() to interrupt the running
turn — mirroring the CLI's busy_input_mode: interrupt behaviour and the
existing sendQueuedNow busy-path. The auto-drain then sends the queued
message as soon as the agent reports busy=false.
Files changed:
- apps/desktop/src/app/chat/composer/index.tsx
- apps/desktop/src/app/chat/composer/enter-submit-dom-race.test.tsx
Contributor
|
Thanks for isolating the busy-composer behavior. The defect is still present on current main, but this PR needs a small relocation before it can be salvaged. Problems
Suggested changes
Automated hermes-sweeper review. |
This was referenced Jul 28, 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.
Problem
When the agent is busy and the user types a correction + Enter, the desktop composer queues the message but never interrupts the running turn. The agent keeps going for minutes, ignoring the user's input. The queue counter grows ("4 queued", "5 queued"...) and only ONE message drains after the turn finally ends — leaving the rest stranded and often sending the agent off on a tangent based on a single out-of-context message.
The CLI has
busy_input_mode: interrupt(the default) which firesagent.interrupt()on Enter. The desktop app had no equivalent — it only queued.Fix
When the user presses Enter with a payload while busy, the composer now both queues the message AND fires
onCancel()to interrupt the running turn. This mirrors:busy_input_mode: interruptbehavioursendQueuedNowbusy-path (line ~1568): promote to head →onCancel()→ auto-drain on busy→falseThe auto-drain mechanism (
shouldAutoDrainincomposer-queue.ts) then sends the queued message as soon as the agent reportsbusy: false.Changes
apps/desktop/src/app/chat/composer/index.tsx: InsubmitDraft(), thebusy && payloadPresentbranch now callsqueueCurrentDraft()+onCancel()instead of justqueueCurrentDraft()apps/desktop/src/app/chat/composer/enter-submit-dom-race.test.tsx: Updated test harness and assertion to expectonCancelto be called when queueing while busyRelated issue
Closes #51665
Note
This PR addresses issue #1 from the issue (queue-not-interrupt). The WebSocket stall (#2) and reconnect queue recovery (#3) need separate investigation.