Skip to content

fix(gateway): report busctl-incompatible when busctl rejects --json - #144046

Closed
JamieJ5926 wants to merge 6 commits into
openclaw:mainfrom
JamieJ5926:oc-fix-142940-busctl-json
Closed

JamieJ5926 wants to merge 6 commits into
openclaw:mainfrom
JamieJ5926:oc-fix-142940-busctl-json

Conversation

@JamieJ5926

@JamieJ5926 JamieJ5926 commented Sep 10, 2026 •

Copy link
Copy Markdown

Fixes #142940 (minimum remediation path from the issue).

What Problem This Solves

On hosts with systemd older than 240, busctl has no --json flag, so every manager inspection subprocess fails at argument parsing. Install conflated that tool-invocation failure with an uninspectable definition and refused with generic SERVICE_DEFINITION_UNKNOWN, leaving systemd 239 users (RHEL 8 family, Alibaba Cloud Linux 8) with no actionable error.

Change

  • Adds throwIfBusctlJsonUnsupported guard plus BUSCTL_JSON_UNSUPPORTED marker (src/daemon/systemd-unavailable.ts). Native stderr never leaves the boundary; only the static classification maps to the reason.
  • The manager query path throws the branded marker instead of generic unavailable when busctl rejects --json (src/daemon/systemd-service-files.ts).
  • New busctl-incompatible service-definition reason with remediation: upgrade systemd to 240+, or manage the user unit with systemctl from the service account (src/daemon/service-types.ts).
  • Definition-mutation capability maps the marker to the new reason (src/daemon/systemd-definition-mutation.ts).
  • Initial install read preserves the allowlisted reason instead of the generic refusal, covering both ordinary install and --force before any write (src/cli/daemon-cli/install.ts).

No persisted data model changes: the marker and reason exist only in memory during inspection.

Evidence

  • src/daemon/systemd-definition-mutation.test.ts: busctl unrecognized-option stderr yields {kind unknown, reason busctl-incompatible}, redacts diagnostics, and stage() fails with SERVICE_DEFINITION_UNKNOWN: [busctl-incompatible].
  • src/daemon/systemd-unavailable.test.ts: guard-level cases (branded throw, unit-absence passthrough, non-exit passthrough).
  • src/cli/daemon-cli/install.test.ts: initial readCommand rejection with the marker fails with SERVICE_DEFINITION_UNKNOWN: [busctl-incompatible] before config reads or credential generation.
  • src/daemon/systemd.test.ts (242 passed), systemd-definition-mutation (85 passed), install (42 passed) suites green locally.
  • Real Linux Gateway install proof (ordinary install and --force on systemd 239 with redacted terminal output) is not available from this machine (macOS, no systemd) and is parked for a Linux host run.

Scope note

This is the issue's sanctioned minimum: install still refuses on systemd < 240, but now with an actionable error instead of a generic one. A full legacy-output fallback (parsing pre-JSON busctl text) needs a systemd 239 fixture host and is left for a follow-up.

On systemd < 240 busctl has no --json flag, so every manager
inspection fails and install conservatively refuses with a generic
SERVICE_DEFINITION_UNKNOWN. Detect the tool-invocation failure and
surface a distinct busctl-incompatible reason with remediation
instead of conflating it with an uninspectable definition.

Fixes openclaw#142940 (minimum remediation path).
@clawsweeper

clawsweeper Bot commented Sep 10, 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 triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. gateway Gateway runtime size: S and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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

This PR is superseded by the merged compatibility repair at #146022, which restores systemd 239 installation instead of retaining the refusal with a clearer diagnostic.

Root-cause cluster
Relationship: superseded
Canonical: #146022
Summary: The merged compatibility repair replaces the need for the minimum diagnostic remediation proposed here.

Members:

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

Canonical path: Retain the shipped compatibility reader and close this superseded diagnostic-only PR.

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

Review details

Best possible solution:

Retain the shipped compatibility reader and close this superseded diagnostic-only PR.

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

The historical failure is supported by the original report, but current main handles its exact unsupported-option response through legacy inspection; no target code was executed during this review.

Is this the best way to solve the issue?

The merged compatibility repair solves the central installation problem more completely than retaining refusal and advising an operating-system upgrade.

Security review:

Security review cleared: The patch retains refusal before writes and exposes static explanations without forwarding native stderr.

AGENTS.md: found and applied where relevant.

