Repository navigation
fix: show model fallback and recovery in chat history - #169773
Conversation
Keep recoverable diagnostic failures out of live chat while their exact run is active. Persist fallback attempts and successful return-to-selected events as transcript dividers without changing model selection or provider replay. Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: f3a44376-333d-4ffc-80b6-0d428c2ee924
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
The wrapper extraction imports transcript-only assistant classification, which now depends on the fallback notice marker. Include its source so the isolated wrapper retains a complete runtime import closure. Co-authored-by: steipete <[email protected]>
Keep provider credential discovery and global harness/plugin activation outside the transcript boundary test. Document each intentionally isolated mock; production fallback and canonical persistence remain real. Co-authored-by: steipete <[email protected]>
|
Codex review: blocked before merge. What this changesThis PR hides recoverable errors during active runs and adds persistent model-fallback and successful-return dividers to chat history. Example: A turn falls back from openai/primary-large to openai/backup-large, and a later turn succeeds on the selected model.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this collaborator-authored PR addresses a concrete chat-history problem, but the previously reported skipped-candidate recording defect remains unresolved. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe shared agent runner supplies fallback observations, the transcript writer persists notices, and Gateway history projection feeds Control UI dividers while replay filtering excludes notices from provider input. flowchart LR
A[User turn] --> B[Shared agent runner]
B --> C[Model candidates]
B --> D[Session transcript writer]
D --> E[Gateway history projection]
E --> F[Control UI dividers]
D --> G[Provider replay filter]
Technical reviewBest possible solution: Persist transitions when the destination actually executes through the shared runner, preserving canonical transcript writes, replay exclusion, and exact-run recovery projection. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the overflow-copy and hidden-continuation paths illustrated by the supplied before screenshot; the skipped-candidate defect is traceable through the real fallback loop without executing target code. Is this the best way to solve the issue? The existing production owners fit the problem, but a fallback decision observation cannot establish that its destination model executed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e871b5ea32da. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +412, Tests +920, Docs +2, Other +1. Total +1335 across 37 files. Added test files: 4. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 12, 2026, 5:48 PM ET / 21:48 UTC (Revision 4). |
Reuse the already-landed fixture correction from e78a4d8. Only same-origin beta avatar requests consume the avatar response sequence; an independent asset regression preserves exact URL, credential, request-count and blob assertions. The original hosted extra requests were not logged, so this does not claim their historical cause is proven. Co-authored-by: jacobtomlinson <[email protected]> Co-authored-by: steipete <[email protected]>
Integrate mainline f10cc08 for the named asynchronous-admission CI failures. Prepare and retire fixture configuration and profile catalogs through their real owners, and bind collector observation to the test-owned lifetime. Preserve all production guards and existing assertions. Co-authored-by: steipete <[email protected]>
Resolve the named merge conflict with main 8f4cf41. Reuse main's effective-options configuration setup for message-tool fixtures and retain one prepared per-test configuration for explicit queue recorder targets. Recovery production behavior is unchanged; 22 affected tests and the two affected test type graphs pass. Co-authored-by: steipete <[email protected]>
|
Merged via squash.
|
Two tests still encode contracts that changed on main. The resident profile authority path added by #170228 consumes aliases and display facts that the personal-file mock does not provide; seven cases fail before exercising their intended behavior. The fallback notice added by #169773 is a stopped assistant message, so the cron test incorrectly counts the notice as a second answer. Complete the personal-file mock using the existing `UserProfileIdentity` and `UserProfileDisplay` types. In the cron test, assert one primary-to-backup timeout notice through `readModelFallbackNotice`, then count successful assistant answers separately. Preserve the original requester, revocation, filesystem, one-user-turn, provider-order, and successful-result assertions. Production code and authority checks are unchanged. Cached failure evidence: - Personal-file mock: [Bun job 115027766429](https://github.com/openclaw/openclaw/actions/runs/38313840692/job/115027766429), `profile.aliases` spread failure. - Cron transcript: scheduled-main [run 38317311743, job 115037168335](https://github.com/openclaw/openclaw/actions/runs/38317311743/job/115037168335), expected one stopped assistant message, received two. The same signature appeared in prior candidate CI. Source and history were checked against main `395ea60dea893feb48782c0ac5fd4fc5a148a42a`. The profile failure is a prior candidate observation; the cron failure is reproduced by the cited scheduled-main run. Changed-file formatting, basic lint, and whitespace checks passed. One isolated Codex review completed scoped-clean with no actionable P0–P2 findings; both changed tests passed in PR CI [38318717235](https://github.com/openclaw/openclaw/actions/runs/38318717235), testing merge `634ae26bddea49d922f784c57805b11db5159773` (candidate `d171a04362e17b99fae68e59f1e593f2b173edf2` into base `f307d643`). The run finished green: 20 successful and 29 skipped jobs. Selected lint, test types, baseline ratchets, source contracts, boundaries, guards, and the CI gate passed: ```sh pnpm test src/gateway/server-methods/users-personal-file.test.ts --maxWorkers=1 pnpm test src/cron/isolated-agent/run.fallback-transcript.test.ts --maxWorkers=1 ``` Test-only change: two files, +31/−3. One commit per root cause. CI executed all 42 personal-file cases (26.40s Vitest, 28.34s wrapper) and the cron fallback case (15.580s case, 29.67s Vitest, 31.20s wrapper). No local runtime timing is claimed. Standalone Knip and Madge jobs were not selected for this test-only PR; no fresh whole-tree graph pass is claimed. The bounded source disposition reuses the prior clean topology and unaffected production/export scans: these two test leaves add no exports or production edges. The only value import added is the existing leaf `readModelFallbackNotice`, whose sole dependency is the existing normalization-core record coercer. Other added imports are erased types from an already-imported module. The historical full-tree unused-file findings concern the unrelated executable roots repaired separately in #170347. Before landing, source checks against main `81ad3bf71935d80c60a8b4a34492e51630d883c3` found no changes to either repaired test or the imported fallback-notice helper. No SDK, schema, update, Doctor, plugin-loading or service-lifecycle change; no SQL/T1 performance claim. Direct-main publication previously hit repository protection, so this emergency repair uses the authorized exact-head PR squash fallback.
* fix: show model fallback and recovery in chat history Keep recoverable diagnostic failures out of live chat while their exact run is active. Persist fallback attempts and successful return-to-selected events as transcript dividers without changing model selection or provider replay. Co-authored-by: steipete <[email protected]> * fix: show model fallback and recovery in chat history Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: f3a44376-333d-4ffc-80b6-0d428c2ee924 * fix: include fallback notice in trusted wrapper sources The wrapper extraction imports transcript-only assistant classification, which now depends on the fallback notice marker. Include its source so the isolated wrapper retains a complete runtime import closure. Co-authored-by: steipete <[email protected]> * test: explain fallback transcript fixture isolation Keep provider credential discovery and global harness/plugin activation outside the transcript boundary test. Document each intentionally isolated mock; production fallback and canonical persistence remain real. Co-authored-by: steipete <[email protected]> * test: isolate settings avatar fetch assertions Reuse the already-landed fixture correction from e78a4d8. Only same-origin beta avatar requests consume the avatar response sequence; an independent asset regression preserves exact URL, credential, request-count and blob assertions. The original hosted extra requests were not logged, so this does not claim their historical cause is proven. Co-authored-by: jacobtomlinson <[email protected]> Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
…law#170355) Two tests still encode contracts that changed on main. The resident profile authority path added by openclaw#170228 consumes aliases and display facts that the personal-file mock does not provide; seven cases fail before exercising their intended behavior. The fallback notice added by openclaw#169773 is a stopped assistant message, so the cron test incorrectly counts the notice as a second answer. Complete the personal-file mock using the existing `UserProfileIdentity` and `UserProfileDisplay` types. In the cron test, assert one primary-to-backup timeout notice through `readModelFallbackNotice`, then count successful assistant answers separately. Preserve the original requester, revocation, filesystem, one-user-turn, provider-order, and successful-result assertions. Production code and authority checks are unchanged. Cached failure evidence: - Personal-file mock: [Bun job 115027766429](https://github.com/openclaw/openclaw/actions/runs/38313840692/job/115027766429), `profile.aliases` spread failure. - Cron transcript: scheduled-main [run 38317311743, job 115037168335](https://github.com/openclaw/openclaw/actions/runs/38317311743/job/115037168335), expected one stopped assistant message, received two. The same signature appeared in prior candidate CI. Source and history were checked against main `3dd81bae92980aecaf0920bbad841c10486dea75`. The profile failure is a prior candidate observation; the cron failure is reproduced by the cited scheduled-main run. Changed-file formatting, basic lint, and whitespace checks passed. One isolated Codex review completed scoped-clean with no actionable P0–P2 findings; both changed tests passed in PR CI [38318717235](https://github.com/openclaw/openclaw/actions/runs/38318717235), testing merge `634ae26bddea49d922f784c57805b11db5159773` (candidate `d171a04362e17b99fae68e59f1e593f2b173edf2` into base `68ba0b0a`). The run finished green: 20 successful and 29 skipped jobs. Selected lint, test types, baseline ratchets, source contracts, boundaries, guards, and the CI gate passed: ```sh pnpm test src/gateway/server-methods/users-personal-file.test.ts --maxWorkers=1 pnpm test src/cron/isolated-agent/run.fallback-transcript.test.ts --maxWorkers=1 ``` Test-only change: two files, +31/−3. One commit per root cause. CI executed all 42 personal-file cases (26.40s Vitest, 28.34s wrapper) and the cron fallback case (15.580s case, 29.67s Vitest, 31.20s wrapper). No local runtime timing is claimed. Standalone Knip and Madge jobs were not selected for this test-only PR; no fresh whole-tree graph pass is claimed. The bounded source disposition reuses the prior clean topology and unaffected production/export scans: these two test leaves add no exports or production edges. The only value import added is the existing leaf `readModelFallbackNotice`, whose sole dependency is the existing normalization-core record coercer. Other added imports are erased types from an already-imported module. The historical full-tree unused-file findings concern the unrelated executable roots repaired separately in openclaw#170347. Before landing, source checks against main `53575ccd561ef562d46ff259fc47b7f4582dc7dc` found no changes to either repaired test or the imported fallback-notice helper. No SDK, schema, update, Doctor, plugin-loading or service-lifecycle change; no SQL/T1 performance claim. Direct-main publication previously hit repository protection, so this emergency repair uses the authorized exact-head PR squash fallback.
What Problem This Solves
Fixes chat displaying temporary overload or context-overflow failures as terminal errors while recovery continues, without a durable record of model switches.
User Impact
Users can see fallback attempts and successful returns to their selected model as centered transcript dividers that survive reload. The composer selection stays unchanged. Genuine terminal failures, partial answers, and media remain visible. No configuration or migration is required.
Why This Change Was Made
Defer diagnostic-only errors while their exact run is active, including the history invalidation that could otherwise reveal them. Recovered history remains a display projection; raw diagnostics are preserved. Hidden internal continuation prompts no longer break same-run recovery matching.
Record admitted fallback attempts through the existing transcript writer, and record restoration only after a successful response from the selected model. Notices are idempotent, source-bound, and excluded from provider replay. An attempted fallback is not presented as a successful recovery; pre-admission candidate skips do not create transcript events.
Evidence
Landed:
4944a6df77080f328fed59ee22384e3ee45d522f. Final exact-head CI and build passed on reviewed head51599a05e140126ec52434412d5445dbffce6921. Native guarded recovery verified the merge and completed branch/worktree cleanup.Final focused accounting, restoration, persistence, and divider run: 96 passed, 66.37 seconds wall time.
Restoration regression: the original accounting owner fails both ordinary/follow-up cases because no restoration event is written; the repaired owner passes. Failure, cancellation, replay, changed selection, and session/lifecycle/writer replacement are covered.
Overload/recovery validation: 64 passed, 53.55 seconds, with byte-identical production owners and integrated overload regression; baseline reproduces the leaked warning.
History pagination, raw transcript preservation, replay exclusion, and cron sibling regressions passed in the preceding focused validation.
Actual Control UI browser proof with a mocked Gateway and synthetic data: 1 passed, 36.40 seconds; fallback and return dividers survive reload. Inspected screenshots below show the recovered-error defect, the fallback event, and successful return.
The earlier feature build passed (181.3 seconds). After mainline integration, the local build timed out after 15 minutes in package declaration generation; no current local full-build pass is claimed. Final exact-head hosted build/CI passed, as linked above. Core/UI types, affected test types, lint, formatting, and structural ratchets pass.
Independent full-patch review found no actionable P0–P2 defects. A subsequent narrow type correction preserves stored fallback state without assigning an invalid optional-field union; all affected tests were rerun.
CI exposed a missing extraction-inventory entry for the new shared notice module. The exact inventory entry is now included; the failing wrapper import-closure suite passes 17/17, 32.28 seconds wall time. This correction changes packaging metadata only; runtime, browser, and build proof above remains applicable.
The mock-export ratchet also required per-mock isolation reasons for credential discovery and global harness/plugin fixtures. Those three explanations are now explicit; the full PR mock-export ratchet, config-doc baseline, and plugin inventory checks pass. This is test-comment-only, with no runtime or assertion changes.
An earlier CI correction reused the upstream avatar fixture isolation repair, retaining strict avatar URL, credential, request-count, and blob assertions while excluding unrelated fetches. All 4 avatar tests pass (7.03 seconds); canonical UI test types, focused lint/format, and independent P0–P2 review pass. The original hosted extra request URLs were not recorded, so this repairs the proven fixture-contract defect without claiming that historical cause. Product proof above remains unchanged.
Mainline asynchronous admission exposed missing preparation in test fixtures. The final candidate now prepares actual runtime configuration/profile catalogs and gives collector observation its fixture-owned lifetime. 108 affected fixture tests pass across focused runs; five recovery/history/divider files also pass (100.47 seconds). All assertions and production guards remain intact. Six affected test type graphs and a fresh full-patch P0–P2 review pass.
Browser proof does not use a live provider. Broad CI remains the PR gate.
Before
A recovered context-overflow error remains in the conversation.
After
Fallback and successful return use persistent transcript dividers. The model picker keeps the selected model.
While the fallback is working
Worked on by
Work sessions
Discussion, implementation and verification
Overload verification, CI correction and landing
View the OpenClaw team session