Skip to content

fix(agents): classify 'upstream request failed' as server_error for failover#95521

Closed
wings1029 wants to merge 1 commit into
openclaw:mainfrom
wings1029:fix/issue-95519-upstream-error-fallback
Closed

fix(agents): classify 'upstream request failed' as server_error for failover#95521
wings1029 wants to merge 1 commit into
openclaw:mainfrom
wings1029:fix/issue-95519-upstream-error-fallback

Conversation

@wings1029

Copy link
Copy Markdown
Contributor

Summary

Provider errors with message Upstream request failed (error type upstream_error) were not matched by the existing upstream error or upstream connect error patterns, causing them to fall through to unclassified and preventing model fallback from triggering.

Add upstream request failed to the server error message patterns.

Fixes #95519.

Change

failover-matches.ts: add "upstream request failed" to the serverError pattern list alongside existing "upstream error" and "upstream connect error" entries.

Tests and validation

Suite Result
failover-matches.test.ts ✅ 23/23 passed

Risk

  • Minimal: one-line addition to an existing pattern list
  • The pattern is specific enough to avoid false positives
  • All existing server error classification behavior is unchanged

🤖 Generated with Claude Code

…ailover

Provider errors with message 'Upstream request failed' (error type
upstream_error) were not matched by the existing 'upstream error'
or 'upstream connect error' patterns, causing them to fall through
to unclassified and preventing model fallback from triggering.

Add 'upstream request failed' to the server error message patterns
so the failover engine correctly classifies it as a transient
server error and advances to the next configured fallback model.

Fixes openclaw#95519

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 21, 2026
@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close: this one-line matcher is superseded by #95542, which is open, mergeable, proof-sufficient, and covers both structured upstream_error normalization and the embedded result-payload fallback boundary that this PR still misses.

Canonical path: Close this partial branch and let maintainers review or land #95542 as the canonical fix for the upstream_error fallback cluster.

So I’m closing this here and keeping the remaining discussion on #95542.

Review details

Best possible solution:

Close this partial branch and let maintainers review or land #95542 as the canonical fix for the upstream_error fallback cluster.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: current main joins embedded error payload text, filters it through an auth/auth_permanent/billing-only helper, and treats a null result classification as a completed candidate rather than fallback-worthy failure.

Is this the best way to solve the issue?

No. The matcher addition is useful but too narrow; the best fix must also classify the embedded provider payload boundary, which #95542 does with focused tests and proof.

Security review:

Security review cleared: The diff only adds one internal matcher string and does not touch dependencies, workflows, secrets, package metadata, or code execution surfaces.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • vincentkoc: Local blame points the central classifier and fallback-loop regions to Vincent Koc in this checkout, and recent live history shows adjacent model fallback work with this person as co-author. (role: current line-history contributor; confidence: medium; commits: 9fd9aa5fcdd2; files: src/agents/embedded-agent-runner/result-fallback-classifier.ts, src/agents/model-fallback.ts)
  • steipete: Live commit history shows recent result-fallback classifier, model-fallback, and model-failover documentation work defining this fallback boundary. (role: recent fallback area contributor; confidence: high; commits: 0314819f918a, 6719528316c0, 4b0f16d496e5; files: src/agents/embedded-agent-runner/result-fallback-classifier.ts, src/agents/model-fallback.ts, docs/concepts/model-failover.md)
  • fuller-stack-dev: Live history shows recent work passing provider status/code/type descriptors through the same failover classification surface. (role: structured provider-signal contributor; confidence: medium; commits: 89975eea24a5, 0314819f918a; files: src/agents/embedded-agent-helpers/errors.ts, src/agents/embedded-agent-helpers/errors-provider-structured-signals.test.ts)
  • takhoffman: The earlier embedded provider business-denial fallback classifier change lists this person in the approval/co-author metadata, making them relevant to this classifier boundary. (role: adjacent reviewer; confidence: medium; commits: 18f94fc83a72; files: src/agents/embedded-agent-runner/result-fallback-classifier.ts)

Codex review notes: model internal, reasoning high; reviewed against c6386178973d.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 21, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label Jun 21, 2026
@NianJiuZst

Copy link
Copy Markdown
Contributor

Complementary observations on top of ClawSweeper's review:

This PR adds the single string "upstream request failed" to failover-matches.ts's ERROR_PATTERNS.upstream_error. It is the narrowest fix in the #95519 cluster.

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fallback should trigger on provider upstream_error / LLM request failed

2 participants