Adds an optional `timeout_ms` parameter to the terminal tool that allows bounding the runtime of shell commands. When the timeout expires, the running terminal task is killed and the tool returns with the partial output captured so far. ## Summary This PR adds the ability for the agent to specify a maximum runtime when invoking the terminal tool. This helps prevent indefinite hangs when running commands that might wait for network, user prompts, or long builds/tests. ## Changes - Add `timeout_ms` field to `TerminalToolInput` schema - Extend `TerminalHandle` trait with `kill()` method - Implement `kill()` for `AcpTerminalHandle` and `EvalTerminalHandle` - Race terminal exit against timeout, killing on expiry - Update system prompt to recommend using timeouts for long-running commands - Add test for timeout behavior - Update `.rules` to document GPUI executor timers for tests ## Testing - Added `test_terminal_tool_timeout_kills_handle` which verifies that when a timeout is specified and expires, the terminal handle is killed and the tool returns with partial output. - All existing agent tests pass. Release Notes: - agent: Added optional `timeout_ms` parameter to the terminal tool, allowing the agent to bound command runtime and prevent indefinite hangs
Eval
This eval assumes the working directory is the root of the repository. Run it with:
cargo run -p eval
The eval will optionally read a .env file in crates/eval if you need it to set environment variables, such as API keys.
Explorer Tool
The explorer tool generates a self-contained HTML view from one or more thread JSON file. It provides a visual interface to explore the agent thread, including tool calls and results. See ./docs/explorer.md for more details.
Usage
cargo run -p eval --bin explorer -- --input <path-to-json-files> --output <output-html-path>
Example:
cargo run -p eval --bin explorer -- --input ./runs/2025-04-23_15-53-30/fastmcp_bugifx/*/last.messages.json --output /tmp/explorer.html