Skip to content

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

Closed
wenrizc wants to merge 7 commits into
openclaw:mainfrom
wenrizc:fix/credentials-enoent-failover-112226
Closed

wenrizc wants to merge 7 commits into
openclaw:mainfrom
wenrizc:fix/credentials-enoent-failover-112226

Conversation

@wenrizc

@wenrizc wenrizc commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #112226.

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 retried the same model three times, then returned the invisible error result instead of consulting configured model fallbacks.

Root Cause

The assistant terminal owner already knew the failed turn was replay-safe: no visible output and no replay-unsafe tool effects. That fact was used for bounded same-model retries, but discarded when the retry budget was exhausted.

Classifying credential filenames as authentication failures was not safe. It could rotate or cool down healthy auth profiles for unrelated local file errors.

Why This Change Was Made

After the existing bounded same-model retries, an unclassified replay-safe silent failure now selects the canonical fallback_model decision with reason unknown when fallback is configured.

The repair deliberately:

  • stays in the assistant terminal-failure owner
  • does not infer auth from filenames or error text
  • does not rotate, mark, or cool down auth profiles
  • does not enter model fallback after visible output or replay-unsafe tool activity
  • does not add unknown failures to the cross-turn auth skip cache

This branch also includes CI follow-up hardening for the TUI PTY Vitest config: the no-output watchdog is extended for the known long-running PTY e2e shard, which was being killed on loaded GitHub runners despite passing locally.

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

Current head: 393851ebfec

  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/assistant-failure.test.ts src/agents/model-fallback.run-embedded.e2e.test.ts -t "credential-file|keeps tool summary"
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/scripts/sqlite-sessions-transcripts-flip-proof.e2e.test.ts
  • node scripts/run-vitest.mjs test/scripts/ci-node-test-plan.test.ts test/scripts/ci-run-node-test-shard.test.ts
  • node scripts/run-vitest.mjs test/scripts/run-vitest.test.ts
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts
  • git diff --check

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 1, 2026
@wenrizc
wenrizc marked this pull request as ready for review August 1, 2026 04:36
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@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. 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

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Close as implemented on current main: the embedded-runner terminal path now marks replay-safe incomplete turns as eligible for model fallback, preserving delivery and side-effect checks that the source PR was trying to address.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the current-main terminal-result classification and shared model-fallback flow; do not merge a parallel assistant-stage fallback path from this branch.

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

Yes, from current source: a replay-safe incomplete terminal result is explicitly marked fallback-safe and passed into the shared fallback classifier; focused tests cover the safe and unsafe retry distinctions.

Is this the best way to solve the issue?

Yes—the current-main terminal-result path is the safer owner boundary because it carries complete replay, delivery, and side-effect facts into the fallback decision; this source branch is no longer the best landing vehicle.

Security review:

Security review cleared: The reviewed behavior is now implemented on main through existing agent lifecycle and fallback code; no concrete security or supply-chain regression requires action on this obsolete branch.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current-main terminal owner: Current main turns an incomplete terminal response into an error result only after checking that it is not interrupted, not a prompt error, has no terminal/tool state, and has no potential side effects; it records that outcome as fallback-safe for the shared fallback layer. (src/agents/embedded-agent-runner/run/terminal-resolution.ts:302, a84302cd73aa)
  • Shared fallback integration: The embedded-run entrypoint supplies terminal-result classifications to runWithModelFallback, while the fallback runner retries classified results and preserves the preferred user-visible error if all candidates fail. (src/agents/embedded-agent-runner/run-entry.ts:240, a84302cd73aa)
  • Existing safety coverage: Current tests distinguish replay-safe thinking-only errors from output-bearing and side-effecting attempts, preserving the boundary that permits only safe retry/fallback behavior. (src/agents/embedded-agent-runner/run.incomplete-turn.test.ts:4011, a84302cd73aa)
  • Fix provenance: The current-main lifecycle implementation was last materially updated by the agent/inference fix commit, which is contained by main and touches the terminal-resolution path that supplies fallback-safe incomplete-turn results. (src/agents/embedded-agent-runner/run/terminal-resolution.ts:292, b721cffa4461)
  • Release check: The latest known release commit is dated July 13, 2026, while the proof commit is dated August 1, 2026; the release is not an ancestor of the proof commit and main contains it, so this is current-main-only provenance. (b721cffa4461)