What I checked:

  • Merged replacement explicitly supersedes the diagnostic approach: GitHub confirms the replacement merged on September 12, 2026. Its body explicitly links this PR as diagnostic-only and explains that the existing inspection reader now supports systemd 239 installation and reinstallation. (a5dc82a5b168)
  • Current main retains the compatibility repair: The command-query owner recognizes the exact unsupported --json=short response, retries without JSON within the original deadline, and decodes bounded legacy output. The effective service reader calls this owner. (src/daemon/systemd-command-query.ts:140, a9b40cf325e8)
  • Regression coverage follows the effective reader: Current tests exercise legacy busctl through readSystemdServiceExecStart, preserving manager arguments, selected drop-ins and environment semantics while rejecting malformed replies and revoked inspection. (src/daemon/systemd-command-query.test.ts:258, a9b40cf325e8)
  • Fix provenance formally references this PR: The fixing commit records the restored installation behavior, closes the original report, and explicitly references this PR. (src/daemon/systemd-command-query.ts, a5dc82a5b168)
  • Compatibility repair is shipped: The v2026.10.1 source contains the unsupported-option retry and legacy decoding path; the earliest containing release was not established. (src/daemon/systemd-command-query.ts:128, e178c39e9aae)
  • Original report resolved by the replacement: The original report is closed. Its closing discussion credits PollyBot13 and explains that manager-effective legacy inspection restores installation while unverifiable definitions continue to refuse.

Likely related people:

  • Peter Steinberger: Raw commit 83dce46 adds src/daemon/systemd-definition-mutation.ts:97 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 83dce46a7da4; files: src/daemon/systemd-definition-mutation.ts)

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Sep 10, 2026
@JamieJ5926

Copy link
Copy Markdown
Author

Maintainer note on the remaining red (no code action requested from me): head 7fda6f7 shows 163 pass / 1 fail. The single fail is checks-node-changed-extensions-bundle-4 in run 34491603625 (job 102919819301): a timing-flake assertion (vi.waitFor release-called-once) in extensions/openrouter/music-generation-provider.test.ts, 1284/1285 passing in that shard. This PR's full diff is 8 files, all under src/daemon/* and src/cli/daemon-cli/* (install.ts, install.test.ts, service-types.ts, systemd-definition-mutation.ts, systemd-definition-mutation.test.ts, systemd-service-files.ts, systemd-unavailable.ts, systemd-unavailable.test.ts) — none under extensions/*. The consequential openclaw/ci-gate fail follows the shard fail. I cannot rerun it (needs admin: gh run rerun --failed was denied). A shard rerun should clear it.

steipete pushed a commit that referenced this pull request Sep 12, 2026
Gateway installation and reinstallation now work on systemd 239 by reading legacy busctl text output when that version rejects --json=short. The existing effective-command reader retains routing, authority checks, deadlines, drop-ins, and environment semantics; unverifiable definitions still refuse installation.

Closes #142940
Refs #144046

Contributor native systemd 239 proof covers successful fresh installs and reinstalls, preserved overrides, and refusal controls. Exact-head CI is green; independent maintainer review and ClawSweeper found no actionable findings. Packaged CLI parsing, real Gateway health, and updater/private-peer compatibility are outside this proof.

Co-authored-by: PollyBot13 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
Gateway installation and reinstallation now work on systemd 239 by reading legacy busctl text output when that version rejects --json=short. The existing effective-command reader retains routing, authority checks, deadlines, drop-ins, and environment semantics; unverifiable definitions still refuse installation.

Closes openclaw#142940
Refs openclaw#144046

Contributor native systemd 239 proof covers successful fresh installs and reinstalls, preserved overrides, and refusal controls. Exact-head CI is green; independent maintainer review and ClawSweeper found no actionable findings. Packaged CLI parsing, real Gateway health, and updater/private-peer compatibility are outside this proof.

Co-authored-by: PollyBot13 <[email protected]>

@wjc2821296948 wjc2821296948 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码审查

existingServiceCommand = await service.readCommand(process.env, { requireEffective: true });
} catch {
} catch (error) {
if (hasErrnoCode(error, BUSCTL_JSON_UNSUPPORTED_CODE)) {

This comment was marked as spam.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 4, 2026
@clawsweeper clawsweeper Bot added status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. and removed status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

  • Action: close remains subject to final live verification.
  • Close reason: duplicate or superseded.
    Review evidence: durable ClawSweeper review.
  • Coverage proof: The source report describes concrete compatibility behavior retained on current main and in the release, consistent with PR B's installation scope. PR B resolves the exact failure more completely; PR A's refusal-specific diagnostic and missing diagnostic proof do not require separate review. Covering PR: fix(daemon): install the Gateway on systemd 239 with legacy busctl output #146022.

@clawsweeper clawsweeper Bot closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: openclaw gateway install fails with SERVICE_DEFINITION_UNKNOWN on systemd 239 (busctl --json=short` unsupported)

2 participants