Repository navigation
fix(update): never strand a non-root update on launcher ownership - #164636
Conversation
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.
|
🦞👀 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 3, 2026, 8:46 PM ET / October 4, 2026, 00:46 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +218, Tests +403, Docs +26. Total +647 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat 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
|
…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.
…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)
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, thenopenclaw 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
Package launcher changed outside its publication intent: openclawafter an injected ownership-preservationEPERM.Validation
--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.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:393fails its APFS cold/warm provisioning case. The failing test reproduced independently with diagnostics: the materialized wrapper cannot loadsrc/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.