Repository navigation
fix: recover interrupted npm package updates - #158491
Conversation
Preserve current rows for same-version recovery copies, refuse permission-bearing schema downgrades, and bind inverse preparation to explicit migration versions. Stage each SQLite copy before exclusive publication and clean incomplete outputs on every failure. Co-authored-by: Jason (Json) <[email protected]>
Verify bound baseline and candidate manifests, prepare a private recovery generation through isolated SQLite workers, and route the original rollback controller through that preparation without claiming publication. Reuse current config, durability, status, and snapshot-sanitizer owners while preserving schema-19 refusal and immutable B/C evidence. Co-authored-by: Jason (Json) <[email protected]>
Persist reverse preparation before staging, resume interrupted publication through the sealed helper, and commit terminal rollback only after the restored state is readmitted. Keep old runtime preflight read-only, preserve schema-19 authority, and refuse incompatible reverse preparation. Co-authored-by: Jason (Json) <[email protected]>
Keep prepublication failures on the untouched-package recovery path, support stable Unix npm symlink launchers, and retire a publication whose first displacement was refused. Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Jason (Json) <[email protected]>
Move shared recovery and handoff types to leaf modules so runtime owners remain acyclic, and document the three read-only raw SQLite recovery primitives. Co-authored-by: Jason (Json) <[email protected]>
|
🦞👀 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: needs real behavior proof before merge. Reviewed September 28, 2026, 2:39 AM ET / 06:39 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch adds a durable journal and standalone helper for recovering supported POSIX npm package updates, with updater handoff, status output, tests, and documentation. Merge readiness⛔ Blocked before merge - 9 items remain Keep open. Current main does not provide the branch’s standalone interrupted-package recovery, and the related full-state PRs address broader work. Priority: P0 Review scores
Verification
How this fits togetherThe CLI updater stages an npm package, then replaces the installed package and launchers before checking the Gateway. The new recovery journal records that publication so a separate helper can inspect or finish it if the updater stops. flowchart LR
A[Installed updater] --> B[Staged npm package]
B --> C[Recovery journal]
C --> D{Owner and data checks}
D -->|safe| E[Publish or restore package]
D -->|unsafe| F[Retain data and explain refusal]
E --> G[Gateway restart and status]
Decision needed
Why: The branch materially changes durable recovery layout and the behavior of installations carrying older journals; repository storage policy calls for an accepted contract, which the supplied discussion does not establish. Before merge
Findings
Agent review detailsSecurityNeeds attention: No new dependency or workflow-permission change was found; retained recovery authority still needs final-effect verification. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one journal and original-owner recovery path, with a guided Doctor or Fix launcher for users stranded after an interrupted update and an explicit refusal when existing data cannot safely roll back. Do we have a high-confidence way to reproduce the issue? Yes. Interrupting a supported POSIX npm update during package publication exposes the recovery boundary in current source; the linked installed run demonstrates updater loss on an older branch revision, but this review did not execute current main. Is this the best way to solve the issue? Unclear. A single journal and sealed helper fit the existing updater owner, but the stored-contract upgrade and retained-authority effects need current-head proof before this can be judged the safest complete fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8ab43884177d. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What 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
HistoryReview history (6 earlier review cycles)
|
Complete the shared task-content projection cutover for asynchronous finalization and delivery. Preserve the captured Incognito policy and exact task-assignment fences. The unchanged worker suite reproduced six ReferenceError failures before the fix and passes all seven cases afterward; the sibling SDK runtime suite passes all 30 cases. Independent review is clean through P2.
…act bigint identities (#162245) A Windows 2026.9.6 -> 2026.9.7 update passed every candidate check, published 9.7, then rolled back because the first delegated live Doctor reported "Candidate executor binding does not match its parent": #158491 switched the managed-update lease-directory identity to bigint lstat while keeping an exact string compare, so a 9.6 parent's numeric (precision-lost) identity never matched, and the identity read error was swallowed into an unreadable-lease classification. The shared identity owner now accepts the legacy numeric spelling once at initial admission when it equals the candidate's bigint identity rounded through the same serialization (an accepted one-hop tradeoff recorded at the comparer), pins exact bigint identities for every subsequent operation, and surfaces underlying read errors. Closes #162130
…act bigint identities (openclaw#162245) A Windows 2026.9.6 -> 2026.9.7 update passed every candidate check, published 9.7, then rolled back because the first delegated live Doctor reported "Candidate executor binding does not match its parent": openclaw#158491 switched the managed-update lease-directory identity to bigint lstat while keeping an exact string compare, so a 9.6 parent's numeric (precision-lost) identity never matched, and the identity read error was swallowed into an unreadable-lease classification. The shared identity owner now accepts the legacy numeric spelling once at initial admission when it equals the candidate's bigint identity rounded through the same serialization (an accepted one-hop tradeoff recorded at the comparer), pins exact bigint identities for every subsequent operation, and surfaces underlying read errors. Closes openclaw#162130
…act bigint identities (#162245) A Windows 2026.9.6 -> 2026.9.7 update passed every candidate check, published 9.7, then rolled back because the first delegated live Doctor reported "Candidate executor binding does not match its parent": #158491 switched the managed-update lease-directory identity to bigint lstat while keeping an exact string compare, so a 9.6 parent's numeric (precision-lost) identity never matched, and the identity read error was swallowed into an unreadable-lease classification. The shared identity owner now accepts the legacy numeric spelling once at initial admission when it equals the candidate's bigint identity rounded through the same serialization (an accepted one-hop tradeoff recorded at the comparer), pins exact bigint identities for every subsequent operation, and surfaces underlying read errors. Closes #162130 (cherry picked from commit f885caa)
What Problem This Solves
Interrupted npm updates can leave the package and launchers partly replaced, with recovery dependent on the updater surviving.
User Impact
Supported POSIX npm updates print a standalone recovery command before publication. Its
status,repair, andretireoperations inspect and finish the recorded package operation. Automatic rollback restores the previous package, configuration, and service when safe, preserving newer writes in compatible databases. If a candidate may have served with incompatible databases, recovery retains it and its data and explains the refusal.After updater loss, Gateway restart remains an operator action; keep other package managers stopped during recovery. Windows, native pnpm/Bun layouts, older targets, and local override reapplication retain their existing owners. Full-state checkpoint replay and reverse database migrations remain deferred; #144005 and #145169 remain open.
Why This Change Was Made
One durable package journal owns publication and recovery; existing owners retain database, configuration, and service recovery. The installed post-core worker receives live delegated authority and reports completion only after its children settle. The unused state-generation engine, inverse migrations, private store transport, and associated tests are removed. The earlier review’s legacy-journal concern is handled by read-only inspection and guidance to the original helper; its reverse-publication concern is removed with that unused owner.
Against integrated main
9ac47355, the change is +11,065/−2,062 lines across 130 files (+9,003 net). That is about 64% less net growth than the original PR, with 4,168 net production lines and 4,754 net test/support lines. The retained implementation protects package publication, original-owner authority, crash recovery, and durable retirement.Related: #142770. Thanks to @fuller-stack-dev (Jason) for the original recovery work and design; contributor credit is preserved.
Evidence
Real installed Crabbox testing through Blacksmith passed in run 36280374595, bound to
d1621807a918617ed0f96d6a9f84130072b92d34:Rollback and owner-loss scenarios used isolated users and real user-systemd services, with verified cleanup. Rollback used a same-schema, candidate-derived previous package. The owner-loss cut followed completed publication: it does not prove mid-rename recovery, automatic restart, full-state replay, or
.clawdbotrelocation. Workspace data was synthetic. These installed results remain evidence for their exact older revision.Earlier scoped qualification combines 1,413 distinct passes and six Darwin-only skips across 57 files: 35 owner files (882 passes) and 23 shared CLI files (548 passes), with 17 overlapping npm-runtime cases counted once. These were multiple source-bound runs against production
51072c9plus test/fixture corrections, ending atbcc03918; they were not one passing full-suite run or execution of this merge.Focused regressions demonstrated copy durability (32/32; 37.67s), final-helper directory persistence and retry refusal (63/63; 283.88s, strengthened case 1.583s), and retained MCP fixture isolation in the original five-file order (337/337; 480.19s). All 114 MCP runtime cases and existing deadlines were preserved. Native build and
pnpm checkpassed at51072c9.Current head:
83c03dc3edd0e5b4d9b9340eb2d315508dc6258d. Fresh Crabbox integration verified its published source tree and passed core typechecking (39.007s) plus 485 tests across 12 files, with six Darwin-only skips. Package/filesystem ownership and cleanup: 94 passes (55.546s); CLI staging, admission diagnostics and no-op behavior: 54 passes (50.059s); the original five-file MCP order: 337 passes (107.051s), preserving its non-isolated threads runner, setup and deadlines. Both independent integration review passes had no P0–P2 findings. Changed-file lint, formatting, diff, and line-count checks passed. Exact-head Security Review, dependency review and security-fast passed.Broad CI is not green. CI preflight refused the existing changed-test planner’s 186 Node jobs against its 130-job limit before tests ran. Build Artifacts failed on duplicate
dataImageClipboardFileexports in later-main UI source: tested mergecefc767d2c12de0b9b5f56af2857e46273266bd9contains the exact UI blob from its main parent3c1a919bb919d24f996106090533668045e343fa; this PR’s own head has neither export in that file. These are separate from the successful scoped checks; source equality is not presented as a passing baseline execution.Broader validation limits
The native full test run was interrupted after twelve state-lease mock failures (missing
throwSqliteLifecycleErrors; matching compared-main source, without baseline execution) and an unresolved UI-fixture subprocess failure. Its replay failed duringENOTEMPTYcleanup, leaving the original cause unknown.Two full remote attempts lost SSH without completed results. Session-fixture WAL/SHM cleanup also raised
ENOTEMPTY; a passing replay established no repair. An MCP release wrapper exceeded its deadline; private-cache changes establish ownership, not a timing fix. A macOS memory batch timeout and initialization failure did not reproduce in a 70/70 Linux run. Six Darwin-only symlink cases remain skipped in Linux. Full-suite success is not claimed.