Skip to content

fix(update): prevent reporting errors from rolling back verified updates - #159072

Merged
steipete merged 1 commit into
mainfrom
codex/update-postverification-settlement
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/update-postverification-settlement

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a healthy update being rolled back when its final history-reporting read cannot snapshot a database that the restarted Gateway is actively changing.

User Impact

The verified installation stays in place when reporting fails. Genuine activation and verification failures still use the existing guarded recovery flow; a reporting failure does not claim successful finalization.

Why This Change Was Made

Next-action guidance now comes from the same admitted ledger row that records it, avoiding a separate cold database snapshot. Filesystem observations are prepared before the transaction, terminal history remains unchanged, and successful operational work hands reporting to the terminal owner outside the rollback catch. Schema, public history-reader, recovery, and service-ownership checks are unchanged.

An already-running older updater keeps its loaded implementation; this change must be present in the driver. Older installations can use the supported stopped-service --no-restart update flow, then start and verify through their service owner after update settlement.

Evidence

  • The regressions fail on the original code: unavailable snapshots prevent guidance, and a reporting identity-read error rolls the real candidate package from version 2.0.0 back to 1.0.0 after successful verification.

  • With the fix, guidance records successfully without that snapshot, completed rows stay unchanged, and a reporting failure preserves the candidate, launcher, and recovery backup with a nonzero result.

  • All 162 tests across the five affected finalization, recovery, terminal-publication, and guidance files pass. The regression uses real SQLite history, executor leases, package transactions, and the schema-inspection worker; native Gateway verification and unrelated plugin work are supplied at the existing harness boundary.

  • Independent isolated review found no actionable P0/P1 findings. The new rollback regression takes about 3.4 seconds locally; its one-worker wrapper run took 33.47 seconds including transforms. In exact-head CI, the three new regressions passed in 1.213, 0.387, and 0.444 seconds, and the full CLI shard passed 7,492 tests (27 skipped). Changed-file checks pass, including production/test typechecks, lint, formatting, dead-export scans, and repository guards.

  • Published-driver acceptance passed in one 712-second cell: published 2026.9.6 (eb377ac59e6c) ran the update to the exact 9f9667ad7f72 candidate with --no-restart. The command succeeded without recovery, installed-package identity and automatic migration passed before the standalone Doctor pass, and the candidate Gateway passed health, readiness, and RPC checks after an 86-second startup.

  • That cell uses an isolated foreground Gateway, not a native service-manager drain. Its optional post-core exit snapshot was unavailable; the original command status and result, installed candidate, and serving checks were observed. Backup retention is covered by the composed regression, not a backup-restore assertion in this cell.

@clawsweeper

clawsweeper Bot commented Sep 26, 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 September 26, 2026 17:42
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: L labels Sep 26, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 1:59 PM ET / 17:59 UTC.

ClawSweeper review

What this changes

The branch moves final reporting outside the successful update’s rollback catch, records recovery guidance from the admitted SQLite row, and updates regression tests and recovery documentation.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still allows a reporting error to enter the post-update rollback path. The PR addresses that boundary without an identified patch defect, but the repository-required published-driver upgrade proof remains outstanding.

Priority: P0
Reviewed head: 9f9667ad7f7235ef3374581636836060ba62167b

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair and composed regressions are convincing, but the required shipped-driver upgrade observation is missing.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The supplied repository state marks this PR as member-authored, so the external-contributor proof gate does not apply. Its composed regression uses a real package swap and SQLite ledger with mocked Gateway verification; no published-driver × candidate upgrade observation is supplied. The existing next-action field changes write path, not stored-data format.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state marks this PR as member-authored, so the external-contributor proof gate does not apply. Its composed regression uses a real package swap and SQLite ledger with mocked Gateway verification; no published-driver × candidate upgrade observation is supplied. The existing next-action field changes write path, not stored-data format.
Evidence reviewed 7 items Current-main behavior: Current main calls final reporting inside the catch that handles post-update failures; a reporting exception can therefore be handled as a verification failure.
Introduced rollback boundary: The PR returns from operational work before calling final reporting, so a reporting exception cannot enter that work’s rollback catch.
Ledger guidance: Recovery guidance is derived and, for a running row, recorded within one admitted ledger mutation. The existing write owner skips persistence when the row is unchanged.
Findings None None.
Security None None.

How this fits together

The update CLI installs a candidate, verifies the Gateway, and records the outcome in update history. That history feeds the command’s final result and recovery guidance.

flowchart TD
A[Update request] --> B[Candidate installation]
B --> C[Gateway verification]
C --> D{Verified?}
D -->|No| E[Guarded recovery]
D -->|Yes| F[History reporting]
E --> G[CLI result]
F --> G
Loading

Before merge

  • Resolve merge risk (P1) - The PR does not show the required published-driver × candidate upgrade cell. A first upgrade still runs the older updater’s reporting path, and the documented stopped-service recovery route has not been demonstrated here.
  • Complete next step (P2) - Capture the repository-required published-driver × candidate upgrade cell and record the observed package, backup, Gateway, and command outcomes.
Agent review details

Security

None.

PR surface

Source +40, Tests +131, Docs +5. Total +176 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 323 283 +40
Tests 2 131 0 +131
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 459 283 +176

Review metrics

Metric Value Why it matters
Code and regression growth production +40 net lines; tests +131 lines The production growth separates reporting from rollback and replaces a separate history read; the new tests cover both boundaries.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep a verified candidate and its recovery backup when reporting fails, show a clear Fix or Doctor recovery action, and verify the first upgrade from a shipped driver.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep a verified candidate and its recovery backup when reporting fails, show a clear Fix or Doctor recovery action, and verify the first upgrade from a shipped driver.

Do we have a high-confidence way to reproduce the issue?

Yes. The pre-fix catch and ledger read give a clear fault-injection path, and the new composed regression exercises a real package swap and SQLite history; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Separating reporting from successful operational work addresses the rollback cause while retaining guarded recovery for activation and verification failures. The first-hop upgrade behavior still needs proof.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 06ab6266397d.

Labels

Label changes:

  • add P0: A healthy update can repeatedly roll back, while the described first-hop recovery requires service-manager commands outside the update flow.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state marks this PR as member-authored, so the external-contributor proof gate does not apply. Its composed regression uses a real package swap and SQLite ledger with mocked Gateway verification; no published-driver × candidate upgrade observation is supplied. The existing next-action field changes write path, not stored-data format.

Label justifications:

  • P0: A healthy update can repeatedly roll back, while the described first-hop recovery requires service-manager commands outside the update flow.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state marks this PR as member-authored, so the external-contributor proof gate does not apply. Its composed regression uses a real package swap and SQLite ledger with mocked Gateway verification; no published-driver × candidate upgrade observation is supplied. The existing next-action field changes write path, not stored-data format.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record a published-driver × candidate upgrade result, including the stopped-service recovery path if the older driver encounters the reporting failure.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 8bb8609 into main Sep 26, 2026
276 of 278 checks passed
@steipete
steipete deleted the codex/update-postverification-settlement branch September 26, 2026 18:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Sep 27, 2026
Supply finite container/state-directory facts and execute next-action writes against an admitted fixture ledger row after openclaw#159072. Assert that the real reporting callback stores and publishes its guidance without replacing production outcome logic or weakening backup-retention checks.

Verified on Node 24.19.0: native regression 19/19 (2.30s wall), isolated canonical wrapper 1/1 (789ms test; 1.64s Vitest), recovery-guidance sibling 36/36. Changed-file gates and independent P0/P1 autoreview passed.

Co-authored-by: sallyom <[email protected]>
Co-authored-by: steipete <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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