Skip to content

fix(agents): fallback after replay-safe silent errors - #117356

Merged
vincentkoc merged 4 commits into
mainfrom
fix/assistant-silent-fallback-after-retries
Aug 2, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
fix/assistant-silent-fallback-after-retries

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Closes #112226.

Source PR: #117208

This maintainer replacement preserves wenrizc's authored source commit. The source fork branch was repeatedly force-rebased after exact-head maintainer proof, including after an explicit coordination request, so it could not remain frozen long enough to land safely.

What Problem This Solves

A provider can return a terminal assistant error with no visible output while leaving the payload unclassified, as in the reported credentials-file ENOENT. The embedded runner retries the same model three times, then currently returns the invisible error result instead of consulting configured model fallbacks.

Why This Change Was Made

After the existing three bounded same-model retries, an unclassified replay-safe silent failure selects the canonical fallback_model decision with reason unknown.

The repair stays in the assistant terminal-failure owner, does not infer authentication from filenames, does not mutate auth-profile state, and refuses fallback after replay-unsafe tool activity.

The release-owned changelog entry from the source branch was removed.

User Impact

Configured fallbacks can recover an otherwise silent failed turn after bounded same-model retries. Replay-unsafe attempts and auth-profile state retain their existing behavior.

Evidence

Exact head: 51c8ceb4d2c4c3e57704b58ee7657f5d93e7e088

Directly inspectable redacted proof:

fresh-pr checkout openclaw/openclaw#117356
running trusted crabbox-untrusted-bootstrap.sh at 51c8ceb4d2c4c3e57704b58ee7657f5d93e7e088
node-v24.15.0-linux-x64.tar.xz: OK
v24.15.0
11.15.1

CRABBOX_PHASE:assistant-failure-focused
Test Files  1 passed (1)
Tests       3 passed (3)

CRABBOX_PHASE:silent-error-retry-suite
Test Files  1 passed (1)
Tests       26 passed (26)

CRABBOX_PHASE:changed-gate
format changed files: ok
plugin boundaries: ok
dead export scan: ok
typecheck core: ok
typecheck core tests: ok
lint core changed files: 0 warnings, 0 errors
database-first legacy-store guard: ok
runtime import cycles: 0
all remaining changed gates: ok

command complete in 10m56s
exit=0

Production delta: +33/-20 lines (+13 net). Test delta: +202 lines.

@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 1, 2026 11:17
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 11:29 AM ET / 15:29 UTC.

ClawSweeper review

What this changes

The PR lets an embedded agent try configured model fallbacks after three replay-safe assistant errors with no visible output, without classifying credential-file text as an auth-profile failure.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main still returns a non-fallback outcome after the bounded replay-safe silent-error retries, while this patch turns that exhausted, unclassified case into the existing configured-fallback flow. The proposed routing/cost tradeoff was explicitly accepted in the PR discussion, and no patch defect was found in the owner-boundary implementation.

Priority: P1
Reviewed head: 51c8ceb4d2c4c3e57704b58ee7657f5d93e7e088

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused exact-head behavior proof, regression coverage, and a narrow owner-boundary patch support normal maintainer merge review.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body includes a redacted exact-head Crabbox validation transcript showing focused terminal-owner tests, the existing silent-error retry suite, and the changed gate passing after the fix.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes a redacted exact-head Crabbox validation transcript showing focused terminal-owner tests, the existing silent-error retry suite, and the changed gate passing after the fix.
Evidence reviewed 7 items Current-main gap: The PR head is not an ancestor of current main, and the current-main-to-PR comparison contains the full 33 added/20 removed production-line change in the assistant failure owner plus the new regression test; current main therefore does not yet contain this repair.
Owner-boundary repair: The patch reuses the existing replay-safety predicate, preserves the three same-model retries, and only then selects the canonical fallback-model decision with reason unknown when a fallback is already configured; it bypasses auth-profile rotation for this unclassified case.
Replay-safety contract: The shared predicate rejects visible assistant text, terminal output, and current-attempt potential side effects before allowing a silent-error retry; the PR relies on that same predicate rather than adding a credential-file-specific exception.
Findings None None.
Security None None.

