Repository navigation
fix(agents): prevent fallback after stale lifecycle abort - #117168
Conversation
95cb32b to
44509d7
Compare
44509d7 to
a056ebc
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 11:14 PM ET / August 1, 2026, 03:14 UTC. ClawSweeper reviewWhat this changesThe branch marks stale Gateway lifecycle aborts with a stable internal code so model fallback stops instead of silently trying another configured provider. Merge readinessNo blocking correctness finding. Current Priority: P1 Review scores
Verification
How this fits togetherAgent runs capture a Gateway lifecycle generation before executing a selected model. If the Gateway rotates, the lifecycle guard aborts stale work; the model-fallback runner classifies that error to decide whether to retry a fallback provider or surface the original failure. flowchart LR
A[Requested model run] --> B[Gateway lifecycle guard]
B --> C{Generation current?}
C -->|No| D[Stale lifecycle abort]
D --> E[Failover error classification]
E --> F{Local coordination or provider failure?}
F -->|Local coordination| G[Surface requested-run failure]
F -->|Provider failure| H[Try configured fallback]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +46, Tests +52. Total +98 across 5 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the producer-owned error identity and shared fallback classification after an agent-runtime owner confirms the intended stale-lifecycle-versus-provider-failure precedence on the current head; the linked report can then close through the merged PR. Do we have a high-confidence way to reproduce the issue? Yes. Current main throws the stale lifecycle as an ordinary Is this the best way to solve the issue? Yes. Giving the lifecycle owner a closed error identity and recognizing it in the shared fallback classifier is narrower and more maintainable than adding provider-specific exceptions or message matching; the direct-provider-identity guard preserves the competing provider-failure contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a0fe02a6dcf3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer disposition for the remaining optional ClawSweeper rank-up move: landing is explicitly approved in this maintenance run. The reviewed boundary is the direct-provider-identity guard: explicit provider metadata remains fallback-eligible, while a stale lifecycle error without that direct identity is terminal coordination. This is covered by the direct/wrapped classifier tests, the Ollama-primary single-attempt fallback test, exact-head CI, and two clean autoreview passes. No broader routing change is included. |
* origin/main: fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110) refactor(i18n): remove unused Apple contradiction report (openclaw#117182) fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167) perf: count large histories before Gateway prewarm (openclaw#117118) fix(signal): restore provider-safe original attachment filenames (openclaw#115107) refactor(channels): unify setup ownership across bundled channels (openclaw#117188) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949) fix(gateway): yield before post-ready background work (openclaw#117083) test(google): cover live transcript overflow fix(google): bound live transcript accumulation
* commit '6938f7dddb63bad59862c014c427d63f0a41a6f4': (368 commits) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949) fix(gateway): yield before post-ready background work (openclaw#117083) fix(ui): keep canvas lease renewals lifecycle-owned and timer-safe (openclaw#117173) fix(teams): restore the official square product icon (openclaw#117170) refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) ...
* commit '441d6ab254df14fb6939a8a261f474904ff9c500': (388 commits) fix(qqbot): ignore blank app id fallbacks (openclaw#109460) fix(feishu): consume implicit reply targets across media delivery (openclaw#117196) fix(exec): preserve approved command output when sessions resume (openclaw#117177) fix(qa): use public subagent fanout evidence (openclaw#116832) fix(googlechat): cancel unread auth response bodies before release (openclaw#115873) fix(queue): prevent cron saturation from starving hook dispatch (openclaw#116666) fix(gateway): sessions.steer retry no longer interrupts an active run when replaying a cached idempotency key (openclaw#116969) fix(irc): config validation rejects documented channels.irc.configWrites key (openclaw#112392) fix(mistral): keep terminal error branch lint-clean fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110) refactor(i18n): remove unused Apple contradiction report (openclaw#117182) fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167) perf: count large histories before Gateway prewarm (openclaw#117118) fix(signal): restore provider-safe original attachment filenames (openclaw#115107) refactor(channels): unify setup ownership across bundled channels (openclaw#117188) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) ...
* commit '55215cd9edd2b585cbaee5481d5352aabf7e4399': (368 commits) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949) fix(gateway): yield before post-ready background work (openclaw#117083) fix(ui): keep canvas lease renewals lifecycle-owned and timer-safe (openclaw#117173) fix(teams): restore the official square product icon (openclaw#117170) refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) ...
* origin/main: fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110) refactor(i18n): remove unused Apple contradiction report (openclaw#117182) fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167) perf: count large histories before Gateway prewarm (openclaw#117118) fix(signal): restore provider-safe original attachment filenames (openclaw#115107) refactor(channels): unify setup ownership across bundled channels (openclaw#117188) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949) fix(gateway): yield before post-ready background work (openclaw#117083) test(google): cover live transcript overflow fix(google): bound live transcript accumulation
* commit 'ae4e662145b6aa162777cdb1c011b3f04ddd230d': (388 commits) fix(qqbot): ignore blank app id fallbacks (openclaw#109460) fix(feishu): consume implicit reply targets across media delivery (openclaw#117196) fix(exec): preserve approved command output when sessions resume (openclaw#117177) fix(qa): use public subagent fanout evidence (openclaw#116832) fix(googlechat): cancel unread auth response bodies before release (openclaw#115873) fix(queue): prevent cron saturation from starving hook dispatch (openclaw#116666) fix(gateway): sessions.steer retry no longer interrupts an active run when replaying a cached idempotency key (openclaw#116969) fix(irc): config validation rejects documented channels.irc.configWrites key (openclaw#112392) fix(mistral): keep terminal error branch lint-clean fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110) refactor(i18n): remove unused Apple contradiction report (openclaw#117182) fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167) perf: count large histories before Gateway prewarm (openclaw#117118) fix(signal): restore provider-safe original attachment filenames (openclaw#115107) refactor(channels): unify setup ownership across bundled channels (openclaw#117188) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) ...
Closes #116418
What Problem This Solves
Fixes an issue where users selecting an Ollama or other primary model could be silently routed to a configured fallback when the primary attempt was aborted because it belonged to a stale Gateway lifecycle.
Why This Change Was Made
Stale lifecycle ownership is a local coordination failure, not a provider failure. This change gives that abort a stable internal identity and stops model fallback before another provider is invoked, including when a generic timeout-shaped
AbortErrorwraps the lifecycle error. Explicit provider failure metadata remains authoritative.User Impact
Gateway lifecycle failures now surface on the requested run instead of silently invoking a cloud fallback. This preserves the user's provider choice and avoids unexpected remote usage or charges.
Thanks @Myer66 for the corrected lifecycle trace and reproducible routing evidence.
Evidence
node scripts/run-vitest.mjs src/agents/failover-error.test.ts— 106 passednode scripts/run-vitest.mjs src/agents/model-fallback.test.ts— 138 passedprovider=ollama,api=ollama,endpoint=local, modelllama3.2:3b; the small model later made an unrelated invalidsessions_yieldcall.git diff --checkchecks passed.tsgoalso encounters the unchangedpackages/terminal-core/src/ansi.tsTS2554 baseline failure; the linked sparse install cannot resolve@openclaw/session-url-contract/parse. Exact-head CI remains the authoritative broad gate.AI-assisted implementation; the maintainer reviewed the code path, tests, and live proof.