Skip to content

fix(daemon): detect effective systemd service overrides - #128705

Merged
steipete merged 1 commit into
mainfrom
steipete/cranky-hofstadter-edb846
Aug 24, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cranky-hofstadter-edb846

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #50186

What Problem This Solves

Fixes an issue where Linux operators running openclaw status or openclaw doctor could receive stale systemd hygiene results when drop-ins or dependency links changed KillMode, RestartSec, After, or Wants. The audit read only the base user unit, so effective unsafe overrides could be missed and effective repairs could still be warned about.

Why This Change Was Made

Use systemd's loaded manager state as the authority for the four scalar/dependency properties via one bounded systemctl show request through the existing account-aware user-manager transport. Successful manager output replaces the file snapshot wholesale; manager failure retains the existing best-effort base-unit fallback. Status passes its existing deadline; Doctor uses the finite audit default. ExecStart inspection, repair policy, and Team-specific policy remain out of scope. AI-assisted; implementation and tests were reviewed and understood.

User Impact

Linux operators now see audit warnings that match the service configuration systemd is actually running, including drop-in overrides. Status/Doctor remain fail-soft when systemd cannot be queried and retain existing behavior on macOS and Windows.

Evidence

  • Pre-fix focused regression: node scripts/run-vitest.mjs src/daemon/service-audit.test.ts -t 'respects systemd manager authority' failed all four rows because production never queried manager-effective state; it passes after the repair.
  • node scripts/run-vitest.mjs src/daemon/service-audit.test.ts src/cli/daemon-cli/status.gather.test.ts — 98 passed.
  • node scripts/check-changed.mjs -- src/daemon/service-audit.ts src/daemon/service-audit.test.ts src/cli/daemon-cli/status.gather.ts src/cli/daemon-cli/status.gather.test.ts — passed all selected core/coreTests checks.
  • git diff --check — passed.
  • Fresh autoreview — no accepted/actionable findings.
  • Upstream systemd contracts verified directly: After/Wants are manager dependency arrays, RestartUSec is the effective duration property rendered by systemctl show, and KillMode is a manager string property.
  • Live Linux systemd proof was not run: the development host is macOS and lacks systemd; the configured remote Crabbox path was unavailable because the crabbox CLI is not installed. The change is covered at the manager execution boundary and will receive exact-head Linux CI/Testbox proof before landing.
  • Production LOC: +30/-2; tests: +130/-4.

@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 cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 11:56
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head ad48071732785e24435b22d1d4c8e34028003ce3:

  • Exact-head CI: run 32724406066 completed green (openclaw/ci-gate, 0 pending/failed).
  • Focused regression: node scripts/run-vitest.mjs src/daemon/service-audit.test.ts src/cli/daemon-cli/status.gather.test.ts — 98 passed.
  • Changed gates: node scripts/check-changed.mjs -- src/daemon/service-audit.ts src/daemon/service-audit.test.ts src/cli/daemon-cli/status.gather.ts src/cli/daemon-cli/status.gather.test.ts — passed.
  • git diff --check — passed.
  • Fresh autoreview — no accepted/actionable findings.
  • Native review artifacts validated at this exact head with READY FOR /prepare-pr, zero findings, and issueValidation.status=valid.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 128705 passed at 2026-08-24T12:08:49Z in hosted_exact_or_recent_parent mode; the exact hosted CI result was reused, so no separate Testbox lease was needed. Remote PR and prep trees match exactly.
  • Latest ClawSweeper comment is still the in-progress placeholder and has published no Rank-up moves:. There are therefore no rank-up items to apply or skip before merge; a late publisher update is not being treated as a merge blocker.

Proof gap: no live Linux user-systemd run was available on the macOS development host, and the configured Crabbox path could not be started because the crabbox CLI is not installed. The manager boundary is covered by focused regression tests, upstream systemd source inspection, exact-head Linux CI, and the native hosted prepare gate.

@steipete
steipete merged commit e31de4a into main Aug 24, 2026
295 checks passed
@steipete
steipete deleted the steipete/cranky-hofstadter-edb846 branch August 24, 2026 12:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant