Skip to content

fix(update): never strand a non-root update on launcher ownership - #164636

Merged
steipete merged 1 commit into
mainfrom
upd/upd-launcher-wheel-group-self-poison
Oct 4, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-launcher-wheel-group-self-poison

Conversation

@steipete

@steipete steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Closes #164422

What Problem This Solves

Fixes non-root macOS package updates that reject their own launcher backup ownership, block rollback, and leave later updates behind update-recovery-pending.

Why This Change Was Made

The launcher backup's uid/gid had replaced the live baseline in the publication journal. #164438 made backup comparisons content-based, but publication and retirement still required exact ownership metadata. Keep the live baseline and compare admitted launcher content and executable mode without requiring reproducible uid/gid. New links preserve the existing launcher's ownership when possible and fall back to the updater's effective uid/gid after a permission refusal.

For an already-stranded installation, the supported recovery is the manual npm installation hop followed by Doctor/repair from the new CLI at the same root. If the installed directory matches neither recorded package generation, the publication owner records superseded-by-manual-install, preserves the obsolete candidate and helper, and clears the package gate. Same-identity recovery retains the original sealed-helper checks.

User Impact

Future non-root updates can publish and roll back despite an unpreservable launcher group. Operators already affected can use npm install -g openclaw@latest, then openclaw doctor --fix / openclaw update repair, following the documented backup and managed-Gateway stop precautions.

Repair warns with the prior package operation ID. Its supersession reason and replacement-identity fact are stored in the existing one-operation journal; the original failed history entry stays unchanged because released journals do not carry a reliable history run ID. No flags, environment controls, dependencies, SQLite columns, or schema-version changes are added. The new terminal journal state deliberately disarms older helpers; it does not bypass active owners or database/configuration recovery.

Thanks to @hrp6vv9mwr-glitch for the detailed report and recovery evidence.

Evidence

Reproduction and behavior

  • A non-root macOS fixture with distinct real group IDs reproduced Package launcher changed outside its publication intent: openclaw after an injected ownership-preservation EPERM.
  • Reverting only the launcher creator reproduced two gid assertions: inherited gid 12 instead of the updater's gid 20. The fixed creator preserves usable ownership or applies the effective uid/gid.
  • Removing the new repair call reproduced the old-helper admission refusal after a manual package replacement.
  • Regressions exercise publication, failed-publication rollback, changed-target refusal, same-generation refusal, manual-hop closure, subsequent package preparation, active executor exclusion, interrupted archive acknowledgements, and concurrent replacement.

Validation

  • Touched suites passed three times on the final source (11 tests per run). Final per-file Vitest times with --maxWorkers=1: publication ownership 3.114 s tests / 12.72 s wall; manual-hop repair 3.508 s tests / 8.54 s wall. Combined wrapper wall times were 73.57 s, 23.20 s, and 24.35 s; shared compiler preparation dominated the first run.
  • 46 importer/swap-sibling files ran in four sequential batches of at most 15: 812 tests passed, with 54 existing platform-specific skips across three files.
  • Eager import closure, wrapper source closure, and all four CI planner suites passed. Export-name collisions and the restart-swap fixture passed.
  • Direct-route Codex P1 autoreview: scoped-clean on the final source. The earlier importer run caught a mode-check regression; the canonical comparison was corrected and the unchanged regression passed in the final run.
  • node scripts/check-changed.mjs: passed, including core/test typechecks, lint, formatting, all ratchets, native schema guard, dead exports, and runtime import cycles. Hosted CI has not yet supplied durations.

Blocking required tooling gate

This PR remains draft because test/scripts/pr-worktree-provision.test.ts:393 fails its APFS cold/warm provisioning case. The failing test reproduced independently with diagnostics: the materialized wrapper cannot load src/state/openclaw-state-worker-runtime.ts, so it falls back to Git checkout and creates no filesystem template. The source and wrapper inventory on this branch already had that lazy-runtime omission before this change. A direct native probe confirms APFS and no inherited ACL blocker on this host.

The required seven-file closure/planner run had 160 passing tests, one failing test, and one existing skip. The missing shared-state runtime has at least 25 absent direct imports; adding that entire graph is not part of this updater fix. The owning repair should route template operations through a narrow typed worker closure before loading the broad runtime, preserve worker admission/settlement, and then rerun the existing APFS gate. No assertions were weakened and the temporary diagnostic edit was removed.

