TestBashTimeoutOverflowClamped: extreme floats must be clamped BEFORE the Duration multiply. `time.Duration(1e18) * time.Second` overflows int64 to a negative deadline, firing context.WithTimeout instantly: the command would "succeed" without running. Clamp up front to avoid it.
(t *testing.T)
| 164 | // Duration multiply. `time.Duration(1e18) * time.Second` overflows int64 to a |
| 165 | // negative deadline, firing context.WithTimeout instantly: the command would |
| 166 | // "succeed" without running. Clamp up front to avoid it. |
| 167 | func TestBashTimeoutOverflowClamped(t *testing.T) { |
| 168 | call := chmctx.ToolCall{ |
| 169 | ID: "t3", Name: "bash", |
| 170 | Arguments: map[string]any{ |
| 171 | "cmd": "echo ok", |
| 172 | "timeout_seconds": float64(1e18), |
| 173 | }, |
| 174 | } |
| 175 | msg := Execute(context.Background(), call) |
| 176 | if !strings.Contains(msg.Content, "ok") { |
| 177 | t.Fatalf("overflow clamp: expected echo output, got %q", msg.Content) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | // TestBashParentCancelMidRun: parent cancel mid-sleep returns "(cancelled)", |