Repository navigation
fix: retry circuit-breaker rejections and reconnect after unrecognised failures - #901
Merged
Merged
Conversation
Gateways with circuit breakers reject with text like "all targets recovering (half-open probe in flight)" and a non-5xx status, which no retry rule matched, so parallel subagents failed instead of backing off. Issue: #900
A failure that matches no retry rule is now retried up to 3 times with 3s, 6s, 6s waits. Aborts, context overflow, auth, output-length, structured-output, content-filter and reasoning-state failures stay terminal. Issue: #900
LeXwDeX
marked this pull request as ready for review
October 27, 2026 15:14
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A 4xx is the provider's answer to the request; resending cannot change it and delayed StopFailure hooks. The fallback now covers failures without an HTTP status, such as dropped WebSockets and transport errors. Issue: #900
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Closes #900
Parallel DAG subagents failed at once with
all targets recovering (half-open probe in flight). The upstream gateway's circuit breaker sends this text with a non-5xx status while every backend target is tripped. No retry rule matched it, soSessionRetry.retryablereturnedundefinedand the first failure was final. Any other unrecognised transport or WebSocket failure had the same problem.What changed
RETRYABLE_MESSAGE_PATTERNSnow matchesall targets recovering,half-open,circuit openandcircuit breaker is open. These use the normal backoff and limits.shouldRetrygate runs first and is unchanged; it blocks retries once a tool has run or may have run.Evidence
bun test test/session/retry.test.ts: 74 passed. Covers circuit-breaker text in a message and in a 400 response, 3 reconnects with 3000/6000/6000 ms waits checked underTestClock, and terminal errors, including a 400, kept out of the fallback.bun test test/session/processor-effect.test.ts: 29 passed. The unclassified mid-stream provider error test now allows 30 s for the reconnects.hooks-lifecycle-model-http,prompt-admission,subagent-stop-routing): 24 passed, 1 failed. The failingStop asyncRewakechain test hits its 5 s timeout locally without this change too, and passed in CI.bun test test/session: 993 passed, 1 failed. The signed-reasoning prefix test failed once under full-suite load. It passes alone, with or without this change.tsgo --noEmit(opencode): passed.bun run lint: 4675 warnings, 0 errors (cap unchanged).script/release-notes.tsforgraphagent-v1.0.90.--no-verify, so CI on the pinned toolchain is authoritative.Issue: #900trailers are unchanged.Checklist
Retry-Afterhandling for recognised errors are unchanged.e5e44e5737before merge.Delivery
8e7457b783f25b863709e0fddd71af76aed7bb36(merge commit); fix: retry circuit-breaker rejections from upstream gateways #900 is closed.1.0.90.🤖 Generated with Claude Code