Skip to content

fix(update): preserve pnpm identity across managed package replacement - #146395

Merged
obviyus merged 3 commits into
mainfrom
bugloop/managed-update-handoff-root
Sep 13, 2026
Merged

obviyus merged 3 commits into
mainfrom
bugloop/managed-update-handoff-root

Conversation

@obviyus

@obviyus obviyus commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

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 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 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 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

#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 (feat(sessions): automatically archive older transcripts #145172); this change does not alter that guard.

@clawsweeper

clawsweeper Bot commented Sep 12, 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.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:29 PM ET / 21:29 UTC (Revision 2).

ClawSweeper review

What this changes

Preserves 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
Reviewed head: 8794b18711ae7fb48f88ed2b0111715f6b205ed6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused compatibility repair with meaningful command-entry coverage, scoped upgrade observations, and no actionable correctness findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The host's MEMBER classification exempts this PR from contributor proof requirements. Its body nevertheless reports published-driver systemd upgrades and displaced-generation rejection covering the changed admission path; these were not independently rerun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The host's MEMBER classification exempts this PR from contributor proof requirements. Its body nevertheless reports published-driver systemd upgrades and displaced-generation rejection covering the changed admission path; these were not independently rerun.
Evidence reviewed 9 items Current main still needs compatibility admission: Current main compares the retained sentinel root with the discovered root using exact canonical equality. Different pnpm package generations therefore remain distinct.
Latest release retains the rejection: The supplied v2026.9.4 release commit contains the same exact-root check and mismatch error.
Bounded replacement admission: The introduced check requires discovery to match the loaded package, limits generation equivalence to post-core continuation, compares pnpm installation owners, and rereads the active package target after asynchronous discovery. It does not rewrite the original metadata or lease identity.
Findings None None.
Security None None.

How this fits together

Managed 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +67, Tests +105. Total +172 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 77 10 +67
Tests 2 112 7 +105
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 189 17 +172

Review metrics

Metric Value Why it matters
Compatibility repair size production +67 net lines; tests +105 net lines The production growth addresses already-running released drivers that cannot receive the existing producer-side repair.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #142715
Summary: This PR is the candidate repair for the reported pnpm generation handoff outage.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label justifications:

  • P0: The reported supported upgrade leaves the Gateway unavailable until manual service intervention.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 host's MEMBER classification exempts this PR from contributor proof requirements. Its body nevertheless reports published-driver systemd upgrades and displaced-generation rejection covering the changed admission path; these were not independently rerun.

Evidence

What I checked:

  • Current main still needs compatibility admission: Current main compares the retained sentinel root with the discovered root using exact canonical equality. Different pnpm package generations therefore remain distinct. (src/cli/update-cli/update-command-run.ts:545, 9b59fe4ef7da)
  • Latest release retains the rejection: The supplied v2026.9.4 release commit contains the same exact-root check and mismatch error. (src/cli/update-cli/update-command-run.ts:454, 3a9d69db306c)
  • Bounded replacement admission: The introduced check requires discovery to match the loaded package, limits generation equivalence to post-core continuation, compares pnpm installation owners, and rereads the active package target after asynchronous discovery. It does not rewrite the original metadata or lease identity. (src/infra/update-managed-service-handoff.ts:2436, 8794b18711ae)
  • Existing producer repair cannot update released drivers: The current post-core launcher already creates child-specific metadata for the activated root while preserving the helper's identity. The new admission path addresses older running drivers that cannot receive that producer-side change. (src/cli/update-cli/update-command-post-core.ts:371, 8794b18711ae)
  • Command-entry regression coverage: The table exercises legitimate replacement, another valid pnpm installation, an inactive generation, pre-core mismatch, and a moving active link. Rejected cases never reach post-core resume, and the original metadata remains unchanged. Tests were inspected, not executed in this read-only review. (src/cli/update-cli/update-command-post-core-root.test.ts:50, 8794b18711ae)
  • Reported published-driver upgrade observations: The captured PR body reports successful real user-systemd updates from 2026.9.2 and 2026.9.3 on Debian with pnpm 10.28.2 and Node 26.1.0, healthy restored Gateways, unchanged PIDs on subsequent already-current updates, and packaged-CLI rejection after a controlled link displacement. These observations use fresh state; populated schema migration and broader pnpm 11 replacement are explicitly outside the claim. The downloaded images were inspected and belong to the separate session-archival PR, so they were not counted as update proof. (8794b18711ae)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-12T20:20:34.403Z sha 35fc29d :: needs maintainer review before merge. :: none

@obviyus

obviyus commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 146395
head: 8794b18
scope: owner-review

@obviyus
obviyus merged commit 7a42bc7 into main Sep 13, 2026
191 checks passed
@obviyus
obviyus deleted the bugloop/managed-update-handoff-root branch September 13, 2026 02:39
@obviyus

obviyus commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator Author

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 already-current with unchanged Gateway processes.

  • Bug: Package replacement changed the pnpm generation, causing a false root mismatch that left the Gateway stopped.
  • Fix: The handoff verifies the retained installation owner and requires its active package to match the executing generation.
Before After
A verified replacement was rejected and required a manual Gateway start. The update completes and restores the Gateway; foreign installations and inactive generations remain rejected.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

Managed pnpm update leaves Gateway stopped after post-core handoff root mismatch

1 participant