Skip to content

fix(coding-agent): send the parked message queue with Enter after an interrupt - #1519

Open
snimu wants to merge 3 commits into
mainfrom
fix/resume-parked-queue-on-empty-submit
Open

fix(coding-agent): send the parked message queue with Enter after an interrupt#1519
snimu wants to merge 3 commits into
mainfrom
fix/resume-parked-queue-on-empty-submit

Conversation

@snimu

@snimu snimu commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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 to AgentSession.resumeQueuedWork(); the daemon connection uses the existing resume_queue protocol command (already served by the daemon and used by update-restart recovery), so no protocol change.
  • Enter on an empty editor while idle with queued messages resumes the parked queue (resumeParkedQueueIfIdle()); no-op while streaming or with an empty queue, errors surface via showError.
  • The queued-messages footer reads ╰─ enter to send · <key> to browse and edit queued messages while 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 → existing resume_queue command). InteractiveMode calls it when the user presses Enter on an empty editor while idle with queued work (resumeParkedQueueIfIdle), and surfaces failures via showError.

The queued-messages footer shows enter to send while idle (hidden during streaming), and updatePendingMessagesDisplay runs 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

  • Adds resumeQueuedWork() to the AgentConnection interface and both connection implementations, which sends a resume_queue command to drain a suspended input queue after an Escape/Ctrl+C abort.
  • In InteractiveMode, submitting an empty editor while idle now calls resumeParkedQueueIfIdle() instead of no-op, triggering the resume if there are queued actions.
  • The queued-messages footer now shows enter to send while 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

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ 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.

Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
Comment thread packages/coding-agent/src/modes/agent-connection/types.ts
snimu added 2 commits August 18, 2026 13:32
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant