Skip to content

fix(systemd): report service commands replaced by drop-ins - #128604

Merged
steipete merged 3 commits into
mainfrom
steipete/youthful-chandrasekhar-3e50f6
Aug 24, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/youthful-chandrasekhar-3e50f6

Conversation

@steipete

@steipete steipete commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #128602

What Problem This Solves

Fixes an issue where Linux operators using systemd drop-ins could see a canonical service command in OpenClaw status, doctor, and updater diagnostics even though the systemd user manager would launch a different overridden ExecStart.

Why This Change Was Made

The command reader now asks the systemd user manager for the structured D-Bus ExecStart property, preserving exact argument boundaries and reusing the existing direct-user, sudo-to-user, machine-scope, bus-environment, and timeout routing. The base unit parser remains the explicit fallback for offline, installation, pre-reload, unavailable-manager, or older-systemd contexts. This deliberately avoids both lossy textual systemctl show parsing and an incomplete reimplementation of systemd drop-in precedence.

This change is generic service observability only. It does not add product-specific policy about whether an overridden command is allowed.

User Impact

OpenClaw diagnostics now report the command the systemd user manager has actually loaded when a drop-in replaces ExecStart, allowing stale or noncanonical entrypoints to be detected instead of hidden behind the canonical base unit.

Evidence

  • Regression before repair: expected [/opt/stale/openclaw, gateway, --name, "Stale Drop-In Gateway"]; received [/usr/bin/openclaw, gateway, run].
  • node scripts/run-vitest.mjs src/daemon/systemd.test.ts src/daemon/service.test.ts src/node-host/node-worker-supervisor.container.test.ts — 192 tests passed across the daemon and unit shards.
  • node scripts/check-changed.mjs -- src/node-host/node-worker-supervisor.container.test.ts src/daemon/systemd-service-files.ts src/daemon/systemd-exec.ts src/daemon/service.ts src/daemon/node-service.ts src/daemon/systemd.test.ts src/daemon/service.test.ts — formatting, lint, production/test typechecks, architecture guards, dead-export checks, and import-cycle checks passed.
  • git diff --check — passed.
  • Fresh autoreview — no accepted/actionable findings.
  • ClawSweeper’s P2 timeout finding was applied: callers that do not supply a status timeout now share a finite five-second deadline across both manager queries before the local fallback. The no-options fallback regression verifies that boundary.
  • Initial exact-head CI run 32703841385 exposed a newly landed node-worker-supervisor.container timing flake on current main. A bounded merge-tree stress run reproduced its default one-second worker-start wait failing on run 3/10. Both affected cases now share the existing five-second lifecycle deadline; the full file passed 10/10 runs, followed by the combined focused suite and changed checks.
  • Production LOC: +102/-20 (net +82). Tests: +98/-3. The production growth adds the lossless manager query, shared manager-command routing, and bounded deadline propagation for every caller.

A real Linux user-manager probe was attempted but did not execute: the configured Testbox backend lacked local authentication, and two isolated AWS runners never opened SSH. Both leases were stopped and cleaned up. The systemd D-Bus and busctl --json=short response contracts were checked directly against upstream systemd source and documentation; the focused regression covers the complete OpenClaw boundary with structured manager responses.

AI-assisted: yes. The implementation and tests were reviewed and verified by the maintainer.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 07:56
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 5:25 AM ET / 09:25 UTC.

ClawSweeper review

What this changes

The PR reads systemd’s manager-effective ExecStart through structured D-Bus output so status, doctor, and updater diagnostics reflect user-unit drop-ins.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. The prior bounded-fallback finding is addressed on the current head, and no new blocking defect was found; this maintainer-owned PR now awaits normal exact-head merge checks.

Priority: P2
Reviewed head: 924bc3381b6fb0c436d9d3ccbe6053f212d50066

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch cleanly resolves the prior timeout finding with focused source-boundary coverage; exact-head CI remains the normal merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body records the unavailable live Linux probe and focused boundary validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body records the unavailable live Linux probe and focused boundary validation.
Evidence reviewed 6 items Current-main behavior: Current main parses ExecStart only from the user unit file, so it cannot observe a loaded drop-in replacement.
Current-head repair: The branch obtains the unit object through LoadUnit, reads the structured Service.ExecStart property, validates its argv, and retains the base parser as fallback.
Caller and timeout propagation: Status reads pass their deadline to readCommand, while the reader gives all other callers a finite five-second shared deadline before local fallback.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128604-ShUJaO/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 108.65 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.8s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4325ms (slowest: built plugin control-plane loads 3622ms)

OpenClaw 2026.8.1 (924bc33) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage

How this fits together

OpenClaw’s daemon service layer provides service command metadata to status, doctor, updater, and lifecycle flows. It now queries the systemd user manager for the loaded command, then falls back to the local unit file when that query is unavailable.

flowchart LR
  A[Service environment] --> B[Command reader]
  B --> C[Systemd user manager]
  C --> D[Effective ExecStart]
  C --> E[Base unit fallback]
  D --> F[Status doctor updater]
  E --> F
Loading

Before merge

  • Resolve merge risk (P1) - The fix adds net 82 production lines for manager-query execution and structured response handling; the growth is warranted because the prior local parser cannot model systemd drop-in precedence.
  • Complete next step (P2) - No actionable current-head repair remains; this maintainer-owned PR should proceed through normal exact-head CI and merge handling.
Agent review details

Security

None.

PR surface

Source +82, Tests +95. Total +177 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 102 20 +82
Tests 3 98 3 +95
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 200 23 +177

Review metrics

Metric Value Why it matters
Production versus test LOC production +102/-20 (net +82); tests +98/-3 (net +95) Production growth adds generic manager-command routing and structured ExecStart handling; test growth covers the effective-command and bounded-fallback boundaries.

Stored data model

Persistent data-model change detected: serialized state: src/daemon/systemd.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128602
Summary: This PR is the explicit candidate repair for the linked systemd effective-ExecStart diagnostics bug.

Members:

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

Merge-risk options

Maintainer options:

  1. Confirm exact-head service checks (recommended)
    Merge after the current head has green required checks, preserving the five-second manager-query bound and local fallback.

Technical review

Best possible solution:

Keep one manager-backed, lossless command source with the existing base-unit parser as the bounded unavailable-manager fallback; no smaller local parser can reliably reproduce drop-in precedence.

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

Yes, from source: the base parser reads only the unit-file ExecStart while the added fixture supplies a different manager-effective argv; the branch test covers that boundary, though no live user-manager run was available here.

Is this the best way to solve the issue?

Yes. The manager’s structured property is the authoritative effective command source and avoids reimplementing drop-in precedence; textual show parsing would lose argument boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7a7bb1f6709a.

Labels

Label changes:

  • 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: This maintainer-authored PR is exempt from the external-contributor proof gate; its body records the unavailable live Linux probe and focused boundary validation.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This fixes incorrect Linux service diagnostics for installations whose systemd drop-ins replace ExecStart.
  • merge-risk: 🚨 availability: The PR adds busctl subprocesses to service inspection paths, making fail-soft timeout and fallback behavior merge-relevant.
  • 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: This maintainer-authored PR is exempt from the external-contributor proof gate; its body records the unavailable live Linux probe and focused boundary validation.

Evidence

What I checked:

  • Current-main behavior: Current main parses ExecStart only from the user unit file, so it cannot observe a loaded drop-in replacement. (src/daemon/systemd-service-files.ts:43, 7a7bb1f6709a)
  • Current-head repair: The branch obtains the unit object through LoadUnit, reads the structured Service.ExecStart property, validates its argv, and retains the base parser as fallback. (src/daemon/systemd-service-files.ts:47, 924bc3381b6f)
  • Caller and timeout propagation: Status reads pass their deadline to readCommand, while the reader gives all other callers a finite five-second shared deadline before local fallback. (src/daemon/service.ts:194, 924bc3381b6f)
  • Regression coverage: The test covers a manager-effective argv differing from the base unit and verifies bounded fallback when the manager query fails. (src/daemon/systemd.test.ts:1358, 924bc3381b6f)
  • Systemd command contract: The installed systemd busctl documentation confirms user-bus selection, JSON output, LoadUnit calls, and property reads used by this path.
  • Area provenance: Feature history attributes the current command-reader work to Peter Steinberger, including the current bounded-lookup commit. (src/daemon/systemd-service-files.ts:95, 924bc3381b6f)

Likely related people:

  • steipete: Current-head authorship and available file history connect this contributor to the systemd command-reader path. (role: recent service-layer contributor; confidence: high; commits: 3fa3276381dc, 924bc3381b6f; files: src/daemon/systemd-service-files.ts, src/daemon/systemd-exec.ts, src/daemon/service.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the current head’s required checks to complete successfully.
  • Attach a redacted Linux user-manager trace if practical to further validate the real drop-in path.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-24T08:04:13.392Z sha a81ae96d781996ce2cb3b8023f7b881332d7c046 :: found issues before merge. :: [P2] Bound manager queries outside status reads
  • reviewed 2026-08-24T08:20:44.788Z sha d00539d :: needs changes before merge. :: [P2] Bound manager queries before local fallback

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 924bc3381b6fb0c436d9d3ccbe6053f212d50066:

  • node scripts/run-vitest.mjs src/daemon/systemd.test.ts src/daemon/service.test.ts src/node-host/node-worker-supervisor.container.test.ts — 192 tests passed; the original manager-effective ExecStart regression failed before the fix and passes now.
  • node scripts/check-changed.mjs -- src/node-host/node-worker-supervisor.container.test.ts src/daemon/systemd-service-files.ts src/daemon/systemd-exec.ts src/daemon/service.ts src/daemon/node-service.ts src/daemon/systemd.test.ts src/daemon/service.test.ts — passed; git diff --check — passed.
  • Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/32710670042 — green, pending=0, openclaw/ci-gate succeeded. The current-main worker-start timing flake reproduced on merge-tree run 3/10; its repair passed the full file 10/10 and the combined focused suite.
  • Fresh full-branch Codex autoreview: no accepted/actionable findings. Production LOC +102/-20 (net +82); tests +98/-3 (net +95). Production growth provides the authoritative structured manager query, shared command routing, and bounded owner-level deadline; local fragment parsing cannot reproduce manager-effective drop-in precedence.
  • ClawSweeper’s earlier P2 timeout finding is resolved by one shared five-second deadline and a no-options fallback regression. The current-head placeholder was non-blocking under repository policy and has since completed on this exact head with no actionable findings. Rank-up moves: exact-head required CI is green; the optional redacted live Linux trace is skipped for the concrete infrastructure limitation below.
  • Real-Linux proof gap: a real systemd user-manager probe was attempted but did not execute because local Testbox authentication was unavailable and two AWS runners never opened SSH; both leases were cleaned up. Focused boundary coverage and hosted CI are not live Linux user-manager proof.

Native review artifacts are validated with READY FOR /prepare-pr, issueValidation.status=valid, and zero findings. Closes #128602.

@steipete
steipete merged commit d0c238b into main Aug 24, 2026
244 checks passed
@steipete
steipete deleted the steipete/youthful-chandrasekhar-3e50f6 branch August 24, 2026 09:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
…128604)

* fix(systemd): report service commands replaced by drop-ins

* test(node-host): tolerate worker startup latency

* fix(systemd): bound effective command lookup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. 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

Development

Successfully merging this pull request may close these issues.

[Bug]: systemd diagnostics ignore effective ExecStart drop-ins

1 participant