Skip to content

Conversation

@fede-ciliberti
Copy link

@fede-ciliberti fede-ciliberti commented Nov 6, 2025

Summary

This PR adds support for background command execution in the execute_command tool, allowing commands to run asynchronously without blocking the workflow.

Problem

Currently, all commands executed through the execute_command tool block the workflow and may require user interaction via prompts. This limits the ability to run long-running processes or scripts that should execute in the background while the agent continues with other tasks.

Solution

Added a new optional background parameter to the execute_command tool that allows for non-blocking command execution.

Changes Made

1. Core Implementation

  • src/shared/tools.ts: Added "background" parameter to toolParamNames array and ExecuteCommandToolUse interface
  • src/core/tools/executeCommandTool.ts: Implemented background execution logic with async handling
  • src/integrations/terminal/TerminalProcess.ts: Updated to support background execution

2. Documentation Updates

  • src/core/prompts/tools/execute-command.ts: Updated tool prompt with background parameter documentation
  • src/core/prompts/sections/capabilities.ts: Updated capabilities documentation

3. Testing

  • src/integrations/terminal/__tests__/background-execution.spec.ts: Comprehensive test suite for background execution

Usage

Standard Command (blocking)

<execute_command>
<command>npm run build</command>
</execute_command>

Background Command (non-blocking)

<execute_command>
<command>npm run dev</command>
<background>true</background>
</execute_command>

Behavior

  • When background=true: Command executes asynchronously, no user prompts, continues workflow
  • When background=false or omitted: Standard behavior (blocking, may show prompts)
  • Backward compatible: All existing execute_command usage continues to work unchanged

Benefits

  1. Non-blocking workflows: Run long processes in background while agent continues with other tasks
  2. Better UX: No interruption for commands that don't need user interaction
  3. Flexibility: Developers can choose blocking or non-blocking execution based on their needs
  4. Backward compatible: No breaking changes to existing functionality

Testing

  • Comprehensive test coverage for both background=true and background=false scenarios
  • Tests verify correct behavior, proper default values, and edge cases
  • All existing functionality remains unchanged and working

Files Changed

  • 4 files modified (+187, -11 lines)
  • 1 new test file created
  • Zero breaking changes

Checklist

  • Code follows existing patterns and conventions
  • Comprehensive tests added
  • Documentation updated
  • Backward compatibility maintained
  • No breaking changes introduced

Important

Adds background execution support to execute_command tool with a new background parameter, enabling asynchronous command execution.

  • Behavior:
    • Adds background parameter to execute_command tool for asynchronous execution in src/core/tools/executeCommandTool.ts.
    • Updates getExecuteCommandDescription() in src/core/prompts/tools/execute-command.ts to document background parameter.
    • Supports both background=true (non-blocking) and background=false (blocking) modes.
  • Testing:
    • New test suite background-execution.spec.ts for background execution scenarios.
    • Tests cover background=true, background=false, and default behavior.
  • Misc:
    • Updates toolParamNames and ExecuteCommandToolUse in src/shared/tools.ts to include background parameter.

This description was created by Ellipsis for 945d3fc. You can customize this summary. It will automatically update as commits are pushed.

- Add 'background' parameter to execute_command tool for non-blocking command execution
- Update ExecuteCommandToolUse interface to include optional background parameter
- Implement logic to skip user prompts when background=true
- Add comprehensive tests for background execution behavior
- Update tool documentation and capabilities to reflect new functionality
- Maintain backward compatibility with existing execute_command usage
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 6, 2025
@roomote
Copy link

roomote bot commented Nov 6, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed - no issues found. The implementation correctly adds background command execution support with proper parameter handling, backward compatibility, and test coverage.

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

@dosubot dosubot bot added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 6, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 6, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 6, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants