Skip to content

fix(update): keep the failure that started recovery in failure reports - #198968

Merged
steipete merged 4 commits into
mainfrom
codex/d15-triage-trigger-step
Nov 14, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/d15-triage-trigger-step

Conversation

@steipete

@steipete steipete commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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

  • New tests in src/commands/triage-update.test.ts: a [Bug]: Post-install Doctor WAL publication verification leaves 11.3 update partially finalized #197083-shaped record keeps database rollback plus 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 in src/commands/triage-recovery.test.ts now expect the first failure.
  • All 13 test files that consume the failure sanitizer pass locally (run on head 1b3452f44ad).
  • oxfmt --check and oxlint on the changed files clean; pnpm tsgo:core and pnpm tsgo:core:test pass; test-line ratchet OK (+107).
  • autoreview (P2): scoped-clean on 1b3452f44ad. Independent codex exec review: an earlier round found a P2 (a trailing lint record made pruning drop the latest failure), fixed in 1b3452f44ad; the final round on 1b3452f44ad found nothing.
  • First CI run (on 66bb77435c3): triage-recovery.test.ts failed from this change (fixed above); pr-wrapper-source-closure hit a 120 s timeout in unrelated tooling; one shard hit the runner's daily sandbox-start quota.
  • Source check of the released 2026.10.9 updater: gateway migration recovery runs only after a refused database rollback (state-migrated-no-rollback), so a triggering failure always precedes it.

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

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review November 14, 2026 15:23
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Nov 14, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T17:48:00.832460Z 7b80ebf New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) November 14, 2026 15:30
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The report retains only the three recovery failures and drops database rollback.
  • After: The report retains database rollback and the latest two recovery failures, subject to its existing byte limit.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and useful, but test-only evidence does not meet the required real-behavior proof standard.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users cannot report what started update recovery because subsequent recovery failures displace that evidence.
Reason: The maintainer-authored direction restores useful failure context while preserving existing execution, redaction, and byte-limit contracts.

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
Reviewed head: 66bb77435c346caadadbbb479045495682c30636

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted CLI output and its saved report showing the initiating failure survives subsequent recovery failures, with a budget-constrained case; redact IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced diff changes failed-step selection and whole-record pruning in the existing sanitizer; the two added regressions cover ordinary retention and prompt-budget pruning. (src/commands/triage-update.ts:324, 66bb77435c34)
  • Current main retains the defect: Main selects failedSteps.slice(-3) and removes the oldest retained record when over budget, so four failures can lose their initiating step. (src/commands/triage-update.ts:325, d13336516b23)
  • Reporter supplied the diagnostic-loss case: Aribarambo's full artifact in [Bug]: Post-install Doctor WAL publication verification leaves 11.3 update partially finalized #197083 (comment) contains candidate lint and three recovery failures, reports omittedDetails: 2, and contains no earlier initiating failure.
  • Existing artifact owner and compatibility boundary: The artifact writer continues using the same sanitizer, report path, schemas, and bounded JSON envelope; the patch changes selected diagnostic records without introducing a persisted format or rewriting old reports. (src/infra/update-failure-report-artifact.ts:157, 66bb77435c34)
  • Supplied validation: The complete PR body reports 22 passing focused tests, base-failing regressions, and passing targeted static checks; it supplies no after-fix shipped-entry-point trace. The captured body source identity is 75e179e47a87f5961d9c73e27680be1808542ff52fad4e26a7f570cd7f7edb91. (src/commands/triage-update.test.ts:175, 66bb77435c34)
  • Failed CI lane never exercised the patch: The failed checks-node-changed-compact-large-17 job stopped during runner setup with a sandbox-start quota annotation; checkout and test execution were skipped. (66bb77435c34)

Likely related people:

  • Peter Steinberger: Raw commit 1e48d0c adds src/commands/triage-update.ts:339 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1e48d0cff2e7; files: src/commands/triage-update.ts)

PR surface

Source +6, Tests +65. Total +71 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 9 3 +6
Tests 1 67 2 +65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 76 5 +71

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Missing initiating errors impede diagnosis of failed updates, but this patch does not change update execution or recovery availability.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Missing initiating errors impede diagnosis of failed updates, but this patch does not change update execution or recovery availability.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

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
@steipete
steipete disabled auto-merge November 14, 2026 17:26
@steipete
steipete merged commit 5df28e7 into main Nov 14, 2026
117 checks passed
@steipete
steipete deleted the codex/d15-triage-trigger-step branch November 14, 2026 18:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
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
RomneyDa added a commit that referenced this pull request Nov 18, 2026
#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]>
tideclaw-bot added a commit that referenced this pull request Nov 24, 2026
#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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant