Impact
Stopping an active ACP Agent Mode run can silently discard steering text that the UI already accepted but that is still queued behind active MCP tools. Claude steering is restored to the composer on ordinary user stop; ACP steering is cleared without restoration.
Affected snapshot
Confirmed statically on origin/main at a094dd9a83d03820201769ebc079c49fbd2e86fc.
Reachable scenario
- Run an ACP-backed Agent Mode session.
- Submit steering while an MCP tool is active, so the ACP flush task waits for MCP idle with the steering still in
pendingACPSteeringInstructions.
- Stop the run before delivery.
- Cancellation clears the ACP queue and token queue; the draft is neither delivered nor restored to the composer.
Because the cancellation and flush paths are MainActor-isolated, the cancelled flush cannot requeue the draft before cancelRun clears it.
A focused test can block awaitNoActiveMCPTools, enqueue ACP steering, invoke .userStop, and assert that the exact undelivered text is restored once.
Evidence
- ACP steering waits for MCP idle at
Sources/RepoPrompt/Features/AgentMode/Runtime/AgentModeRunService.swift:340-354.
cancelRun cancels both flush tasks at AgentModeRunService.swift:930-936.
- For
.userStop, only restoreAllQueuedClaudeSteeringDrafts is called at AgentModeRunService.swift:938-948.
- The method then unconditionally clears
pendingACPSteeringInstructions and pending input tokens at AgentModeRunService.swift:950-960.
- The execution-location-change path already has a combined restoration helper, demonstrating the intended lossless behavior for undelivered drafts.
Expected behavior
Accepted but undelivered user text must be either delivered or restored exactly once. Stopping a run must not silently erase it.
Suggested direction
Restore queued ACP drafts alongside Claude drafts for .userStop, using the existing coalescing/order rules and reconciling pending token-queue entries. Preserve the distinction between undelivered steering and the already-delivered active prompt.
Acceptance criteria
- User stop restores all undelivered ACP steering exactly once and in order.
- Already-delivered steering is not replayed.
- Pending token accounting is reconciled with restored/coalesced drafts.
- Tests cover cancellation while waiting for MCP idle, after dequeue but before send completion, and ordinary successful delivery.
Validation status
Static source review only; no provider run was started.
Related
Impact
Stopping an active ACP Agent Mode run can silently discard steering text that the UI already accepted but that is still queued behind active MCP tools. Claude steering is restored to the composer on ordinary user stop; ACP steering is cleared without restoration.
Affected snapshot
Confirmed statically on
origin/mainata094dd9a83d03820201769ebc079c49fbd2e86fc.Reachable scenario
pendingACPSteeringInstructions.Because the cancellation and flush paths are MainActor-isolated, the cancelled flush cannot requeue the draft before
cancelRunclears it.A focused test can block
awaitNoActiveMCPTools, enqueue ACP steering, invoke.userStop, and assert that the exact undelivered text is restored once.Evidence
Sources/RepoPrompt/Features/AgentMode/Runtime/AgentModeRunService.swift:340-354.cancelRuncancels both flush tasks atAgentModeRunService.swift:930-936..userStop, onlyrestoreAllQueuedClaudeSteeringDraftsis called atAgentModeRunService.swift:938-948.pendingACPSteeringInstructionsand pending input tokens atAgentModeRunService.swift:950-960.Expected behavior
Accepted but undelivered user text must be either delivered or restored exactly once. Stopping a run must not silently erase it.
Suggested direction
Restore queued ACP drafts alongside Claude drafts for
.userStop, using the existing coalescing/order rules and reconciling pending token-queue entries. Preserve the distinction between undelivered steering and the already-delivered active prompt.Acceptance criteria
Validation status
Static source review only; no provider run was started.
Related
agent_run.waitinterrupt payloads, not loss of queued ACP text on user stop.