Skip to content

fix(update): skip absent package-manager probes instead of reporting a broken database - #173155

Closed
xiaopan-xydt wants to merge 1 commit into
openclaw:mainfrom
xiaopan-xydt:fix/update-absent-pacman-guidance-173084
Closed

xiaopan-xydt wants to merge 1 commit into
openclaw:mainfrom
xiaopan-xydt:fix/update-absent-pacman-guidance-173084

Conversation

@xiaopan-xydt

Copy link
Copy Markdown
Contributor

Closes #173084

What Problem This Solves

On a Linux host that has never installed pacman, openclaw update tells the operator to repair a pacman database that does not exist. The updater now recognises that an absent package-manager executable is not a failed database query, so it stops printing Arch-specific recovery advice on hosts such as Debian.

  • Problem: src/infra/update-system-package-ownership.ts maps every Linux ownership probe to pacman. When the pacman executable is missing, the launch failure (ENOENT) is reported as pacman-ownership-unavailable, whose message reads "Restore access to the active pacman database and configuration, then retry."
  • Solution: when the probe cannot be launched because the executable is absent (ENOENT), treat it as "this optional manager is not installed here" and return an empty inventory before the query validation runs. A manager that is not installed cannot own files, so there is no database to restore and no inventory to compare.
  • What changed: src/infra/update-system-package-ownership.ts (+13/-1); regressions added to src/infra/update-freebsd-pkg-ownership.test.ts and src/cli/update-cli/update-command-freebsd-pkg.test.ts.
  • What did NOT change: confirmed-owner refusal still throws pacman-owned-install / pkg-owned-install; a real query failure (timeout, non-zero exit, unreadable output) still warns and continues; no distribution detection and no new package-manager subsystem.

Why This Change Was Made

A launch error and a query error were funnelled into one diagnostic, so an optional manager that is simply not installed was reported like a broken database. Separating them at the launch site preserves the existing admission contract: the update continues either way, and only a confirmed ownership match still skips replacement.

  • Best fix: yes — a focused correction inside the existing inspector, which is the shape the issue's triage asked for.
  • Alternative: probing command -v pacman (an extra process per inspection) or adding dpkg/rpm support. Rejected: absence is already observable from the failed launch, and per-distribution managers are a separate feature.
  • Risk / non-goals: a host whose PATH hides an installed manager now proceeds without a warning; that needs a PATH without /usr/bin, where the manager still cannot own the inspected files. FreeBSD /usr/sbin/pkg shares the same code path.

User Impact

Debian (and other non-Arch) npm-global operators no longer see pacman database guidance during an update that has nothing to do with pacman. On hosts where the manager is genuinely installed, behaviour is unchanged, including the refusals that protect package-owned files.

Evidence

command -v pacman prints nothing on this Debian host, matching the reported environment.

Before the fix — real openclaw update entry point, two ownership inspections (target + admission):

$ node --import ./scripts/tsx.mjs src/index.ts update --dry-run --yes
[update] pacman inspection failed during pacman query (ENOENT). pacman ownership could not be verified. Restore access to the active pacman database and configuration, then retry. Continuing without verified system-package ownership.
[update] <same pacman warning repeated for the second inspection>
Phase: requested
...
Update safety checks ran in the installed updater.
Phases: requested (51.91s) -> staging (37ms) -> validating (1.1s)

After the fix — identical command on the same host; zero pacman/ownership lines remain:

$ node --import ./scripts/tsx.mjs src/index.ts update --dry-run --yes
Phase: requested
[plugins] Bundled plugin ollama identity unavailable: plugin runtime artifact contains unsupported symlink entry
Phase: staging
Phase: validating
...
Update safety checks ran in the installed updater.
Phases: requested (57.78s) -> staging (28ms) -> validating (1.1s)

Both transcripts counted for pacman|ownership: before = 2 lines, after = 0 lines.

Regression matrix, pnpm test src/infra/update-freebsd-pkg-ownership.test.ts src/cli/update-cli/update-command-freebsd-pkg.test.ts --maxWorkers=1:

scenario before fix after fix
linux, manager executable absent (ENOENT) FAIL: warns to restore the pacman database PASS: admitted silently
freebsd, /usr/sbin/pkg absent (ENOENT) FAIL: same warning, for pkg PASS: admitted silently
linux CLI admission, pacman absent FAIL: warning emitted PASS: admits npm, no warning
linux, launch error other than ENOENT (EACCES) PASS PASS: still warns and continues
linux, query timeout PASS PASS: unchanged
linux/freebsd, confirmed package owner PASS: refuses *-owned-install PASS: unchanged

Final run of those two files: Tests 14 passed (14) (infra shard) and Tests 12 passed (12) (cli shard), [test] passed 2 Vitest shards.

Not tested: no host with a real pacman database was available here, so the confirmed-pacman-owner path is covered by the existing mocked regressions only. pnpm check:changed was run as well: oxfmt --check and git diff --check are clean; the command still exits non-zero on a pre-existing stale config/max-lines-baseline.txt entry for src/channels/plugins/bundled.shape-guard.test.ts, which exists on origin/main and is untouched by this PR.

AI Assistance 🤖

This PR is AI-assisted. Used grep, git diff, and node --import tsx to trace the reported warning from the issue transcript to src/infra/update-system-package-ownership.ts, and vitest to reproduce it before and after the fix. The implementer understands the code: a spawn ENOENT means the optional manager is not installed, so its inventory is empty and no database-restore guidance applies. All evidence above is from real local runtime execution.

…a broken database

On a Linux host without pacman (Debian, Fedora, ...), the ownership probe
could not be launched and the launch error was reported as a database
failure, so update told the operator to restore the active pacman
database and configuration.

A manager that is not installed cannot own files: its inventory is empty,
there is no database to restore, and no recovery guidance applies. Treat
the absent executable as an empty inventory and keep warning-and-continue
for genuine launch or query failures.

Closes openclaw#173084
@clawsweeper

clawsweeper Bot commented Oct 15, 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.

@xiaopan-xydt
xiaopan-xydt marked this pull request as ready for review October 15, 2026 13:05
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Oct 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close this PR as superseded by #173118, which fixes the same misleading guidance, preserves the documented warning policy, and has relevant CLI proof and passing exact-head CI.

Root-cause cluster
Relationship: superseded
Canonical: #173118
Summary: The proven diagnostic-only replacement owns the same missing-package-manager warning correction.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Consolidate on the proven diagnostic-only replacement while preserving warnings for unavailable ownership inspection.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Consolidate on the proven diagnostic-only replacement while preserving warnings for unavailable ownership inspection.

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

Current-main source deterministically turns Linux probe ENOENT into database-restoration guidance, matching the reporter's Debian transcript; this review executed no target code.

Is this the best way to solve the issue?

Correcting the diagnostic in the existing inspector solves the reported problem while preserving its documented policy; suppressing the warning is an unnecessary behavioral change.

Security review:

Security review cleared: The patch changes diagnostic handling without adding execution sources, permissions, credential access, or cross-principal authority.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • Vincent Koc: Raw commit dfaec13 adds src/cli/update-cli/update-command-freebsd-pkg.test.ts:72 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dfaec136991a; files: src/cli/update-cli/update-command-freebsd-pkg.test.ts)

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

@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

@clawsweeper clawsweeper Bot closed this Oct 15, 2026
@xiaopan-xydt
xiaopan-xydt deleted the fix/update-absent-pacman-guidance-173084 branch October 24, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Debian npm update tells the operator to restore the pacman database

1 participant