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