Slow pre-existing suites (waived)

  • src/cli/update-cli/update-command-original-service.test.ts: 54 tests passed; 244.039 s summed test time, 254.63 s Vitest wall, 262.31 s wrapper wall; longest case 13.552 s. Unchanged suite, covered by the standing slow-suite waiver.
  • test/scripts/pr-worktree-provision.test.ts: 257.834 s suite time in the required tooling run. Its runtime is waived; its failed assertion above is not waived.

Change size

Production: +233/-15 lines. Tests: +403/-0. Docs: +26/-0. Total: +662/-15 across 12 files.

Keep live launcher fingerprints separate from backup metadata, preserve usable
ownership or fall back to the updater's effective uid/gid, and retain content,
mode, and exact-object checks during publication and rollback.

After a manual package replacement, update repair closes the obsolete package
operation as superseded-by-manual-install and preserves its recovery evidence
under fresh executor authority. Same-generation recovery retains its sealed
helper checks. Document the manual npm installation hop for existing failures.

Refs #164422.
@clawsweeper

clawsweeper Bot commented Oct 4, 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 docs Improvements or additions to documentation cli CLI command changes size: L labels Oct 4, 2026
@steipete
steipete marked this pull request as ready for review October 4, 2026 00:40
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 8:46 PM ET / October 4, 2026, 00:46 UTC.

ClawSweeper review

What this changes

The PR fixes non-root launcher publication and rollback, and lets update repair preserve obsolete recovery artifacts after a manual package replacement.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: this addresses a demonstrated update failure that remains on main, beyond the earlier merged launcher fix. No concrete introduced correctness defect was found, but released-updater recovery compatibility still needs verification.

Priority: P1
Reviewed head: c5aac2c90383448556c5e305c615e5df44d90840

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation has useful boundary coverage and no identified defect, but the independent upgrade-proof requirement remains open.
Proof confidence 🌊 off-meta tidepool Not applicable: The provided repository state identifies a trusted member author, so the ordinary external-contributor proof gate is exempt. Reported macOS filesystem fixtures exercise publication and rollback, and public-repair tests exercise archival and executor exclusion; independently, compatibility of the new persisted state with a released-updater operation remains unverified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The provided repository state identifies a trusted member author, so the ordinary external-contributor proof gate is exempt. Reported macOS filesystem fixtures exercise publication and rollback, and public-repair tests exercise archival and executor exclusion; independently, compatibility of the new persisted state with a released-updater operation remains unverified.
Evidence reviewed 8 items Pinned introduction and current-main necessity: The introduced delta adds content-and-mode launcher comparison and manual-install supersession. Comparing the pinned head with fetched main confirms these changes remain absent from main; the earlier merged launcher work does not supersede this PR.
Observed user failure and recovery discussion: The reporter supplied publication and rollback failures, then confirmed that helper repair, retirement, and public repair were unreachable for the prepared operation. Their follow-up describes manual artifact removal followed by a successful update, supporting the need for a safe recovery surface: #164422 (comment).
Recovery authority and preservation: Supersession acquires a fresh executor, admits journal recovery under its current fence, rechecks the journal and replacement directory, and archives exact recorded objects. Same-generation recovery retains its existing refusal path. The new tests cover active-executor exclusion, interrupted transfers, and concurrent replacement.
Findings None None.
Security None None.

How this fits together

The package updater stages a replacement installation, publishes its launchers, and retains recovery evidence for rollback. Update repair reconciles that evidence before subsequent updates can proceed.

flowchart TD
  A[Installed package and launchers] --> B[Stage replacement package]
  B --> C[Publication journal]
  C --> D[Publish or roll back]
  E[Manual package replacement] --> F[Update repair]
  C --> F
  F --> G[Preserve obsolete recovery evidence]
  G --> H[Allow subsequent updates]
Loading

