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
9.8 KiB
9.8 KiB