Skip to content

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

Closed
sunlit-deng wants to merge 1 commit into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-173084
Closed

sunlit-deng wants to merge 1 commit into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-173084

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the pacman ownership warning telling Debian operators to restore a database when the pacman executable is missing during an npm-global update.

Why This Change Was Made

An ENOENT from the package ownership query means the executable could not be found. The diagnostic now reports that condition separately; other ownership database failures keep their current recovery guidance.

User Impact

Debian npm-global updates no longer direct operators to repair an unrelated pacman database. Ownership inspection still warns and continues, while confirmed package ownership still blocks replacement.

Evidence

Testing

  • Regression test: node_modules/.bin/vitest run src/infra/update-freebsd-pkg-ownership.test.ts --maxWorkers=1 (12 tests passed).
  • Shipped updater proof: an isolated Debian 12 (bookworm) container with Node 24.18.0 and no pacman ran openclaw update --channel beta --yes --no-restart --json from PR head 615ef0e757fade741b8fede739970171a3d3cfda. It printed the corrected missing-executable warning, continued into npm installation of [email protected], completed candidate checks and Doctor, and exited 0. The npm debug log showed the target install exiting 0; the candidate report marked config, database schema, Node runtime, and plugin availability ok. Temporary state/config paths caused service management to be skipped.
  • The isolated install fixture used the PR-head source and dist unchanged. To work around a container registry reset while resolving npm metadata, it localized only the workspace @openclaw/ai package reference and the [email protected] dependency to local tarballs; the updater's beta target install ran through npm.
  • Supplemental production boundary smoke: node_modules/.bin/tsx proof-smoke.mts <repo-root> exercised createSystemPackageOwnershipInspection().assertUnowned through runCommandBuffered to a real pacman launch. Both runs used Linux platform selection with no pacman executable; the pinned base and exact head were tested with identical inputs. The confirmed-owner negative control stayed blocking.
  • Canonical contract: docs/cli/update.md says failed ownership inspection warns and continues; only confirmed package ownership prevents replacement.
$ node_modules/.bin/vitest run src/infra/update-freebsd-pkg-ownership.test.ts --maxWorkers=1
Test Files  1 passed (1)
     Tests  12 passed (12)

$ node_modules/.bin/tsx proof-smoke.mts <repo-root>
base dd9cdee4d3b350807631c6825058a011069071fe: 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.
head 615ef0e757fade741b8fede739970171a3d3cfda: pacman inspection failed during pacman query (ENOENT). pacman executable was not found. Package ownership could not be verified. Continuing without verified system-package ownership.
negative-control: confirmed owner blocked on base and head (confirmedOwnerNegativeControlBlocked=true)

$ openclaw update --channel beta --yes --no-restart --json
os=Debian GNU/Linux 12 (bookworm)
node=v24.18.0
pacman=absent
[update] pacman inspection failed during pacman query (ENOENT). pacman executable was not found. Package ownership could not be verified. Continuing without verified system-package ownership.
candidate-doctor: doctor --fix --non-interactive --no-workspace-suggestions
candidate-doctor-lint: doctor --lint --json --severity-min error
candidate-config: config validate --json
candidate-plugins: plugins list --json
candidate-recovery: --check
candidate-gateway-startup: gateway run
└  Doctor complete.
"candidateVersion": "2026.10.5-beta.4"
"checks": [{"name":"config","status":"ok"},{"name":"database-schema","status":"ok"},{"name":"node-runtime","status":"ok"},{"name":"plugin-availability","status":"ok"}]

The CLI exited 0. Its npm debug log showed npm i --global ... [email protected] ending with exit 0. Service management was skipped because the container used a temporary state/config path.

Production proof source
import { strict as assert } from "node:assert";
import path from "node:path";
import { pathToFileURL } from "node:url";

const repoPath = process.argv[2] ?? process.env.OPENCLAW_REPO_PATH;
if (!repoPath) throw new Error("OPENCLAW_REPO_PATH is required");

