Expand description
bash tool — execute a shell command with timeout enforcement and output capture.
Why: The coder agent loop needs to run commands (pytest, cargo test, etc.)
and read their output to iterate. Surfacing a non-zero exit code as a
recoverable ToolResult (not a hard error) lets the LLM read failing test
output and self-correct without aborting the loop.
What: BashTool implements ToolExecutor; it runs a command via sh -c
inside tokio::process::Command, enforces a configurable timeout, kills the
child (and its process group on Unix) on expiry, captures stdout + stderr
(each truncated to 100 KB), and returns a structured result that includes
the exit code, captured output, and a timeout flag.
Test: Unit tests live in bash::tests; they cover fast success, non-zero
exit, timeout-kill, cwd honoring, stdout/stderr truncation, registry
registration, and dispatch.
Structs§
- Bash
Tool - Executes arbitrary shell commands on behalf of the coder agent loop.
Constants§
- BASH_
TOOL_ NAME - The tool’s registered/advertised name.