Repository navigation
fix(update): keep progress writes from invalidating snapshots - #162604
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 October 1, 2026, 2:07 PM ET / 18:07 UTC (Revision 9). ClawSweeper reviewWhat this changesThe PR retains the updater’s progress database connection during candidate validation, reuses structural admission checks, preserves receipt errors through cleanup, and strengthens Doctor’s final replacement checks. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains useful and is absent from current main. The previous integration blocker is resolved, and this review found no actionable introduced defects; current-head CI remains pending. Priority: P1 Review scores
Verification
How this fits togetherThe updater records progress in OpenClaw’s shared SQLite database while checking a candidate against private state snapshots. Its worker lifecycle must keep those snapshots consistent and preserve current write authority before installation proceeds. flowchart TD
A[Update request] --> B[Candidate validation]
B --> C[Retained progress worker]
C --> D[Current authority and database checks]
D --> E[Durable progress receipts]
B --> F[Private state snapshot]
F --> G[Candidate checks and cleanup]
G --> H[Installation decision]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +221, Tests +712, Docs +29. Total +962 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep snapshot coordination with the existing worker owner, retaining per-transaction authority checks and documenting that the installed updater must carry the lifetime fix. Do we have a high-confidence way to reproduce the issue? Yes, source supports the last-connection-close race during overlapping progress writes and snapshot selection, and the captured body reports real-owner FIFO controls. This read-only review did not execute those controls. Is this the best way to solve the issue? Yes, retaining the actual progress connection through the existing worker lifecycle addresses the race without creating another state owner or relaxing mutable admission checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1bc8ad24e8d0. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
6de0f4e to
89e65a1
Compare
89e65a1 to
6001f45
Compare
Dependency graph guard clearedThis PR no longer has dependency changes awaiting review. A future dependency graph change from an external contributor requires a maintainer's
|
87c517f to
388fc6e
Compare
388fc6e to
28e0c31
Compare
fa04e67 to
528afba
Compare
Keep initial admission and completion receipt refusals distinct from candidate check failures while preserving owned teardown.
528afba to
ef15c86
Compare
|
Merged via squash auto-merge.
|
After a Doctor error the package rollback captured its snapshot while retained writers were still active, so the rollback refused with a false "changed" verdict and the npm error-path result carried an unexpected shape (update-cli.package-lifecycle red on main since #162604). Rollback now drains retained writers before capture on POSIX by awaiting the cache close and re-checking ownership, without blocking POSIX snapshot readers; Windows keeps its existing removal probe. Every existing assertion is unchanged. Refs #162604
…aw#162604) * fix(update): retain progress writer through candidate snapshots * fix(doctor): refresh source state after the open-file probe * test(tui): supply the retained writer admission fixture * fix(update): preserve canary receipt failures through cleanup Keep initial admission and completion receipt refusals distinct from candidate check failures while preserving owned teardown.
…law#163008) After a Doctor error the package rollback captured its snapshot while retained writers were still active, so the rollback refused with a false "changed" verdict and the npm error-path result carried an unexpected shape (update-cli.package-lifecycle red on main since openclaw#162604). Rollback now drains retained writers before capture on POSIX by awaiting the cache close and re-checking ownership, without blocking POSIX snapshot readers; Windows keeps its existing removal probe. Every existing assertion is unchanged. Refs openclaw#162604
What Problem This Solves
Update progress writes could close the last SQLite connection while candidate state was being copied, remove WAL/SHM, and make the updater reject its own snapshot. Each receipt also repeated integrity and schema admission work.
User Impact
The updater retains its actual progress connection through validation and cleanup. Ordinary receipts reuse admitted structural facts while preserving current identity, authority, ownership metadata, and version checks.
Initial and completed-step receipt refusals now retain their original error. Initial refusal stops before copying or child startup; a completed check is not misclassified as a candidate failure or reported again. Existing streamed-stage reporting and owned cleanup remain intact.
No overall installed-driver speedup was demonstrated. The complete four-run comparison observed the combined driver's median increase from 219.022 to 227.019 seconds, or 3.65% slower. Reliability and elimination of repeated admission are supported independently of that timing result.
The installed updater must contain the connection-lifetime fix. Candidate code cannot patch the immutable published 2026.9.7 driver's initial snapshot path. A later successful run does not establish that an older driver's first-hop race was repaired.
Why This Change Was Made
The canonical worker retains the native ledger connection and warms it before snapshot selection. Compatible lazy DDL triggers fresh admission. Warm writes recheck mutable ownership and content versions; incompatible schema or physical replacement fails before mutation. The content-version owner caches prepared statements while SQLite supplies the current or pinned row value.
A private canary receipt observer distinguishes initial admission and completed-step reporting errors from candidate-check failures. It preserves absent callbacks and original error identity, with cleanup uncertainty taking precedence. Streamed progress stays with its existing stage owner. The NOCOW change observes directory identity after the external open-file probe and rechecks current authority immediately before exchange. A new TUI test caller supplies the required retained-writer factory without weakening its no-writer assertion.
Canonical main owns the other investigated CI repairs: lock normalization
4b32b401, requester receiptsfd74b341, NOCOW inventory refresh4d1890a3, cron fault injection217f7991, Doctor fixture opt-in0e878223, and UI replacement-startup fixture5834b4f0. This branch adopts those owners and drops duplicate patches.Evidence
The predeclared comparison order was B, C, C, B. B was baseline installed driver
b5555b0b; C was combined installed driverf1410115. Every run updated an initial package installation from the same published source checkout to Git targetf1410115246db4fda3ed1882da3c6240d85ff458, tree600c7a9ec53d18bc1e2e5e977c664ebdb324867e.All four attempts passed equivalent real build, staging, swap, Doctor, completion, settlement, and synthetic-content preservation. This is two samples per driver on one host. Both used the same candidate, so candidate-side improvements were shared; this experiment does not isolate this PR. Preflight-build median increased 48.257→57.809 seconds, user-plus-system CPU 347.23→367.80 seconds, and reported filesystem-output counters 27,688,204→28,537,232. The cause remains unresolved; build variability does not establish that noise explains the difference.
6de0f4e, including state schema 19→20, agents at 24, exact clean source/runtime, zero active runs, and preservation. Installed-new-driver full update proof passed at the frozen comparison port. These remain prior-head receipts.528afba, run36891605760, job110471407578(527 seconds job wall). Candidate7178e80bba560724db4db537f1db0c6a9ad54059reached durablefinished/succeeded; updater exit, status read, post-update readiness, exact running-build probe, and final service cleanup all exited zero. This does not explain the earlier failed attempts or replace final-head gates.5ba3cfabwith the reviewed NOCOW patch, including core production, all 27 test type graphs, and guards. Subsequent changed inputs received scoped qualification.ef15c86e5f89f87f7d54b3666ef23d68216f67de/ tree127c9f7a19e586ba04552b9df3a6dd96368f9246, based on main4176b957ad34cefa9a4182d64ebecf434e007cb7, passed worker tests, canonical UI reconciliation 10/10 (30.774 seconds command wall), NOCOW policy 6/6 (40.653 seconds), core/state/UI/other types, and diff sanity. Linux physical NOCOW rewriting and final packaged runtime/import compatibility remain covered by required final CI.Retained CI failures, repairs, and remaining uncertainty
Run
36849651178(89e65a1) failed sidebar focus restoration and cancelled 42 jobs. The unchanged shard later passed 124/124; main's frame-gating revertd1dc3cd5was incorporated. The exact flake cause remains unproven.Run
36855055580(6001f45f) failed prebuilt source-state admission and requester receipt assertions. Pinned pnpm alone pruned stale manager-lock lines; canonical normalization4b32b401repairs that without weakening source admission. Canonical requester correctionfd74b341matches the yielded-parent policy. An additional pre-fix Gateway connection timeout remains unexplained; a later pass is not proof of a fix.Run
36864506584(87c517ff) failed cron fault injection and NOCOW new-WAL refusal. The former injector missed the real copy boundary; canonical217f7991now targets the exact source and passed five owner cases. The NOCOW failure reproduced before inventory refresh and passed afterward with 20 passes and one platform skip. That inventory repair is now4d1890a3; this PR retains the additional directory-identity and authority checks.Run
36882980390(28e0c31) exposed the TUI test caller's missing fourth argument, now corrected and independently reviewed. Its commands type graph took 56.2 seconds within a 327-second job; individual test-file CI seconds were not present in that log.The same run's published-driver job failed managed-service activation after candidate checks and cleanup passed: “Survivor supervisor has not settled; retaining process custody.” The Gateway recorded a clean 65ms shutdown and a code-zero child-close receipt, which does not prove supervisor settlement. Final fixture cleanup succeeded. One real Linux reproduction did not reproduce the failure and correctly retained custody until an inherited process group settled. The original cause remains unproven.
Run
36885364091(fa04e677) passed the TUI repair but its published-driver job hit the 525-second cell deadline. The native record already said finished/succeeded with the exact candidate build running, ready, and verified, only 1.438 seconds before that deadline. The harness killed the command 15 seconds after TERM; no command-exit receipt or subsequent durable status read was captured. The last diagnostic identified awaited package backup cleanup, which has its own existing five-minute maintenance allowance. This does not establish a leaked worker or unbounded cleanup. No timeout increase, baseline change, liveness shortcut, or waiver was made. The later528afbapass does not prove either historical failure fixed.Run
36891605760(528afba) passed published-driver validation but failed UI stream reconciliation and Doctor's NOCOW fixture. Both failures were diagnosed and repaired independently; main's5834b4f0and0e878223are adopted. The UI shard reproduced 1 failure/158 passes before repair; the qualified repair passed 159/159. Canonical main's alternate fixture also passed the focused ten cases. The Doctor fixture now requests its existing repair opt-in before state capture; no production repair policy changed.The initial attempt to observe all progress-receipt failures changed three established streamed-stage assertions. That approach was narrowed without weakening those assertions; all now pass alongside the new controls. Current enforced CI—including packaged candidate build and the published-driver cell—must pass before merge. No CI rerun, dispatch, or admin exception is requested.