Repository navigation
fix(failover): classify transient Undici error codes - #123042
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 1:27 PM ET / 17:27 UTC. ClawSweeper reviewWhat this changesThe PR routes structured assistant error codes and types into failover and retry decisions, reusing OpenClaw’s shared transient-network classifier. Merge readiness✅ Ready for maintainer review No blocking findings. This remains necessary: current main still ignores structured transient codes in outer retry and its failover code list, while the branch carries those fields through the existing shared matcher. Priority: P1 Review scores
Verification
How this fits togetherProvider transports normalize thrown network failures into assistant messages. Agent failover and outer retry consume the normalized status, code, and message to select a fallback or retry. flowchart LR
A[Provider transport error] --> B[Assistant error projection]
B --> C[Failover signal]
C --> D[Shared transient network matcher]
D --> E[Failover classification]
D --> F[Outer retry decision]
E --> G[Model fallback]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1, Tests +28. Total +27 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep transient-code policy centralized in the shared matcher and merge this focused consumer repair after the normal exact-head gate. Do we have a high-confidence way to reproduce the issue? Yes — current main’s code path is source-reproducible with a generic assistant error message plus a structured transient code; the PR body additionally records exact-head real-transport output. Is this the best way to solve the issue? Yes — forwarding the normalized fields and reusing the existing shared matcher is the narrow canonical fix, rather than adding a second Undici-specific policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6509a09ca7a5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
1226809 to
f6b6332
Compare
|
Maintainer note: local review is clean. I am updating this PR from f6b6332b62f669efd6a5453922fb74f5128cf8bf onto current origin/main (886e5c0) to refresh exact-head CI and clear the unrelated red gateway timing check before merge. No action is needed from the contributor for now. |
f6b6332 to
0934155
Compare
|
Latest ClawSweeper review identified a P2 in the transient-network failover classification boundary. I’ve now pushed a small signed-off maintainer fix at b5b4a9bf11f. It reuses the shared transient-network matcher for structured failover codes, retains only failover-specific codes locally, and adds a non-Undici Exact-head offline ClawSweeper and autoreview are clean; focused tests and the full changed-file gate pass. CI has been retriggered. |
Signed-off-by: sallyom <[email protected]>
|
Exact-head real transport proof is now in the PR body: a real Undici loopback headers timeout emitted @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merge-ready at HEAD
Proceeding with merge. |
|
Merged via squash.
|
* fix(failover): classify transient Undici error codes * fix(failover): share transient network code policy Signed-off-by: sallyom <[email protected]> --------- Signed-off-by: sallyom <[email protected]> Co-authored-by: sallyom <[email protected]>
What Problem This Solves
Fixes an issue where agent runs could stop without retry or failover when a transient transport failure was preserved only as a structured error code and its message did not identify the network failure.
Why This Change Was Made
Assistant retry now forwards structured
errorCode/errorTypefields into the failover signal. Core failover classification reuses the existing shared transient-network matcher rather than maintaining a second Undici-only policy, while the three failover-specific codes remain local to failover.User Impact
Transient connection, DNS, socket, and response-timeout failures can now follow the normal retry and failover policy instead of ending the agent run. This adds no API, config, schema, migration, or default change.
Evidence
Exact-head real transport fault
Verified at
b5b4a9bf11fad122732171f695fd13a0caf120c3with a disposable, secretless loopback harness:request()POST was sent to a local TCP server that accepted the connection but withheld response headers (headersTimeout: 50).HeadersTimeoutErrorcarryingUND_ERR_HEADERS_TIMEOUT.failTransportStream; the harness did not construct or assign an assistanterrorCode.timeout, and outer assistant retry accepted it.The disposable proof script and server were removed after the run; no branch files or credentials were used.
Regression and review evidence
ENOTFOUNDreturned no failover classification on maintainer parent0934155784f2759210024fe8dfe7a830ae990f7f.node scripts/run-vitest.mjs src/agents/embedded-agent-helpers/assistant-message-failures.test.ts src/llm/utils/retry.test.ts— pass.src/infra/retryable-network-errors.ts; this PR now consumes that owner directly.AI-assisted: built with Codex