const originalPlatform = Object.getOwnPropertyDescriptor(process, "platform");
if (!originalPlatform?.configurable) {
  throw new Error("process.platform cannot be temporarily set for the Linux boundary smoke");
}
Object.defineProperty(process, "platform", { configurable: true, value: "linux" });

try {
  const moduleUrl = pathToFileURL(
    path.join(repoPath, "src/infra/update-system-package-ownership.ts"),
  ).href;
  const { createSystemPackageOwnershipInspection } = await import(moduleUrl);
  const root = "/tmp/openclaw-event-probe-install";
  const warnings: string[] = [];
  await createSystemPackageOwnershipInspection(2_000, {
    onWarning: (message) => warnings.push(message),
  }).assertUnowned(root);
  assert.equal(warnings.length, 1);

  let confirmedOwnerBlocked = false;
  try {
    await createSystemPackageOwnershipInspection(2_000, {
      runCommand: async () => ({
        termination: "exit",
        code: 0,
        stdout: Buffer.from(`${root}/package.json\n`),
        stderr: Buffer.alloc(0),
      }) as never,
      onWarning: () => assert.fail("confirmed ownership must not warn and continue"),
    }).assertUnowned(root);
  } catch (error) {
    confirmedOwnerBlocked = Boolean((error as { owned?: unknown }).owned);
  }
  assert.equal(confirmedOwnerBlocked, true);

  console.log(
    JSON.stringify({
      boundary:
        "createSystemPackageOwnershipInspection.assertUnowned -> runCommandBuffered -> real pacman launch",
      selectedPlatform: "linux",
      hostPlatform: originalPlatform.value,
      warning: warnings[0],
      continuedAfterUnavailableInspection: true,
      confirmedOwnerNegativeControlBlocked: confirmedOwnerBlocked,
    }),
  );
} finally {
  Object.defineProperty(process, "platform", originalPlatform);
}

AI-assisted: built with Codex

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR identifies a missing package-manager executable instead of recommending repair of its database.

Example: Run openclaw update on Debian 12 without pacman installed.

  • Before: The updater recommends restoring the active pacman database while continuing.
  • After: The updater reports that the pacman executable was not found and continues.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful diagnostic correction with relevant shipped-CLI proof, preserved owner intent, passing exact-head checks, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The updated body supplies exact-head openclaw update output from an isolated Debian 12 npm installation with pacman absent, showing the corrected diagnostic, continued npm installation, successful candidate checks, and exit 0; this resolves the previous shipped-updater proof request.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Debian npm operators receive instructions to restore a pacman database when pacman is absent.
Reason: The narrow diagnostic correction preserves the existing owner's recorded policy and removes misleading recovery advice.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current updater diagnostic, preserves the documented ownership policy, and has no actionable findings.

Priority: P2
Reviewed head: 615ef0e757fade741b8fede739970171a3d3cfda

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point scenario is missing; the added regression's base failure was not supplied, although its changed-message assertions fail against the inspected base source.
Agent review details

How this fits together

CLI, Gateway, and package-replacement paths share a native package-ownership inspector that checks installation paths, warns when inspection is unavailable, and refuses replacement when ownership is confirmed.

flowchart TD
  A[Update request] --> B[Shared ownership inspector]
  B --> C[Native package query]
  C --> D[Missing executable]
  D --> E[Corrected warning and continuation]
  C --> F[Confirmed package ownership]
  F --> G[Replacement refused]
Loading

Technical review

Best possible solution:

Land one focused correction in the existing inspector while preserving unavailable-inspection warnings and confirmed-owner refusal.

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

Current-main source deterministically maps a missing pacman launch to database-restoration guidance, matching the linked reporter's Debian beta-update transcript; this review executed no target code.

Is this the best way to solve the issue?

Correcting the existing diagnostic addresses the reported failure without distribution detection, additional processes, or changes to ownership protection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 801d463f8921.

