Repository navigation
fix(update): skip pacman-owned installations - #169055
Conversation
|
🦞👀 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 changes before merge. What this changesThis PR shares pacman and FreeBSD pkg ownership inspection and skips confirmed package-owned installations with package-manager guidance. Example: Run openclaw update for pacman-owned /usr/lib/node_modules/openclaw.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 2 items remain This PR addresses a concrete upstream bug, but the prior Linux mutation-boundary finding remains unresolved and current-head CI exposes additional cleanup-fixture failures. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCLI and Gateway update admission inspect installation ownership before selecting package or Git update paths; staging, publication, rollback, and cleanup consume those ownership checks. flowchart TD
A[CLI or Gateway update request] --> B[System package ownership inspector]
B --> C[Confirmed owner guidance]
B --> D[Existing package or Git updater]
D --> E[Staged candidate validation]
E --> F[Package and launcher publication]
F --> G[Rollback or verified cleanup]
Technical reviewBest possible solution: Use the shared inspector at Linux activation and rollback boundaries while preserving the recorded best-effort policy and package-manager guidance. Do we have a high-confidence way to reproduce the issue? The report's pacman ownership and EACCES traces match current main's missing pacman admission check; the remaining mutation defect is source-reproducible and the cleanup-fixture failures are observed in current-head CI. Is this the best way to solve the issue? Sharing the existing native-package inspector is appropriate, but its Linux callers must include activation and rollback; read-only status and npm availability remain outside this patch. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 568123918941. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +30, Tests +88, Docs +9, Other -2. Total +125 across 31 files. Added test files: 0. 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. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 11, 2026, 8:11 AM ET / 12:11 UTC (Revision 4). |
Share system package ownership admission between FreeBSD pkg and pacman, including the existing staging, activation, rollback, and cleanup checks. Return package-manager guidance without attempting npm replacement. Reuse seeded Git test fixtures instead of cloning per case, and model absent pacman in the shared Linux CLI transport fixture. Fixes #157338 Supersedes #157428 Co-authored-by: Sahil Satralkar <[email protected]>
Keep system-package refusals in the shared UpdatePreMutationError contract. Move that contract below the CLI to avoid a dependency cycle, and expose probe and warning injection at the ownership boundary. Continue updates with a warning after unavailable ownership inspection, while preserving confirmed-owner refusals and uncertain backup retention. Make the failing Linux fixtures explicit under both Node and Bun, and remove their two obsolete closed-mock baseline entries.
01d7090 to
1dff3fc
Compare
Continue obsolete-backup cleanup after inconclusive package-manager probes while retaining fresh ownership checks, filesystem identity checks, and cleanup budgets. Exercise missing and failing pacman probes at the cleanup and retained-runtime boundaries.
…an and FreeBSD pkg) (openclaw#169055) openclaw update only recognized FreeBSD pkg ownership, so Arch/pacman-packaged installs could be overwritten by npm. One shared system-package owner check now covers FreeBSD pkg and pacman: confirmed ownership skips with package-manager guidance, an inconclusive probe warns and continues without affecting backup cleanup. Production net negative. Fixes openclaw#157338. Supersedes openclaw#157428, thanks @sahilsatralkar.
…an and FreeBSD pkg) (#169055) openclaw update only recognized FreeBSD pkg ownership, so Arch/pacman-packaged installs could be overwritten by npm. One shared system-package owner check now covers FreeBSD pkg and pacman: confirmed ownership skips with package-manager guidance, an inconclusive probe warns and continues without affecting backup cleanup. Production net negative. Fixes #157338. Supersedes #157428, thanks @sahilsatralkar. (cherry picked from commit 5d9a5ff) Release-branch adaptation: createUnexpectedUpdateFailureResult stays synchronous because this branch records update-run diagnostics through the synchronous ledger; the owned-install skip is unchanged from main.
What Problem This Solves
Fixes npm update attempts against pacman-owned OpenClaw installations, which can fail with EACCES while staging under
/usr/lib/node_modules.Fixes #157338. Supersedes #157428, thanks @sahilsatralkar.
User Impact
openclaw updateskips package-owned installations with guidance to usepacman -Syuor the owning AUR helper. FreeBSD pkg installations use the same protection and retain their pkg/Ports guidance. Package replacement and service handoff do not start for a verified system-package owner; inconclusive or unavailable inspections log a warning and continue. Only confirmed system-package ownership refuses OpenClaw-managed replacement. Missing or failing package-manager probes warn and preserve normal backup cleanup; confirmed ownership and real filesystem/identity failures retain the affected backups.Older installed updaters must receive this fix through their system package manager first. Read-only update status may still advertise a newer upstream npm release; applying it now skips safely rather than attempting installation.
Why This Change Was Made
One table-driven system-package owner replaces the FreeBSD-specific error and inspection path throughout update admission, staging, activation, rollback, and cleanup. The existing bounded ownership inventory and symlink-entry protections are shared by pkg and pacman. Unavailable or failed probes leave ordinary installations on their existing update path, with a warning. The probe and warning sink are injectable, so tests do not rely on the host package manager. System-package refusals inherit the shared
UpdatePreMutationErrorcontract, preserving its name, reason, and failure facts without a CLI import cycle.Cached ancestor resolution, shared platform-independent cleanup checks, and removal of a one-use layout wrapper offset the new owner support: production +407/-402 lines (net +5); tests/support +391/-256 (net +135). The latest cleanup correction removes 25 production lines and adds 47 test lines net; the remaining production growth is the shared error contract and injected probe/warning boundary. Two obsolete closed-mock baseline entries were removed. Release-note context: update reliability on Arch-based pacman installations; preserves FreeBSD file ownership; credited contributor @sahilsatralkar.
Evidence
Cleanup correction
79cb01a77366e875168ea473c9fb9e60ee763fecfor the six failures on rebased head1dff3fccb2d529ecdf96515eb2df383e7f0e03e1(CI run): package-owner inspection warnings were incorrectly treated as a reason to stop cleanup. On Linux without pacman, this retained obsolete rename/backup directories, replaced identity advisories, and could turn a staging assertion into a package-update error. Both cleanup owners now use the shared warning-and-continue contract. Fresh ownership checks still run before each deletion; confirmed ownership, changed filesystem identities, and cleanup budgets keep their protections.package-update-steps.transaction.test.ts(interleaved staging cleanup),package-update-steps.test.ts(direct node_modules root),package-update-swap.test.ts(replacement/late/unrelated artifact retention),update-global.test.ts(rename cleanup), and both symlink/directory cases inupdate-retained-runtime.backups.test.ts.f49b7cd0eb5f078c57cb44a08d160deccb87da26(71 tests, 31.69s) and on the macOS head (71 tests, 15.35s). Injecting Linux plus missing/failed pacman into the existing cleanup and retained-runtime tests produced six failures on the old head (27.44s), while the same tests passed on the pinned base (36 tests, 31.12s). These regressions never call the host package manager.check:changedpassed core production types and all 28 test-type graphs, ratchets, formatting, and preceding guards. Its dead-export scan failed on 19 unchanged UI/subagent exports; the exact same 19 full-tree findings were reproduced on pinned basef49b7cd0eb5f. The remaining targeted lint, schema/storage, sidecar, and import guards were run separately. Madge reported zero cycles;git diff --checkis clean. No baseline or suppression was added.Earlier-head evidence
Follow-up
01d70900cf84b50d2a9aa9e3dc0e2de179b7e8dafor the failed Bun CI shard: bothshared.command-runner.test.tsandupdate-command-target.n1-prefix.test.tsomitted the buffered ownership probe from their exec mocks. Both files now force the Linux path with explicit probe results: a deterministic query failure for the shared helpers and an unowned inventory for target selection. This preserves the intended Homebrew/unmanaged-install refusal and package-root selection. Both mocks preserve real exports. Positive ownership still blocks replacement; query, launch, timeout, and path-inspection failures warn once and continue.shared.command-runner.test.ts(28 passed), matching the CI failure. The CI log also identified seven affected cases in the N1-prefix file.UpdatePreMutationErroridentity/name/reason for positive owners, and cover warning-and-continue behavior through CLI and RPC admission.check:changedpassed, including production types, all 28 core test-type groups, core/script lint, mock-export and other ratchets, unused-export checks, and runtime import-cycle checks. Static import-cycle checking reported zero cycles;git diff --checkpassed.Original-head validation (8d6a96b4)
npminstead of rejecting the system-owned root; the FreeBSD control passed.--maxWorkers=1. The previously failing case went from an 8.85-second setup failure to a 1.66-second pass; these are observations under different host load, not a controlled benchmark. No timeout or retry increase.Existing slow-test observations
The initial broad run exercised existing install/recovery compositions. These passed but exceeded 30 seconds under host load; no timeout, retry, or assertion was weakened. Runtime compilation also took 8m 43.5s before this test batch and is separate from test time.