How this fits together

The embedded-agent runner receives a terminal assistant result, decides whether retrying is safe, and then either surfaces the failure or asks the shared model-fallback runner to try the operator-configured alternatives. This change affects the handoff after the runner's bounded same-model retry budget is exhausted.

flowchart TD
  A[Provider assistant result] --> B[Embedded agent terminal failure handler]
  B --> C{Visible output or side effects?}
  C -->|Yes| D[Preserve normal error path]
  C -->|No, replay-safe| E[Bounded same-model retries]
  E --> F{Retries exhausted and fallbacks configured?}
  F -->|Yes| G[Shared model fallback runner]
  F -->|No| D
  G --> H[Next configured provider and model]
Loading

Before merge

  • Resolve merge risk (P2) - Merging can route an exhausted replay-safe silent failure to an operator-configured fallback provider, changing provider choice and cost; the PR discussion explicitly accepts this opt-in behavior, but it remains the material merge-time compatibility consideration.
  • Complete next step (P2) - No mechanical repair remains: this protected maintainer PR has an explicit accepted routing tradeoff and sufficient exact-head proof, so it awaits normal maintainer merge review.
Agent review details

Security

None.

PR surface

Source +13, Tests +202. Total +215 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 33 20 +13
Tests 1 202 0 +202
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 235 20 +215

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Merge under the accepted opt-in routing tradeoff (recommended)
    Accept that only operators who already configured fallbacks may see the next provider/model selected after three replay-safe silent failures, in exchange for recovering a previously invisible terminal failure.

Technical review

Best possible solution:

Land this focused assistant-terminal-owner repair with the existing replay-safety guard and configured-fallback requirement intact, so silent failures recover without rotating or cooling down unrelated auth profiles.

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

Yes, from source with high confidence: current main retries a replay-safe silent assistant error but does not escalate the exhausted unclassified case to the configured fallback decision. The PR supplies exact-head focused regression proof, although this read-only review did not execute a live provider reproduction.

Is this the best way to solve the issue?

Yes. The repair stays at the assistant terminal-failure owner, carries forward the existing replay-safety fact, and uses the established fallback mechanism; classifying credential-file text as authentication would wrongly mutate healthy auth-profile state.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The patch addresses repeated user-visible agent turn failures when healthy configured fallback models exist.
  • merge-risk: 🚨 auth-provider: The exhausted-error path can select a different configured provider or model, affecting routing and cost for existing fallback-enabled setups.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes a redacted exact-head Crabbox validation transcript showing focused terminal-owner tests, the existing silent-error retry suite, and the changed gate passing after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a redacted exact-head Crabbox validation transcript showing focused terminal-owner tests, the existing silent-error retry suite, and the changed gate passing after the fix.

Evidence

What I checked:

  • Current-main gap: The PR head is not an ancestor of current main, and the current-main-to-PR comparison contains the full 33 added/20 removed production-line change in the assistant failure owner plus the new regression test; current main therefore does not yet contain this repair. (src/agents/embedded-agent-runner/run/assistant-failure.ts:151, 7bcbe743bd42)
  • Owner-boundary repair: The patch reuses the existing replay-safety predicate, preserves the three same-model retries, and only then selects the canonical fallback-model decision with reason unknown when a fallback is already configured; it bypasses auth-profile rotation for this unclassified case. (src/agents/embedded-agent-runner/run/assistant-failure.ts:151, b40d7f70e3f2)
  • Replay-safety contract: The shared predicate rejects visible assistant text, terminal output, and current-attempt potential side effects before allowing a silent-error retry; the PR relies on that same predicate rather than adding a credential-file-specific exception. (src/agents/embedded-agent-runner/run/incomplete-turn.ts:540, 7bcbe743bd42)
  • Fallback and skip-cache contract: The shared fallback runner continues to remaining configured candidates for recognized failover errors, while only auth and permanent-auth failures from non-primary candidates enter the session skip cache; the new unknown route therefore does not poison auth state. (src/agents/model-fallback-runner.ts:581, 7bcbe743bd42)
  • Regression coverage: The added focused tests assert fallback after exhausted replay-safe credential-file failure, no fallback after replay-unsafe tool activity, and no cross-turn auth skip-cache entry for the fallback candidate. (src/agents/embedded-agent-runner/run/assistant-failure.test.ts:106, ee454f348309)
  • History and release check: The repair commit is b40d7f70e3f2b05bf22fcc3438baa0578a69f276 (August 1, 2026), and neither that commit nor the PR head is in release v2026.7.1; this is open work rather than an already-shipped fix. Current-main blame for the neighboring retry path points to Peter Steinberger's recent maintenance commit. (src/agents/embedded-agent-runner/run/assistant-failure.ts:144, b40d7f70e3f2)

