Skip to content

fix(update): judge publication identity on the published objects and refuse at admission - #164797

Merged
steipete merged 2 commits into
mainfrom
upd/upd-publication-identity-prefix-owner
Oct 4, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-publication-identity-prefix-owner

Conversation

@steipete

@steipete steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Closes #164672

What Problem This Solves

Fixes npm updates aborting after full candidate validation when nvm's writable bin and lib/node_modules prefix 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 generic Package 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

  • Final head 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.
  • All 65 direct/barrel importer and sibling files were exercised in sequential batches of at most 15 on publication commit 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.
  • Required wrapper tests on the integrated tree: 36 passed, 1 platform skip across eager-import closure, wrapper-source closure, and worktree provisioning (377.21 seconds wrapper wall time). Export-name collision guard and update/restart swap fixture passed.
  • Fresh independent Codex review through P1 of the integrated candidate: scoped-clean, no actionable findings.
  • Final-head 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.

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.
@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: M labels Oct 4, 2026
@steipete
steipete marked this pull request as ready for review October 4, 2026 06:01
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 2:07 AM ET / 06:07 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: 2eedfba204a29ab44871a2c9e72148193c27291a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary regressions, documented installed-driver limitations, and no actionable correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER association exempts ordinary contributor proof. The captured body reports production update and journal fixture passes with injected UID observations; these are supplemental validation, not a live nvm update. No unresolved cross-principal authority violation was established, and the persisted journal contract is unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts ordinary contributor proof. The captured body reports production update and journal fixture passes with injected UID observations; these are supplemental validation, not a live nvm update. No unresolved cross-principal authority violation was established, and the persisted journal contract is unchanged.
Evidence reviewed 10 items Pinned introduction and merge result: Inspected the merge-base-to-head introduced diff. The raw test-merge commit records the pinned base followed by the exact PR head; its identity-check change matches the introduced patch.
Still necessary on current main: The fetched main implementation still applies the updater UID requirement to directories and launchers alike. The supplied latest-release context identifies v2026.9.8; its source blob could not be independently retrieved, so no release-fix claim is made.
Controlled reporter reproduction: #164672 records a Debian container update failing after 326 seconds, then succeeding after changing only the two prefix-directory owners. The package and launcher already belonged to the updater.
Findings None None.
Security None None.

How this fits together

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

Before merge

None.

Agent review details

Security

None.

PR surface

Source +91, Tests +157, Docs +12. Total +260 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 10 133 42 +91
Tests 1 157 0 +157
Docs 1 12 0 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 302 42 +260

Review metrics

Metric Value Why it matters
Production versus regression coverage production +133/-42; tests +157/-0 Production growth implements shared early admission and actionable diagnostics without adding a competing publication owner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164672
Summary: This PR directly targets the reported prefix-parent UID failure; the earlier launcher fixes address distinct mechanisms.

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

Labels

Label changes:

  • add P1: The linked controlled reproduction establishes a broken npm update workflow that wastes substantial validation time on affected installations.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; 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 supplied MEMBER association exempts ordinary contributor proof. The captured body reports production update and journal fixture passes with injected UID observations; these are supplemental validation, not a live nvm update. No unresolved cross-principal authority violation was established, and the persisted journal contract is unchanged.

Label justifications:

  • P1: The linked controlled reproduction establishes a broken npm update workflow that wastes substantial validation time on affected installations.
  • 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 supplied MEMBER association exempts ordinary contributor proof. The captured body reports production update and journal fixture passes with injected UID observations; these are supplemental validation, not a live nvm update. No unresolved cross-principal authority violation was established, and the persisted journal contract is unchanged.

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)

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 f0af328 into main Oct 4, 2026
200 of 201 checks passed
@steipete
steipete deleted the upd/upd-publication-identity-prefix-owner branch October 4, 2026 06:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…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.
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 P1 High-priority user-facing bug, regression, or broken workflow. 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

1 participant