Repository navigation
fix(update): prevent reporting errors from rolling back verified updates - #159072
Conversation
|
🦞👀 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: blocked before merge. Reviewed September 26, 2026, 1:59 PM ET / 17:59 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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
Before merge
Agent review detailsSecurityNone. PR surfaceSource +40, Tests +131, Docs +5. Total +176 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label 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
|
|
Merged via squash.
|
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]>
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-restartupdate 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 exact9f9667ad7f72candidate 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.