Repository navigation
fix(failover): allow model_not_found to trigger fallback chain when configured (fixes #97564) - #97571
Conversation
…onfigured Remove model_not_found from the shouldEscalateRetryLimit exclusion list so that configured fallback models are attempted when the primary model is decommissioned by the provider. Previously, model_not_found was treated as terminal, silently defeating the fallback chain for the decommission case. Fixes openclaw#97564
|
Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 5:38 PM ET / 21:38 UTC. Summary PR surface: Source -4, Tests +27. Total +23 across 2 files. Reproducibility: yes. at source level: current Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one proof-positive, narrow policy/test change for the linked issue after maintainers accept that configured fallback chains should cover retry-limit Do we have a high-confidence way to reproduce the issue? Yes at source level: current Is this the best way to solve the issue? Yes as an implementation shape: changing the existing retry-limit predicate is the narrow owner-boundary fix because the outer fallback loop already owns candidate filtering and exhaustion behavior. Maintainers still need to accept the compatibility tradeoff before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a54919dcbc95. Label changesLabel justifications:
Evidence reviewedPR surface: Source -4, Tests +27. Total +23 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
…onfigured (openclaw#97571) Remove model_not_found from the shouldEscalateRetryLimit exclusion list so that configured fallback models are attempted when the primary model is decommissioned by the provider. Previously, model_not_found was treated as terminal, silently defeating the fallback chain for the decommission case. Fixes openclaw#97564
…onfigured (openclaw#97571) Remove model_not_found from the shouldEscalateRetryLimit exclusion list so that configured fallback models are attempted when the primary model is decommissioned by the provider. Previously, model_not_found was treated as terminal, silently defeating the fallback chain for the decommission case. Fixes openclaw#97564
…onfigured (openclaw#97571) Remove model_not_found from the shouldEscalateRetryLimit exclusion list so that configured fallback models are attempted when the primary model is decommissioned by the provider. Previously, model_not_found was treated as terminal, silently defeating the fallback chain for the decommission case. Fixes openclaw#97564 (cherry picked from commit f6115dd)
…onflicts) Merges 45 commits from origin/boon (boon.34 through boon.45, tag bump 06c4eff) into the 6.34 integration branch. 213 initial conflicts, ~206 were mechanical version-string conflicts (package.json / npm-shrinkwrap.json across root + bundled plugins, resolved to ours since this branch's purpose is advancing past the 2026.6.11-boon.N train). Non-trivial resolutions: - src/agents/embedded-agent-runner/run/failover-policy.ts: kept our side's non-exclusion of "model_not_found" in shouldEscalateRetryLimit (upstream openclaw#97571, already tested on this branch since the original 6.34 sync) while adopting boon's new "edge_blocked" exclusion. Blindly taking boon's side here would have silently reverted the upstream fix; caught via failover-policy.test.ts failing 1/44 before the correction. - src/config/sessions/session-accessor.ts: adopted boon's projectSessionEntryForPersistenceRevision call in createReplySessionInitializationRevision, replacing our own identity-field comparison workaround. Boon's own recent PR #205 reintroduced real use of this projection, so the workaround is no longer needed. - src/config/sessions/session-accessor.reply-init-concurrency.test.ts: kept our PID-suffixed temp-file naming in the child test script (avoids same-directory temp-path collisions across concurrent children); took boon's minor whitespace cleanup elsewhere. - extensions/matrix/CHANGELOG.md: kept our 3 newest entries on top, followed by boon's full chain. - scripts/plugin-sdk-surface-report.mjs: bumped publicExports budget 10406 -> 10410 and publicFunctionExports 5216 -> 5217 to match actual measured surface after the merge (publicEntrypoints already 324, unchanged). - docs/.generated/*.sha256: regenerated via `pnpm run plugin-sdk:api:gen` and `pnpm run config:docs:gen` against the merged tree. Also had to `git rm --cached` 6 underlying .json/.jsonl data files that origin/boon tracks but our .gitignore (unchanged by this merge) explicitly excludes (docs/.generated/*.json, docs/.generated/*.jsonl) -- git's merge machinery adds a file from either parent on a clean non-conflicting add regardless of the other side's gitignore rules. - pnpm-lock.yaml: merged clean with no conflict markers, but the auto-merge misplaced extensions/diagnostics-otel's @opentelemetry/* dependency block under the root "." importer instead of the extensions/diagnostics-otel importer. `pnpm install` (run as a side-effect of plugin-sdk:api:gen) correctly relocated it; confirmed root package.json has never declared these deps (neither current nor pre-merge HEAD) and extensions/diagnostics-otel/package.json declares exactly this set. Diff is a pure 33-line removal of the misplaced duplicate, kept. Verified: tsgo:core:test and tsgo:extensions:test clean; broad node scripts/run-vitest.mjs sweeps across all touched feature surfaces (embedded-agent-runner, config/sessions, cron, plugin-sdk, sentry-monitor, pdf-tool, media, subagents) all green. Co-Authored-By: Claude Sonnet 5 <[email protected]>
What Problem This Solves
When a configured primary model is decommissioned by the provider (returns
model_not_found), OpenClaw's failover policy treats this as a terminal error and never attempts the configured fallback chain. Users who set upmodel.fallbacksspecifically for resilience against model decommission silently lose that protection.Why This Change Was Made
The
shouldEscalateRetryLimitfunction infailover-policy.tsexplicitly excludedmodel_not_foundfrom failover escalation. This was defensible for typos (a misconfigured model should surface loudly), but it conflated two distinct cases:Since there's no reliable way to distinguish these at runtime, the fix removes the exclusion so
model_not_foundbehaves like other availability-class reasons: attempt fallback when configured, surface error when the chain is exhausted.User Impact
model.fallbackswill now correctly cascade to fallback models when the primary model returnsmodel_not_found.timeout,format,session_expired) are unaffected.Evidence
resolveRunFailoverDecisionwithfailoverReason: "model_not_found"andfallbackConfigured: truevia the production failover-policy modulemodel_not_foundwithfallbackConfigured: truereturns{ action: "fallback_model", reason: "model_not_found" }— fallback chain engages.Real behavior proof
resolveRunFailoverDecisionwithfailoverReason: "model_not_found"andfallbackConfigured: truevia the production failover-policy moduleObserved result after fix:
model_not_foundwithfallbackConfigured: truereturns{ action: "fallback_model", reason: "model_not_found" }— fallback chain engages. WithfallbackConfigured: false, returns{ action: "return_error_payload" }— error surfaces when no fallback available.What was not tested: Live provider interaction with a decommissioned model. The fix is validated through the production failover policy function used by the embedded agent runner.
AI-assisted (Hermes Agent)