Likely related people:

  • steipete: Current-main blame across the adjacent silent-error retry decision points attributes the path to a recent Peter Steinberger maintenance commit. (role: recent current-main area contributor; confidence: medium; commits: d585c0c1ec49; files: src/agents/embedded-agent-runner/run/assistant-failure.ts)
  • vincentkoc: The PR discussion records Vincent Koc's explicit acceptance of the opt-in fallback routing and cost tradeoff, in addition to the repair commits on this replacement branch. (role: accepted routing-tradeoff owner; confidence: high; commits: b40d7f70e3f2, ee454f348309, 51c8ceb4d2c4; files: src/agents/embedded-agent-runner/run/assistant-failure.ts, src/agents/embedded-agent-runner/run/assistant-failure.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-01T11:21:31.276Z sha 51c8ceb :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T15:07:04.441Z sha 51c8ceb :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer decision: accepted. After the existing three bounded same-model retries, a replay-safe unclassified silent failure may use an operator-configured fallback model. That can change provider routing and cost, but it is preferable to returning an invisible terminal failure; the route remains opt-in through configured fallbacks, does not run after current-attempt side effects, and does not mutate auth-profile state. Proceed once exact-head required CI is green.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 1, 2026
@vincentkoc
vincentkoc merged commit 6c2aa34 into main Aug 2, 2026
266 of 277 checks passed
@vincentkoc
vincentkoc deleted the fix/assistant-silent-fallback-after-retries branch August 2, 2026 07:10
vincentkoc added a commit to yetval/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (99 commits)
  test: consolidate agent tool suites (openclaw#117886)
  fix: remove duplicate plugin CLI registry mock (openclaw#117894)
  fix(gateway): resume shared terminal after slow viewer leaves (openclaw#117847)
  refactor(gateway): remove deferred channel load flag; 503 plugin routes until runtime ready (openclaw#117852)
  test(agents): consolidate OpenClaw tool suites (openclaw#117870)
  fix(ci): repair release validation regressions (openclaw#117723)
  fix(media): reject empty generated assets (openclaw#117875)
  fix: release channel delivery resources reliably (openclaw#117855)
  refactor(cli): unify config-guard policy across dispatch paths (openclaw#117880)
  test: consolidate WhatsApp monitor suites (openclaw#117854)
  fix(heartbeat): retain configured account for accountless commitments (openclaw#117521)
  fix(agents): cap DeepSeek DSML recovery buffer at 256 KB (openclaw#117175)
  [AI] fix(line): downgrade row-overflow tables to ordered bullet text (openclaw#117481)
  fix(agents): fallback after replay-safe silent errors (openclaw#117356)
  fix(telegram): serialize approval ingress sessions (openclaw#117861)
  fix(agents): report truthful embedded startup stages (openclaw#117879)
  test(sqlite): align flip-proof request budgets (openclaw#117878)
  fix(ui): advance gateway-owned channel setup progress (openclaw#117877)
  fix(media): preserve canonical attachment facts across every agent owner (openclaw#117841)
  test(protocol): consolidate validation fixtures (openclaw#117873)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 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 maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Credentials-file ENOENT classifies as 'unclassified' — model fallback chain never consulted, all turns die

2 participants