Provenance checked

  • Shared native package-ownership diagnostic keeps the original intent (5d9a5ff: Consolidate pacman and FreeBSD ownership protection, refuse confirmed ownership, and warn while continuing when inspection is unavailable.)
  • Existing ownership regression suite keeps the original intent (dfaec13: Protect native package-owned installation roots and launcher entries during self-update; the added case extends coverage without removing existing contracts.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5d9a5ff adds src/infra/update-system-package-ownership.ts:46 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5d9a5ff1b44c; files: src/infra/update-system-package-ownership.ts)
  • Vincent Koc: Raw commit dfaec13 adds src/infra/update-freebsd-pkg-ownership.test.ts:34 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/infra/update-freebsd-pkg-ownership.test.ts)

PR surface

Source +2, Tests +28. Total +30 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 28 0 +28
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 31 1 +30

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #173084
Summary: The canonical report and competing patches address the same ENOENT diagnostic in the shared package-ownership inspector.

Members:

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The update continues successfully, but misleading package-manager recovery instructions cause avoidable operator troubleshooting.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

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

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-15T12:42:12.970Z sha 615ef0e :: needs real behavior proof before merge. :: none

Reviewed October 15, 2026, 10:16 AM ET / 14:16 UTC (Revision 2).

@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 15, 2026
steipete added a commit that referenced this pull request Oct 15, 2026
…abase-restore advice (#173293)

A Debian npm update told the operator to restore the pacman database: when a system package manager's executable is absent (ENOENT), the ownership inspector reused its database-restoration advice. It now says the executable was not found and that ownership could not be verified; confirmed-owner refusal and continuation are unchanged. Supersedes #173118, #173122, #173144, thanks @wangmiao0668000666, @sunlit-deng, @DonnieFi.

Fixes #173084

Co-authored-by: wangmiao0668000666 <[email protected]>
Co-authored-by: sunlit-deng <[email protected]>
Co-authored-by: Donnie Fiander <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

Thanks for this! We landed the fix in #173293 (92280e2), which supersedes this PR and credits you as co-author. A missing package-manager executable now says the executable was not found instead of advising a database restore.

@steipete steipete closed this Oct 15, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…abase-restore advice (openclaw#173293)

A Debian npm update told the operator to restore the pacman database: when a system package manager's executable is absent (ENOENT), the ownership inspector reused its database-restoration advice. It now says the executable was not found and that ownership could not be verified; confirmed-owner refusal and continuation are unchanged. Supersedes openclaw#173118, openclaw#173122, openclaw#173144, thanks @wangmiao0668000666, @sunlit-deng, @DonnieFi.

Fixes openclaw#173084

Co-authored-by: wangmiao0668000666 <[email protected]>
Co-authored-by: sunlit-deng <[email protected]>
Co-authored-by: Donnie Fiander <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 22, 2026
…abase-restore advice (#173293)

A Debian npm update told the operator to restore the pacman database: when a system package manager's executable is absent (ENOENT), the ownership inspector reused its database-restoration advice. It now says the executable was not found and that ownership could not be verified; confirmed-owner refusal and continuation are unchanged. Supersedes #173118, #173122, #173144, thanks @wangmiao0668000666, @sunlit-deng, @DonnieFi.

Fixes #173084

Co-authored-by: wangmiao0668000666 <[email protected]>
Co-authored-by: sunlit-deng <[email protected]>
Co-authored-by: Donnie Fiander <[email protected]>
(cherry picked from commit 92280e2)
Co-authored-by: RomneyDa <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 27, 2026
…abase-restore advice (#173293)

A Debian npm update told the operator to restore the pacman database: when a system package manager's executable is absent (ENOENT), the ownership inspector reused its database-restoration advice. It now says the executable was not found and that ownership could not be verified; confirmed-owner refusal and continuation are unchanged. Supersedes #173118, #173122, #173144, thanks @wangmiao0668000666, @sunlit-deng, @DonnieFi.

Fixes #173084

Co-authored-by: wangmiao0668000666 <[email protected]>
Co-authored-by: sunlit-deng <[email protected]>
Co-authored-by: Donnie Fiander <[email protected]>
(cherry picked from commit 92280e2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

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

2 participants