Repository navigation
fix(update): keep the failure that started recovery in failure reports - #198968
Conversation
After any update failure, the recovery steps that follow also fail (gateway migration recovery, package-backup-retention, gateway recovery verification). The failure-report sanitizer kept only the latest three failed steps and pruned oldest first, so the step that started recovery was always dropped, and users could not report what went wrong. Keep the first failed step alongside the latest two, and when the byte budget forces pruning, drop middle records before it. The latest failure still wins when only two remain. Refs #197083
|
🦞👀 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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves the first failed update step alongside recent recovery failures in bounded reports and triage context. Example: Database rollback fails, followed by failed gateway migration recovery, package-backup retention, and gateway recovery verification.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a demonstrated diagnostic-loss bug that remains on main, and no blocking correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update diagnostic sanitizer receives update results, redacts and bounds their contents, and supplies saved failure artifacts and repair-agent prompts. flowchart LR
A[Update execution] --> B[Recovery steps]
B --> C[Failure sanitizer]
C --> D[Saved failure artifact]
D --> E[Triage prompt]
C --> F[Doctor inventory]
Technical reviewBest possible solution: Keep retention policy in the existing sanitizer, preserving the initiating and terminal failures within the established diagnostic bounds. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically drops the first of four failed steps, matching the reporter's truncated artifact; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? The patch is a small repair at the existing shared owner, and its two regressions protect distinct selection and byte-budget failures without adding parallel machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d13336516b23. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests +65. Total +71 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel 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 Reviewed November 14, 2026, 10:37 AM ET / 15:37 UTC. |
The recovery triage prompt fixture has five failed steps. Failure reports now keep the first failed step with the latest two, so the oldest failure replaces the second-latest one in the expected prompt details. Refs #197083
Pruning removed the second record when the trigger came first, so a retained lint inventory record after the latest failure made the latest failure the one dropped. Protect the trigger and the latest failure by identity, drop other records first, and drop the trigger before the latest failure. Refs #197083
|
Merged via squash.
|
openclaw#198968) * fix(update): keep the failure that started recovery in failure reports After any update failure, the recovery steps that follow also fail (gateway migration recovery, package-backup-retention, gateway recovery verification). The failure-report sanitizer kept only the latest three failed steps and pruned oldest first, so the step that started recovery was always dropped, and users could not report what went wrong. Keep the first failed step alongside the latest two, and when the byte budget forces pruning, drop middle records before it. The latest failure still wins when only two remain. Refs openclaw#197083 * test(update): expect the triggering failure in recovery triage prompts The recovery triage prompt fixture has five failed steps. Failure reports now keep the first failed step with the latest two, so the oldest failure replaces the second-latest one in the expected prompt details. Refs openclaw#197083 * fix(update): protect the latest failure when pruning failure reports Pruning removed the second record when the trigger came first, so a retained lint inventory record after the latest failure made the latest failure the one dropped. Protect the trigger and the latest failure by identity, drop other records first, and drop the trigger before the latest failure. Refs openclaw#197083
#198968) * fix(update): keep the failure that started recovery in failure reports After any update failure, the recovery steps that follow also fail (gateway migration recovery, package-backup-retention, gateway recovery verification). The failure-report sanitizer kept only the latest three failed steps and pruned oldest first, so the step that started recovery was always dropped, and users could not report what went wrong. Keep the first failed step alongside the latest two, and when the byte budget forces pruning, drop middle records before it. The latest failure still wins when only two remain. Refs #197083 * test(update): expect the triggering failure in recovery triage prompts The recovery triage prompt fixture has five failed steps. Failure reports now keep the first failed step with the latest two, so the oldest failure replaces the second-latest one in the expected prompt details. Refs #197083 * fix(update): protect the latest failure when pruning failure reports Pruning removed the second record when the trigger came first, so a retained lint inventory record after the latest failure made the latest failure the one dropped. Protect the trigger and the latest failure by identity, drop other records first, and drop the trigger before the latest failure. Refs #197083 (cherry picked from commit 5df28e7) Backport review: source applies unchanged. #200322 is orthogonal SQLite diagnostic enrichment; #200742 repairs a separate lease owner. Both are outside this report-retention fix. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
#198968) Baseline adaptation: Keep the production selection and pruning change; port the regression to the .33 artifact fixture and align existing prompt assertions with the original failure. (cherry picked from commit 5df28e7) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 4be88a9a079c43ac37fa894e8b286086c5ec6acd)
Related: #197083
What Problem This Solves
Fixes: update failure reports drop the step that actually failed when the recovery steps that follow it also fail.
User Impact
User impact: when an update fails and its recovery also fails, the failure report and triage prompt now include the step that started the problem, so users can report it and maintainers can diagnose it. Reports written by already-installed updaters are unchanged; this applies once a release containing it drives the update.
Why This Change Was Made
After any post-install failure, the recovery steps that follow (for example
gateway migration recovery,package-backup-retention,gateway recovery verification) record their own failures. The report sanitizer kept only the latest three failed steps and pruned the oldest first under its byte budget, so the triggering failure was always the record removed. On #197083 the reporter's report shows exactly this: three recovery failures,omittedDetails: 2, and no trace of what started recovery.The sanitizer now keeps the first failed step alongside the latest two. When the byte budget forces pruning, it protects the first and latest failures by identity, removes other records first (including lint inventory records that follow the latest failure), and drops the first failure before the latest one when only those two remain.
Evidence
src/commands/triage-update.test.ts: a [Bug]: Post-install Doctor WAL publication verification leaves 11.3 update partially finalized #197083-shaped record keepsdatabase rollbackplus the two latest recovery failures; prompt-budget pruning keeps the trigger and the latest failure; artifact-budget pruning with a trailing lint record keeps both failures. The first two fail on base; the trailing-lint test fails on the first PR head and passes now. The existing bounded-evidence test and the recovery prompt test insrc/commands/triage-recovery.test.tsnow expect the first failure.1b3452f44ad).oxfmt --checkandoxlinton the changed files clean;pnpm tsgo:coreandpnpm tsgo:core:testpass; test-line ratchet OK (+107).1b3452f44ad. Independentcodex execreview: an earlier round found a P2 (a trailing lint record made pruning drop the latest failure), fixed in1b3452f44ad; the final round on1b3452f44adfound nothing.66bb77435c3):triage-recovery.test.tsfailed from this change (fixed above);pr-wrapper-source-closurehit a 120 s timeout in unrelated tooling; one shard hit the runner's daily sandbox-start quota.gateway migration recoveryruns only after a refused database rollback (state-migrated-no-rollback), so a triggering failure always precedes it.