Before merge

  • Resolve merge risk (P1) - Recovery from a journal and sealed helper produced by the published 2026.9.7 or 2026.9.8 updater remains unverified; current-code fixtures alone do not establish the documented manual-install upgrade path.
  • Resolve merge risk (P1) - The PR body still identifies an unwaived APFS provisioning assertion failure as a required tooling gate; its repair or native inherited-failure disposition remains unrecorded.
  • Complete next step (P2) - Record the published-updater × candidate recovery verification, and settle the explicitly unwaived APFS assertion gate through the native workflow.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +218, Tests +403, Docs +26. Total +647 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 8 233 15 +218
Tests 2 403 0 +403
Docs 2 26 0 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 662 15 +647

Review metrics

Metric Value Why it matters
Recovery journal contract 1 new terminal phase; 1 new intent; 0 SQL column changes Persisted recovery semantics change even though the database layout stays unchanged.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/package-update-activation.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify released-operation recovery (recommended)
    Use an isolated operation produced by the published updater to demonstrate manual replacement, candidate repair, retained evidence, old-helper disarming, and admission of the next update.

Technical review

Best possible solution:

Keep recovery in the publication owner, preserve obsolete evidence, and verify that a released updater's stranded operation can safely reach the next successful update.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source compares encoded launcher ownership that backup copying can change, matching the reporter's publication and rollback failures. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes: retaining live fingerprints and repairing through the existing publication owner is a focused solution. Its released-updater recovery path still needs the required upgrade verification.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ca267fa035f8.

Labels

Label changes:

  • add P1: The linked report demonstrates non-root macOS updates failing rollback and blocking subsequent update attempts.
  • add merge-risk: 🚨 compatibility: The new persisted supersession state needs released-operation recovery proof; intentional disarming of older helpers is explicitly documented.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The provided repository state identifies a trusted member author, so the ordinary external-contributor proof gate is exempt. Reported macOS filesystem fixtures exercise publication and rollback, and public-repair tests exercise archival and executor exclusion; independently, compatibility of the new persisted state with a released-updater operation remains unverified.

Label justifications:

  • P1: The linked report demonstrates non-root macOS updates failing rollback and blocking subsequent update attempts.
  • merge-risk: 🚨 compatibility: The new persisted supersession state needs released-operation recovery proof; intentional disarming of older helpers is explicitly documented.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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 provided repository state identifies a trusted member author, so the ordinary external-contributor proof gate is exempt. Reported macOS filesystem fixtures exercise publication and rollback, and public-repair tests exercise archival and executor exclusion; independently, compatibility of the new persisted state with a released-updater operation remains unverified.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record recovery through the candidate CLI using an operation and sealed helper produced by a published updater.
  • Resolve the expressly unwaived APFS assertion gate through its owner or the native inherited-failure workflow.

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.

@steipete
steipete merged commit 68d4dc6 into main Oct 4, 2026
204 of 205 checks passed
@steipete
steipete deleted the upd/upd-launcher-wheel-group-self-poison branch October 4, 2026 00:55
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…enclaw#164636)

A previous non-root update created the global launcher symlink with group wheel; the next update could not preserve that ownership, the package-swap publication check hard-failed, the failure blocked its own rollback, stranded the prepared anchor, and left update-recovery-pending gating every later update. Launcher creation now preserves existing ownership when possible and otherwise uses the updater's effective uid/gid; ownership-only differences pass publication and rollback while target/content differences still refuse; after a manual npm reinstall, update repair records the stale pending recovery as superseded-by-manual-install, keeps the recovery evidence, and clears the package gate. Closes openclaw#164422. Thanks @hrp6vv9mwr-glitch for the detailed report.
RomneyDa pushed a commit that referenced this pull request Oct 6, 2026
…64636)

A previous non-root update created the global launcher symlink with group wheel; the next update could not preserve that ownership, the package-swap publication check hard-failed, the failure blocked its own rollback, stranded the prepared anchor, and left update-recovery-pending gating every later update. Launcher creation now preserves existing ownership when possible and otherwise uses the updater's effective uid/gid; ownership-only differences pass publication and rollback while target/content differences still refuse; after a manual npm reinstall, update repair records the stale pending recovery as superseded-by-manual-install, keeps the recovery evidence, and clears the package gate. Closes #164422. Thanks @hrp6vv9mwr-glitch for the detailed report.

(cherry picked from commit 68d4dc6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant