feat: add CancelCommand IPC message type for canceling running terminal commands#11632
Open
roomote[bot] wants to merge 3 commits intomainfrom
Open
feat: add CancelCommand IPC message type for canceling running terminal commands#11632roomote[bot] wants to merge 3 commits intomainfrom
roomote[bot] wants to merge 3 commits intomainfrom
Conversation
…al commands
CLO-1004: Allow canceling a running command in Roo Code Cloud.
- Add CancelCommand to TaskCommandName enum and taskCommandSchema
- Handle CancelCommand in API IPC handler by calling handleTerminalOperation("abort")
- Add cancelCommand() convenience method to IpcClient
- Add tests for schema validation and API handler
2bc731f to
3b27135
Compare
…d UI
When handleTerminalOperation("abort") is called via IPC CancelCommand, the
execa subprocess is killed and the process promise rejects. Previously, this
rejection was unhandled (isUserTimedOut was false), causing the error to
propagate up without emitting any TaskEvent, leaving the cloud UI stuck.
Changes:
- Add isTerminalAbortedExternally flag to Task class
- Set the flag in handleTerminalOperation before calling abort()
- Check the flag in executeCommandInTerminal catch block alongside isUserTimedOut
- When set, handle cleanly: say error, set didToolFailInCurrentTurn, return tool result
- Add "cancelled" status to CommandExecutionStatus discriminated union
- Add tests for both the external abort case and the unexpected error case
…sition 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 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.
Related GitHub Issue
Closes: CLO-1004
Description
Adds a new
CancelCommandIPC message type that allows the cloud sandbox to cancel a running terminal command without aborting the entire Roo task.Key changes:
packages/types/src/ipc.ts: AddedCancelCommandto theTaskCommandNameenum andtaskCommandSchemaZod discriminated unionsrc/extension/api.ts: Added handler in the IPCTaskCommandswitch that callssidebarProvider.getCurrentTask()?.handleTerminalOperation("abort")-- this reuses the existing abort flow that the webview UI already uses locallypackages/ipc/src/ipc-client.ts: AddedcancelCommand()convenience method following the existingsendTaskMessage()/deleteQueuedMessage()patternHow it works: When the cloud sends a
CancelCommandvia IPC, the extension callshandleTerminalOperation("abort")on the current task, which callsabort()on the terminal process. For execa terminals (used in cloud), this sends SIGKILL to the subprocess and all its children via ps-tree.Merge order note: The Roo-Code-Cloud PR will reference
TaskCommandName.CancelCommandfrom@roo-code/types. This PR must merge first so the updated package can be published before the cloud PR can resolve its type references.Test Procedure
packages/types/src/__tests__/ipc.test.ts(validates CancelCommand parses correctly, included in expected commands list)src/extension/__tests__/api-cancel-command.spec.ts(verifies abort is called on current task, handles missing task gracefully, handles task with no terminal process)Pre-Submission Checklist
Documentation Updates
Additional Notes
This is the extension-side half of CLO-1004. The cloud-side PR (in Roo-Code-Cloud) will consume
TaskCommandName.CancelCommandand callipcClient.cancelCommand()when the user triggers a cancel action. Both PRs are being developed in parallel, but this one must merge first.Start a new Roo Code Cloud session on this branch