| 125 | } |
| 126 | } |
| 127 | |
| 128 | func TestBashCustomTimeoutHonored(t *testing.T) { |
| 129 | // timeout_seconds of 1 truncates the 3s sleep, and flows through to Bash. |
| 130 | start := time.Now() |
| 131 | call := chmctx.ToolCall{ |
| 132 | ID: "t1", Name: "bash", |
| 133 | Arguments: map[string]any{ |
| 134 | "cmd": "sleep 3", |
| 135 | "timeout_seconds": float64(1), |
| 136 | }, |
| 137 | } |
| 138 | msg := Execute(context.Background(), call) |
| 139 | if elapsed := time.Since(start); elapsed > 2*time.Second { |
| 140 | t.Fatalf("custom timeout ignored; elapsed %s", elapsed) |
| 141 | } |
| 142 | if !strings.Contains(msg.Content, "timeout") { |
| 143 | t.Fatalf("expected timeout marker: %q", msg.Content) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | func TestBashTimeoutCappedAtOneHour(t *testing.T) { |