fix(coding-agent): send the parked message queue with Enter after an interrupt - #1519
Open
snimu wants to merge 3 commits into
Open
fix(coding-agent): send the parked message queue with Enter after an interrupt#1519snimu wants to merge 3 commits into
snimu wants to merge 3 commits into
Conversation
Escape or Ctrl+C during a turn preserves queued steering/follow-up messages server-side but suspends the input pump. Nothing in the idle TUI resumed it: Enter on an empty editor was a no-op and the only recovery was typing a new message or editing the queue, so the queued message looked lost and the session looked stuck (discussion #1476). - AgentConnection gains resumeQueuedWork(); in-process calls the session primitive, daemon uses the existing resume_queue command. - Enter on an empty editor while idle with queued messages resumes the parked queue instead of doing nothing. - The queued-messages footer shows "enter to send" while idle, and refreshes on the streaming -> idle transition.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ad49ac3. Configure here.
…nd now refreshes the queue footer
…sume errors, fix doc comment - agent_start now refreshes the queued-messages footer so the enter-to-send hint disappears when a resumed turn starts streaming. - DaemonAgentConnection.resumeQueuedWork maps only the "No queued work to resume" failure to false; other daemon errors propagate so the TUI shows them. - The interface doc now describes the actual return value: whether queued input was there to drain.
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.

What this does
Fixes the parked-queue trap from discussion #1476: a message queued mid-turn survives Escape/Ctrl+C, but the interrupt suspends the input pump and the idle TUI offered no way to send it. Enter on an empty editor was a no-op, so the queued message looked lost and the session looked frozen; the only recovery was typing a new message or opening the queue editor.
How
Durable-queue direction (option C from the discussion) — the queue stays server-side and the idle UI gains the missing affordance:
AgentConnection.resumeQueuedWork(): in-process delegates toAgentSession.resumeQueuedWork(); the daemon connection uses the existingresume_queueprotocol command (already served by the daemon and used by update-restart recovery), so no protocol change.resumeParkedQueueIfIdle()); no-op while streaming or with an empty queue, errors surface viashowError.╰─ enter to send · <key> to browse and edit queued messageswhile idle, and is refreshed on the streaming → idle transition (agent_end).Tests
test/suite/agent-session-parked-queue.test.ts: end-to-end repro — steer mid-turn, abort, queue parked while idle,resumeQueuedWork()drains it.test/interactive-resume-parked-queue.test.ts: the empty-Enter branch (idle+queued resumes; streaming/empty-queue no-ops; errors surfaced).interactive-mode-status.test.ts: footer shows the hint when idle and omits it while streaming.All focused suites green (333 tests), daemon-mode 198/198, typecheck clean.
Note
Low Risk
UI and queue-drain affordance only; reuses existing session resume primitive and daemon protocol without changing auth or persistence.
Overview
Fixes the parked queue trap after Escape/Ctrl+C: queued steering/follow-up messages stay on the server, but abort suspends the input pump so nothing drains while the TUI is idle.
AgentConnection.resumeQueuedWork()un-suspends draining (in-process →AgentSession.resumeQueuedWork(); daemon → existingresume_queuecommand).InteractiveModecalls it when the user presses Enter on an empty editor while idle with queued work (resumeParkedQueueIfIdle), and surfaces failures viashowError.The queued-messages footer shows
enter to sendwhile idle (hidden during streaming), andupdatePendingMessagesDisplayruns on idle ↔ streaming transitions so the hint stays accurate.Reviewed by Cursor Bugbot for commit b2d64d4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix parked message queue to resume on Enter after an interrupt
resumeQueuedWork()to theAgentConnectioninterface and both connection implementations, which sends aresume_queuecommand to drain a suspended input queue after an Escape/Ctrl+C abort.InteractiveMode, submitting an empty editor while idle now callsresumeParkedQueueIfIdle()instead of no-op, triggering the resume if there are queued actions.enter to sendwhile the agent is idle and hides it during streaming, providing a visual cue that the queue can be resumed.Macroscope summarized b2d64d4.
Linear: ENG-5304