Skip to content

Conversation

hassoncs
Copy link
Contributor

@hassoncs hassoncs commented Oct 10, 2025

Introduce the runInBackground parameter for the execute_command tool. 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:

  • Adding the runInBackground parameter to the tool definition and prompt.
  • Modifying the executeCommand function to handle the runInBackground flag, ensuring commands proceed without user approval when set to true.
  • Implementing comprehensive unit and integration tests to verify the new functionality.

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

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: c86597e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Minor

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

@hassoncs hassoncs force-pushed the exec-cmd-in-background branch 15 times, most recently from 91b286f to 357b1f3 Compare October 15, 2025 20:10
@hassoncs
Copy link
Contributor Author

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, terminal_ctrl.

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 kill command, which is what the agent tries to do if you don't give it a new tool. So by giving it a tool, we can kill the process similar to the kill button that exists in the UI today. Essentially, this PR gives the agent the ability to click its own buttons in order to continue processes in the background and to kill things later.

Test plan:
I confirmed that the agent can run multiple long-running terminal commands, kill them arbitrarily, and still have visibility into running terminals when dispatching new tasks in orchestrator mode.

@hassoncs hassoncs marked this pull request as ready for review October 15, 2025 20:21
@hassoncs hassoncs force-pushed the exec-cmd-in-background branch 3 times, most recently from c354534 to 1c86ca5 Compare October 15, 2025 23:41
Chris Hasson added 2 commits October 15, 2025 16:42
- 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
@hassoncs hassoncs force-pushed the exec-cmd-in-background branch 2 times, most recently from f79e983 to a89bf11 Compare October 16, 2025 03:57
@hassoncs hassoncs force-pushed the exec-cmd-in-background branch from a89bf11 to 9a53d3a Compare October 16, 2025 03:59
@hassoncs hassoncs force-pushed the exec-cmd-in-background branch from 94ea34e to c86597e Compare October 16, 2025 04:39
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