You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validate that the retry and error classification logic holds under simulated failure conditions — and prevent regressions as resilience features are added.
🔗 Status (re-checked 2026-10-01 on main @ 4e499fb)
Already done: network TypeError is retryable in both anthropic_client.mjs and groq_client.mjs, and both clients have network-error retry tests (retries when fetch throws a network error, rethrows the network error after exhausting retries). The scripts/lib/anthropic_client.mjs scope item and the matching criterion are checked below.
Everything else in the scope below is still missing.
🚀 Description
The test suite is already comprehensive for happy-path and input validation scenarios. What is missing is targeted failure injection:
groq_client.test.mjs covers 429 retry — good. No equivalent for 5xx.
anthropic_client.test.mjs has no retry count verification tests (no check on exact number of fetch calls).
llm_client.test.mjs does not verify that provider fallback is blocked on permanent 4xx errors.
No test injects a network-level error (connection reset) to verify it is treated as retryable.(done)
No test verifies timeout abort behaviour.
smoke.test.mjs has no scenario for a run that fails transiently and recovers.
Dependencies resolved:#109 (error taxonomy) ✅ and #111 (retry utility) ✅ are both merged. scripts/lib/retry.mjs, scripts/lib/error_taxonomy.mjs, and scripts/lib/anthropic_client.mjs (with retryWithBackoff) are all in place. Open dependency:#162 (per-provider config in the fallback), for the llm_client.test.mjs fallback cases.
🧩 Scope
In:
scripts/tests/groq_client.test.mjs: add cases for HTTP 500, 502, 503, 504 — verify each is retried up to maxAttempts then throws.
🎯 Goal
Validate that the retry and error classification logic holds under simulated failure conditions — and prevent regressions as resilience features are added.
📍 Context
scripts/tests/anthropic_client.test.mjs,scripts/tests/groq_client.test.mjs,scripts/tests/llm_client.test.mjs,scripts/tests/smoke.test.mjs🔗 Status (re-checked 2026-10-01 on
main@ 4e499fb)TypeErroris retryable in bothanthropic_client.mjsandgroq_client.mjs, and both clients have network-error retry tests (retries when fetch throws a network error,rethrows the network error after exhausting retries). Thescripts/lib/anthropic_client.mjsscope item and the matching criterion are checked below.callLLMpasses the primary provider'sapiKey,apiUrlandmodelto every provider, and the mocked fetch accepts any key and URL. A "503 then fallback" test written now would pass while the production fallback stays broken. Do thellm_client.test.mjsfallback cases after [BUG] callLLM provider fallback sends the primary provider's model, API key and URL to the fallback provider #162, and assert URL, auth header and model per provider.scripts/tests/llm_client.test.mjs: do not generate both in parallel.🚀 Description
The test suite is already comprehensive for happy-path and input validation scenarios. What is missing is targeted failure injection:
groq_client.test.mjscovers 429 retry — good. No equivalent for 5xx.anthropic_client.test.mjshas no retry count verification tests (no check on exact number of fetch calls).llm_client.test.mjsdoes not verify that provider fallback is blocked on permanent 4xx errors.No test injects a network-level error (connection reset) to verify it is treated as retryable.(done)smoke.test.mjshas no scenario for a run that fails transiently and recovers.🧩 Scope
In:
scripts/tests/groq_client.test.mjs: add cases for HTTP 500, 502, 503, 504 — verify each is retried up tomaxAttemptsthen throws.scripts/tests/anthropic_client.test.mjs: add cases for 500/503 retry (exact call count), 401 immediate throw (1 call only).network reset retried(done).scripts/tests/llm_client.test.mjs(after [BUG] callLLM provider fallback sends the primary provider's model, API key and URL to the fallback provider #162):scripts/tests/retry.test.mjs:AbortError) counted as a retryable attempt.Retry-Afterheader respected.scripts/tests/smoke.test.mjs: add one scenario — first LLM call returns 503, second succeeds — verify output is correct and attempt counter is 2.(done:scripts/lib/anthropic_client.mjs: fix networkTypeErrorcurrently marked asretryable: false— should be retryable.fetchErr.retryable = true)Out:
🧪 Acceptance criteria
callLLM, the secondary provider is never called and exactly one fetch call is made.TypeError) occurs incallAnthropic, the retry count increases by 1 and the error is treated as retryable. (Covered onmain.)AbortError) occurs, it is counted as a retryable attempt and the retry count increases by 1.Retry-Afterheader is present, the retry delay matches the header value (using fake timers — no realsetTimeout).callAnthropicis retried and eventually returns the mocked success response (exact call count asserted).maxAttemptstotal calls.callLLMwith a primary provider returning 503 and exhausting retries: secondary provider IS called, with its own URL, auth header and model. Requires [BUG] callLLM provider fallback sends the primary provider's model, API key and URL to the fallback provider #162.callGroqare each retried up tomaxAttemptsthen throw.⚙️ Constraints
node --test scripts/tests/*.test.mjswithout any additional flags.