MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / TestFatalAPIErrorKeywordsMatchPythonLoop

Function TestFatalAPIErrorKeywordsMatchPythonLoop

test/agent_test.go:389–417  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

387
388func 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
418func TestCoreQueryLoopFatalStreamErrorEventDoesNotRetryLikePython(t *testing.T) {
419 var calls atomic.Int32
420 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 1

IsFatalAPIErrorFunction · 0.92

Tested by

no test coverage detected