fix: emit command_output instead of error on cancel for cloud UI transition

The cloud message parser only recognizes say:"command_output" to
transition pending commands. Using say:"error" left the pending
command stuck in the UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
daniel-lxs 2026-02-20 13:58:20 -05:00
parent 014dfdc465
commit 80e6750f38
No known key found for this signature in database
GPG key ID: 21C74479048B3AA6
2 changed files with 2 additions and 2 deletions

View file

@ -373,7 +373,7 @@ export async function executeCommandInTerminal(
task.isTerminalAbortedExternally = false
const status: CommandExecutionStatus = { executionId, status: "cancelled" }
provider?.postMessageToWebview({ type: "commandExecutionStatus", text: JSON.stringify(status) })
await task.say("error", "The command was cancelled by the user.")
await task.say("command_output", "Command cancelled.")
task.didToolFailInCurrentTurn = true
task.terminalProcess = undefined

View file

@ -419,7 +419,7 @@ describe("executeCommand", () => {
// Verify: should return a clean tool result, not throw
expect(rejected).toBe(false)
expect(result).toBe("The command was cancelled by the user.")
expect(mockTask.say).toHaveBeenCalledWith("error", "The command was cancelled by the user.")
expect(mockTask.say).toHaveBeenCalledWith("command_output", "Command cancelled.")
expect(mockTask.didToolFailInCurrentTurn).toBe(true)
expect(mockTask.terminalProcess).toBeUndefined()
// Verify the flag was reset