Repository navigation
fix(update): judge publication identity on the published objects and refuse at admission - #164797
Conversation
Allow writable npm prefix parents owned by another UID while keeping published package entries, launchers, and recovery artifacts strict. Check known objects before staging and candidate-specific launchers before validation, with path and observed/expected UID diagnostics. Preserve source checkouts and unpublished prefix backups. Keep launcher content-based rollback and exact-object publication revalidation. Closes #164672
Integrate b97d4c0 to resolve the required wrapper provisioning gate; publication identity changes remain unchanged.
|
🦞👀 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 October 4, 2026, 2:07 AM ET / 06:07 UTC. ClawSweeper reviewWhat this changesThe PR allows npm updates through writable prefix directories owned by another UID while checking package and launcher ownership earlier and reporting precise refusal details. Merge readiness✅ Ready for maintainer review Keep open: current main still rejects foreign-owned prefix parents, and the linked report establishes a real update failure. No actionable introduced defect was found. Priority: P1 Review scores
Verification
How this fits togetherThe npm updater stages and validates a replacement before publishing its package and launchers. Its publication owner records recovery intent and verifies filesystem identities during publication, rollback, and cleanup. flowchart TD
A[Installed package and npm prefix] --> B[Publication admission]
B --> C[Stage replacement]
C --> D[Check launcher destinations]
D --> E[Validate candidate]
E --> F[Journal-backed publication]
F --> G[Updated installation]
F --> H[Rollback and recovery]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +91, Tests +157, Docs +12. Total +260 across 12 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 publication owner that admits writable prefix parents, strictly verifies published objects, and explains refusals before expensive validation. Do we have a high-confidence way to reproduce the issue? Yes: the linked container reproduction isolates parent UID ownership, and current-main preparation applies the strict UID predicate to those parents. This review verified the source mechanism without executing it. Is this the best way to solve the issue? Yes: the patch separates observed parent directories from owned publication objects and reuses existing admission and filesystem owners without changing the recovery format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d60b0950a2d9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…refuse at admission (openclaw#164797) When the Node prefix's bin/ and lib/node_modules/ were owned by another uid (nvm installed as root), the npm updater aborted at package-swap with 'Package publication object has an unsafe identity' after 5-22 minutes of candidate validation, naming no object or owner. The publication identity predicate now applies to the published objects (package directory, launcher, activation anchor) rather than to writable foreign-owned prefix parents, runs as a cheap stat at admission so a doomed run fails in seconds, and names the object path with observed and expected uid. Foreign-owned package objects, sealed-helper checks, and recovery artifacts stay strict. Closes openclaw#164672.
Closes #164672
What Problem This Solves
Fixes npm updates aborting after full candidate validation when nvm's writable
binandlib/node_modulesprefix directories belong to another UID, even though the OpenClaw package and launcher belong to the updater.Why This Change Was Made
The publication identity owner applied the same UID requirement to published objects and their parents. Parent observations now retain directory/type and device/inode checks without requiring the updater's UID, consistently through preparation, publication, recovery, and retirement. Package, launcher, anchor, and helper ownership checks remain strict and are revalidated at publication.
The existing preflight checks installed package entries and standard launchers before staging. Additional destinations are checked from the staged candidate before validation, using the filesystem owner's shared launcher-name resolver. These ownership checks use filesystem metadata and do not open or write the recovery database or journal. Launcher copying and rollback retain the behavior from #164438 and #164636. No new settings, flags, dependencies, or schema changes.
Thanks to @potterdigital for the detailed nvm/container report and controlled reproduction.
User Impact
Updates can publish through writable foreign-owned prefix parents. Foreign-owned package entries and standard launchers refuse before staging with the object path, observed owner UID, and expected UID. Additional staged launcher destinations refuse before candidate validation. Dry-run preview uses the same admission owner.
This behavior belongs to the installed updater; a staged candidate cannot repair an already-running older driver's checks during the first update hop.
Evidence
Reproduction and regression
Before: the filesystem fixture reached
install → validate → package-swap, then refused with the genericPackage publication object has an unsafe identity. The published v2026.9.8 guard matches the reproduced predicate.After: foreign-owned prefix parents complete journal-backed publication and retirement. Foreign-owned package entries and launchers stop at
package-publication-admission; assertions verify the actual object path and numeric observed/expected UIDs, no candidate validation, and preservation of the original installation. Coverage includes source links, orphan launchers, additional staged names, FreeBSD, untouched launcher backups, ownership preservation, rollback, and changed-target refusal. UID observations are injected for unprivileged CI; filesystem mutations, journal, and executor ownership are real and isolated.Validation
2eedfba204a29ab44871a2c9e72148193c27291a: ownership suite passed 14/14 three times.node scripts/run-vitest.mjs src/infra/package-update-publication-ownership.test.ts --maxWorkers=1; wrapper wall times 16.89 / 18.26 / 14.42 seconds, test times 5.259 / 5.134 / 5.681 seconds. Slowest case: 1.194 seconds.b9f66dc42928237cfabad7174fce7018d01c2d40: 954 passed, 54 platform skips, and the inherited recovery failure below. Batch wall times: 1014.06 / 82.32 / 152.05 / 116.67 / 27.13 seconds. The first batch included 13m33s of shared runtime compilation, separate from test time.node scripts/check-changed.mjs --base b97d4c03f364d244db687b372930c29759a45cc9 --head HEAD --timed: passed on the final head, including all 27 core-test typecheck graphs.Inherited findings and causation
main-side: fails with the fix fully reverted; ctime-only drift of operation.sqlite in sqlite-rollback-recovery.ts. The recovery file initially passed 19/19 alone three times. A later isolated failure prompted the revert comparison. Metadata diagnostics captured candidate outcomes pass/fail/pass and reverted-baseline outcomes pass/fail. The reverted source matched the exact landed prerequisite tree before instrumentation. The baseline failure took 5.228 seconds: only database ctime changed between authority callbacks around the writable SQLite open; device, inode, mtime, size, journal fingerprint, and contents stayed unchanged. The lead owns the separate main-side investigation and authorized continuation. The recovery guard remains unchanged; all temporary diagnostics were removed.
provisioning guard: known main-side (FIX1). Its initial missing-runtime failure was resolved here by integrating the already-landed prerequisite #164706 (
b97d4c03f364d244db687b372930c29759a45cc9), before the later waiver. No separate provisioning fix is included in this PR's diff. All provisioning cases then passed except one platform skip.Slow pre-existing suites (waived)
src/cli/update-cli/update-command-post-core-admission.process.test.ts,resumes a published package, refuses unowned continuations, and retains unconfirmed results: earlier remote snapshot 31.047 seconds test time, plus 6.645 seconds fixture preparation; local publication-candidate run 20.558 seconds. Earlier remote results are historical, not final-head validation.test/scripts/pr-worktree-provision.test.ts: APFS cold/warm and sparse-transition case passed in 112.401 seconds; file test time 349.819 seconds.No timeout, retry, skip, or weaker assertion was added for either duration.
Change size
Production +133/-42; tests +157/-0; documentation +12/-0. Total +302/-42 across 12 files. No new production module or test file.