-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add support for background terminal command execution #2920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: ec779d6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
91b286f to
357b1f3
Compare
|
I updated this after discussing this with Hannes on the Roo side. I added more code in order to help the agent manage the running terminal processes. I couldn't think of a better way to do this other than adding a new tool, I thought about maybe adding new parameters to the execute command tool to allow it to send the signal, but that didn't seem very clean either. So, this solution seems to work, but I don't really love the fact that we had to add a tool :-/. At first, I tried capturing the PIDs of the processes, but it's difficult to get the PID of the built-in VS Code terminal commands. You end up getting the shell process ID, which cannot be killed using the regular Test plan: |
c86597e to
3db34a7
Compare
327f3da to
641b8fc
Compare
34a1ff3 to
e9eacb3
Compare
- Add `run_in_background` parameter to `execute_command` tool for automatic background execution - Introduce new `terminal_ctrl` tool for killing processes in terminals - Update environment details to include terminal ID information for process management - Refactor tests to focus on kill command generation logic BREAKING CHANGE: New tool parameters and tools added, may require updates to tool usage patterns Add change markers Rename to terminalKill tool Simplify and revert runInBackground feat(terminal): refactor listener management for background execution Adjust listener cleanup logic in terminal processes to support background command execution. Move listener removal from continue() to complete() and abort() methods, and add comprehensive tests for background behavior. feat(terminal): enable background command execution Commands now run in detached background processes, allowing long-running tasks to execute without blocking the UI. The terminal integration has been refactored to support non-blocking execution while maintaining output monitoring and proper cleanup. feat(terminal): add kill requested tracking for terminals - Add `killRequested` property to `RooTerminal` interface and `BaseTerminal` class - Set flag to true when kill is initiated and reset on completion or error - Update environment details to display terminal status as "Killing" or "Active feat(terminal): introduce process termination tool and optimize execution control Implement terminal_kill tool for managing active processes with required parameters. Enhance executeCommandTool to prioritize explicit background execution preferences. Streamline ExecaTerminalProcess configuration documentation. fix(terminal): correct block name formatting in terminal kill case Remove extra apostrophe from block name string in terminal_kill case to fix formatting inconsistency. Add kilocode_change markers to track modifications in terminal-related code. feat(terminal): add terminal process kill functionality and background execution support - Add `runInBackground` and `terminalId` fields to command execution status schema - Implement `killTerminal` method in TerminalRegistry for targeted process termination - Refactor terminal kill tool to use registry method and simplify logic - Update webview message handling to pass terminal ID for operations - Enhance UI components to display background execution status and kill actions - Add support for aborting specific terminals via terminal ID BREAKING CHANGE: Terminal operation handling now requires optional terminalId parameter for targeted control
e9eacb3 to
711233b
Compare
- Add kilocode_change markers to terminal schema fields and environment details - Implement terminal_kill tool UI in ChatRow component with proper markers - Remove isOrganization prop from payment_required_prompt handling
- Add `run_in_background` parameter to execute_command tool for running commands asynchronously - Implement terminal_kill tool with improved parameter validation for killing terminal processes - Update tool registry and execution logic to support new functionality
…ound execution - Add terminal kill functionality with terminalId support in Task and TerminalRegistry - Improve background execution cleanup and error handling in ExecaTerminalProcess - Update terminal kill tool to verify terminal existence and process status - Enhance UI components for background execution indicators and abort controls - Add comprehensive tests for race conditions and edge cases in terminal processes - Refactor terminal process lifecycle management for better reliability BREAKING CHANGE: Terminal kill tool now requires terminalId parameter for targeted process termination
8b70cd6 to
b4379c4
Compare
…nalProcess - Move 'completed' event emission before removing listeners to ensure proper notification - Remove unused variables and dead code for cleaner implementation - Enhance test suite with comprehensive async handling and additional test cases for error scenarios, abort behavior, and background execution Closes background execution refinements for terminal processes.
|
No rush on this, but this branch seems to be working pretty well. I've been testing it locally, and I think the code is decently good, so it should be ready for review when anyone has a moment! cc @pandemicsyn / @chrarnoldus |
Introduce the
runInBackgroundparameter for theexecute_commandtool. This allows commands to be executed without requiring user interaction, which is beneficial for long-running processes such as development servers or build tasks.The changes include:
runInBackgroundparameter to the tool definition and prompt.executeCommandfunction to handle therunInBackgroundflag, ensuring commands proceed without user approval when set to true.Discussions:
#2917
#2196
I opened the same thing on the Roo side since we haven't sent them anything in a while:
RooCodeInc/Roo-Code#8607