Likely related people:

  • steipete: Peter Steinberger authored the current-main commits that consolidated the embedded-agent terminal lifecycle and maintain the fallback-safe result boundary. (role: feature owner; confidence: high; commits: b721cffa4461, 475ea69f2c35; files: src/agents/embedded-agent-runner/run/terminal-resolution.ts, src/agents/embedded-agent-runner/run/assistant-failure.ts, src/agents/embedded-agent-runner/result-fallback-classifier.ts)
  • vincentkoc: Vincent Koc coordinated the maintainer replacement at fix(agents): fallback after replay-safe silent errors #117356 and authored related agent-runner history. (role: recent area contributor; confidence: medium; commits: 51c8ceb4d2c4; files: src/agents/embedded-agent-runner/run/assistant-failure.ts)

Codex review notes: model internal, reasoning high; reviewed against a84302cd73aa; fix evidence: commit b721cffa4461, main fix timestamp 2026-08-01T02:05:45-07:00.

@wenrizc
wenrizc force-pushed the fix/credentials-enoent-failover-112226 branch from 6f47b64 to 31e66d6 Compare August 1, 2026 06:20
@wenrizc

wenrizc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The overbroad ENOENT matcher finding has been fixed and the focused negative regression test has been added. CI is green on head 31e66d6.

@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:

@wenrizc

wenrizc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Added after-fix runtime proof to the PR body under "After-Fix Runtime Proof". It covers the production assistant failover classification + run-decision path and the negative unrelated-ENOENT case.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 1, 2026
@wenrizc
wenrizc force-pushed the fix/credentials-enoent-failover-112226 branch from 31e66d6 to b9f12f7 Compare August 1, 2026 07:14
@wenrizc

wenrizc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated head b9f12f7 narrows the ENOENT matcher to hidden credential/token basenames, adds negative coverage for workspace tokens.json and credentials/cache.json, and updates the PR body with the b9f12f7 runtime proof.

@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:

@vincentkoc
vincentkoc force-pushed the fix/credentials-enoent-failover-112226 branch from b9f12f7 to 9ccf59e Compare August 1, 2026 09:22
@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@vincentkoc vincentkoc changed the title fix: classify missing credentials files for failover fix(agents): fallback after replay-safe silent errors Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the fix/credentials-enoent-failover-112226 branch from 9ccf59e to d6cdc5b Compare August 1, 2026 09:57
@openclaw-barnacle openclaw-barnacle Bot added triage: blank-template Candidate: PR template appears mostly untouched. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 1, 2026
@wenrizc
wenrizc force-pushed the fix/credentials-enoent-failover-112226 branch from d6cdc5b to aa03af2 Compare August 1, 2026 10:06
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member

Maintainer repair restored exact head d6cdc5bd2f38d57a50ad79c053d93fe0934822b0. The follow-up aa03af25 changed the discarded full-runner E2E while also rewinding the branch behind current main and removing the focused owner-boundary proof. That E2E takes roughly five minutes per case in this harness and previously contaminated later cases after timeout. It has been replaced by exact terminal-owner and outer-fallback composition coverage, now green in sanitized AWS. Please avoid further branch pushes while exact-head CI and ClawSweeper finish.

@vincentkoc

Copy link
Copy Markdown
Member

@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:

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 1, 2026
@wenrizc
wenrizc force-pushed the fix/credentials-enoent-failover-112226 branch from 0e7925a to a44b95f Compare August 1, 2026 10:31
@vincentkoc

Copy link
Copy Markdown
Member

@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:

@vincentkoc

Copy link
Copy Markdown
Member

Maintainer replacement opened at #117356. It preserves wenrizc’s authored commit and the reviewed repair, but moves the landing branch into the main repository because repeated fork force-rebases invalidated two exact-head sanitized AWS proof runs after maintainer coordination. This source PR remains open until the replacement clears exact-head CI and lands; no source work or credit is being discarded.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 1, 2026
@wenrizc

wenrizc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor 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 merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closeout update: the maintainer replacement #117356 has now landed on main as 6c2aa3464fa69110d801b6842e7bac3ebdeced05, with wenrizc preserved as co-author. This source PR remains closed as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: blank-template Candidate: PR template appears mostly untouched.

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