Repository navigation
fix(update): preserve pnpm identity across managed package replacement - #146395
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: needs maintainer review before merge. Reviewed September 12, 2026, 5:29 PM ET / 21:29 UTC (Revision 2). ClawSweeper reviewWhat this changesPreserves managed-update continuity across pnpm package replacement by checking installation ownership and the executing generation, with command-entry regression coverage. Merge readiness✅ Ready for maintainer review The fix remains necessary for released pnpm updaters, and no introduced correctness defect was found. Current main and v2026.9.4 retain the exact-root rejection; the related rollback work does not supersede this repair. Priority: P0 Review scores
Verification
How this fits togetherManaged updates replace OpenClaw while a helper coordinates Gateway shutdown and recovery. The post-core admission check determines whether the newly executing package may continue the original update. flowchart TD
A[Released updater] --> B[Retained installation identity]
A --> C[pnpm package replacement]
C --> D[Executing package and active link]
B --> E[Handoff admission]
D --> E
E -->|Verified replacement| F[Continue update and restore Gateway]
E -->|Mismatch| G[Reject continuation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +67, Tests +105. Total +172 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one candidate-side admission owner that recognizes legitimate released-driver replacements while preserving exact service and recovery authority. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: a released driver retains the old canonical package root while the replacement executes from a different pnpm generation. The PR reports real reproduction; this review did not execute it. Is this the best way to solve the issue? Yes. Candidate-side compatibility is necessary for already-running released updaters, and the patch reuses existing pnpm discovery while retaining rejection of foreign or displaced generations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9b59fe4ef7da. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
landpr-approve-admin-merge |
|
Thanks @timetrvlr! Proof: Managed pnpm updates from 2026.9.2 and 2026.9.3 completed under user-systemd and restored healthy Gateways. Second updates returned
|
openclaw#146395) Closes openclaw#142715. Reported by @timetrvlr. ## What Problem This Solves A managed pnpm update started by OpenClaw 2026.9.2 can replace the package, then reject its new generation with “Managed update handoff root mismatch” and leave the Gateway stopped. ## Why This Change Was Made Post-core admission now verifies the retained and executing packages belong to the same pnpm installation and that its active link still selects the executing generation. The decision `whether a post-core handoff belongs to the retained installation` is made by exactly one mechanism at `src/infra/update-managed-service-handoff.ts:2436`. The added compatibility code is necessary because the already-running released updater cannot receive a producer-side fix. ## User Impact Verified pnpm generation replacements complete and restore the Gateway. Foreign installations, inactive generations, and mismatches before replacement remain rejected. ## Evidence The original 2026.9.2 CLI reproduced the outage when updating to 2026.9.3 and main at `6b7ceed7c3e1`. With this change, real user-systemd updates from both 2026.9.2 and 2026.9.3 completed, returned success, and restored healthy Gateways without manual start. Both second updates returned `already-current` with unchanged Gateway PIDs. The packaged CLI rejects the displaced process in a controlled real-pnpm link-change race. These passing cases used fresh state without an existing agent database. The regression fails before the change; 77 affected post-core, sentinel, and handoff cases pass, including a link change during metadata reading. ## Compatibility The original handoff metadata, service authority, and exact installation lease identity remain unchanged. No configuration key, schema change, or retry was added. Runtime proof covers pnpm 10.28.2 on Debian with Node 26.1.0; broader pnpm 11 replacement support is not claimed. ## Consumers - `openclaw update` post-core continuation accepts the verified replacement from an older pnpm updater. ## Invalidation Admission reads the package manifests, pnpm owner metadata, and active package link again; no cache is added. ## Contention No lock or queue ownership changes. The existing executor is rechecked after admission reads and before configuration mutation. ## Tests The registered `openclaw update` cases cover replacement, rejection of another valid pnpm installation, inactive generation, pre-core rejection, and a moving pnpm link. Existing producer and pnpm 11 discovery cases remain green; both package builds passed integrity checks. ## Related Work openclaw#144005 also changes `update-command-run.ts` and `update-cli.test.ts`. This fix has no dependency on it and should land first; later integration must retain the admission check and partial-mock cutover. ## Follow-ups - Recovery after a genuine post-core mismatch stays separate: current helper-boundary tests confirm foreign-root recovery is rejected without restarting; a full update-path reproduction is not claimed. - Existing agent schema 19→20 updates under the released 2026.9.2 driver still fail at Doctor on both comparison and patched builds (openclaw#145172); this change does not alter that guard. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #142715. Reported by @timetrvlr.
What Problem This Solves
A managed pnpm update started by OpenClaw 2026.9.2 can replace the package, then reject its new generation with “Managed update handoff root mismatch” and leave the Gateway stopped.
Why This Change Was Made
Post-core admission now verifies the retained and executing packages belong to the same pnpm installation and that its active link still selects the executing generation. The decision
whether a post-core handoff belongs to the retained installationis made by exactly one mechanism atsrc/infra/update-managed-service-handoff.ts:2436. The added compatibility code is necessary because the already-running released updater cannot receive a producer-side fix.User Impact
Verified pnpm generation replacements complete and restore the Gateway. Foreign installations, inactive generations, and mismatches before replacement remain rejected.
Evidence
The original 2026.9.2 CLI reproduced the outage when updating to 2026.9.3 and main at
d23730ee7c54. With this change, real user-systemd updates from both 2026.9.2 and 2026.9.3 completed, returned success, and restored healthy Gateways without manual start. Both second updates returnedalready-currentwith unchanged Gateway PIDs. The packaged CLI rejects the displaced process in a controlled real-pnpm link-change race. These passing cases used fresh state without an existing agent database. The regression fails before the change; 77 affected post-core, sentinel, and handoff cases pass, including a link change during metadata reading.Compatibility
The original handoff metadata, service authority, and exact installation lease identity remain unchanged. No configuration key, schema change, or retry was added. Runtime proof covers pnpm 10.28.2 on Debian with Node 26.1.0; broader pnpm 11 replacement support is not claimed.
Consumers
openclaw updatepost-core continuation accepts the verified replacement from an older pnpm updater.Invalidation
Admission reads the package manifests, pnpm owner metadata, and active package link again; no cache is added.
Contention
No lock or queue ownership changes. The existing executor is rechecked after admission reads and before configuration mutation.
Tests
The registered
openclaw updatecases cover replacement, rejection of another valid pnpm installation, inactive generation, pre-core rejection, and a moving pnpm link. Existing producer and pnpm 11 discovery cases remain green; both package builds passed integrity checks.Related Work
#144005 also changes
update-command-run.tsandupdate-cli.test.ts. This fix has no dependency on it and should land first; later integration must retain the admission check and partial-mock cutover.Follow-ups