(t *testing.T)
| 387 | |
| 388 | func TestFatalAPIErrorKeywordsMatchPythonLoop(t *testing.T) { |
| 389 | fatalMessages := []string{ |
| 390 | "404", |
| 391 | "model_not_found", |
| 392 | "model not found", |
| 393 | "invalid_api_key", |
| 394 | "invalid api key", |
| 395 | "authentication failed", |
| 396 | "authorization failed", |
| 397 | "not_found", |
| 398 | "not found", |
| 399 | } |
| 400 | for _, msg := range fatalMessages { |
| 401 | if !agent.IsFatalAPIError(msg) { |
| 402 | t.Fatalf("%q should be fatal like Python loop.py", msg) |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | nonFatalMessages := []string{ |
| 407 | "temporary forbidden by upstream", |
| 408 | "billing quota temporarily unavailable", |
| 409 | "insufficient_quota", |
| 410 | } |
| 411 | for _, msg := range nonFatalMessages { |
| 412 | if agent.IsFatalAPIError(msg) { |
| 413 | t.Fatalf("%q should not be fatal in the agent loop Python keyword set", msg) |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | func TestCoreQueryLoopFatalStreamErrorEventDoesNotRetryLikePython(t *testing.T) { |
| 419 | var calls atomic.Int32 |
| 420 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected