v1.4.1: Fix infinite error loop
Bug Fix
Fixed: Agent was looping 50 times on non-retryable errors (missing API key, auth failure, billing issues) instead of stopping immediately.
What changed
- Fatal error detection — New
isFatalError()recognizes permanent failures (missing API key, 401/403, billing, model not found) and stops the agent loop immediately - Circuit breaker — If the same non-fatal error repeats 3 times consecutively, the agent stops instead of burning through all 50 iterations
- Early API key check — Providers detect missing API keys before making HTTP requests and show actionable error messages
- Human-readable errors — No more raw JSON dumps. Errors now say things like "Set OPENAI_API_KEY or run: codebot --setup"
Before
✗ LLM error after retries: — { "error": { "message": "You didn't provide an API key..." } }
(repeated 50 times)
✗ Max iterations (50) reached.
After
✗ No API key configured for gpt-4.1. Set OPENAI_API_KEY or run: codebot --setup
Tests
138 passing (up from 131), including new tests for fatal error detection, circuit breaker behavior, and billing/quota error patterns.
npm install -g codebot-ai@1.4.1