Repository navigation
fix(node-cli): warn when systemd user lingering is disabled after install - #118430
Patrick-Erichsen merged 10 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 6, 2026, 9:33 PM ET / August 7, 2026, 01:33 UTC. ClawSweeper reviewWhat this changesAdds Linux node-install linger warnings and makes Node, Gateway, and Doctor inspect the same systemd user-service owner. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep open: current main does not contain the node warning or shared service-owner alignment. The patch has no supported correctness finding, but the later Gateway and Doctor expansion still needs current-head production-boundary proof before merge. Priority: P1 Review scores
Verification
How this fits togetherNode installation creates and verifies a user-level systemd service. The changed diagnostics resolve that service’s owning account, read its lingering state, and return recovery guidance through CLI output or Doctor findings. flowchart LR
A[Node or Gateway operation] --> B[Resolve systemd service owner]
B --> C[Read loginctl lingering state]
C --> D{Lingering disabled?}
D -->|Yes| E[CLI warning or Doctor finding]
D -->|No| F[Successful service workflow]
E --> G[Operator enables lingering]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +87, Tests +355, Docs +42. Total +484 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Refresh against current main, then prove on a real Linux systemd host that Gateway and Doctor pass the same account to loginctl that systemctl uses, including a sudo-to-root case. Do we have a high-confidence way to reproduce the issue? Yes. A disposable Linux user with a real systemd user manager can reproduce the node-offline-after-logout path; the submitted transcript demonstrates that central path, while the expanded Gateway/Doctor path still needs a current-head run. Is this the best way to solve the issue? Yes, with the remaining proof gap. Reusing the service-owner resolver is the narrowest maintainable fix because every linger diagnostic now follows the account actually targeted by systemctl. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 53006a289e76. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
776eb8d to
6bd7b57
Compare
4a81ec9 to
3796c3f
Compare
…r install openclaw node install now detects when systemd user lingering is off and warns the operator (text + JSON) to run 'sudo loginctl enable-linger <user>'. Without lingering, the user-level node service is torn down when the last SSH session ends, so the node silently goes offline after logout. The check is read-only and never auto-enables lingering, matching the operator-consent policy used elsewhere. It runs only on the verified-success path: an optional onVerified hook is added to installDaemonServiceAndEmit that fires after service.isLoaded() confirms the service is loaded and before the success payload is emitted. The linger diagnostic runs there, so a failed install or verification failure never carries a linger warning (avoids misdirecting the operator to fix lingering for a service that was not successfully installed). The already-installed short-circuit warns separately. Skipped on non-Linux and when systemd user service is unavailable. Adds unit tests for both paths, the linger=yes no-op, the install-failure isolation, the verification-failure no-warn regression, and the systemd-unavailable skip, plus response.test.ts cases covering onVerified running on success and failing safely when it throws. The readSystemdUserLingerStatus mock is typed with the full linger union to satisfy tsgo. Documents the linger step in docs/cli/node.md and docs/nodes/troubleshooting.md. Real-behavior evidence captured on a Linux host by toggling loginctl disable-linger/enable-linger and running the real install flow: linger=no emits the warning on successful install (text + JSON) and on the already-installed path; linger=yes emits nothing; a failed install or verification failure emits no warning. Fixes openclaw#107033 Co-Authored-By: deepseek-v4-flash <[email protected]>
3796c3f to
75dd87c
Compare
|
@clawsweeper re-review — clearing the stuck review-recovery marker: a fresh review started on 2026-08-05 but never produced a durable verdict; please re-review the current head (75dd87c). |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Patrick-Erichsen
left a comment
There was a problem hiding this comment.
Approved at exact head 98404c7. Exact-head production systemd proof passed, the CI-fixture repair passed 45/45 focused tests plus formatting/lint, and fresh autoreview is clean.
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Merged via squash.
|
* origin/main: (58 commits) fix(test): restart shared gateway after migration convergence (openclaw#120089) fix(ui): make active-run steering reliable (openclaw#120083) fix(telegram): preserve voice fallback text test(swift): preserve queued websocket frames (openclaw#120106) fix: reject missing oxlint shard selectors (openclaw#120096) test(channels): align prerelease fallback catalog spec (openclaw#120092) fix(node-cli): warn when systemd user lingering is disabled after install (openclaw#118430) fix(diagnostics): preserve CLI turn usage totals (openclaw#120100) fix(gateway): derive lock and coordinator paths from the resolved state dir (openclaw#120110) fix(release): isolate private Telegram QA harness (openclaw#120088) test(agents): exercise execution attribution ingress guard fix(gateway): defer attribution until admission succeeds refactor(agents): centralize exact execution attribution fix(google): accept base64url provider media (openclaw#116204) fix(plugins): warn when registerHook uses a typed hook event name (openclaw#118601) fix(canvas): serve Content-Length on A2UI HEAD responses (openclaw#117961) fix(gateway): make doctor dreaming timestamp comparators NaN-safe (openclaw#118749) fix(heartbeat): explain target-none skips (openclaw#119689) fix(security): stop recommending retired install-policy bypasses (openclaw#120011) fix(plugins): preserve startup release during repair (openclaw#120085) ... # Conflicts: # CHANGELOG.md # src/config/sessions/session-accessor.sqlite-transcript-write.ts
…tall (openclaw#118430) * [AI] fix(node-cli): warn when systemd user lingering is disabled after install openclaw node install now detects when systemd user lingering is off and warns the operator (text + JSON) to run 'sudo loginctl enable-linger <user>'. Without lingering, the user-level node service is torn down when the last SSH session ends, so the node silently goes offline after logout. The check is read-only and never auto-enables lingering, matching the operator-consent policy used elsewhere. It runs only on the verified-success path: an optional onVerified hook is added to installDaemonServiceAndEmit that fires after service.isLoaded() confirms the service is loaded and before the success payload is emitted. The linger diagnostic runs there, so a failed install or verification failure never carries a linger warning (avoids misdirecting the operator to fix lingering for a service that was not successfully installed). The already-installed short-circuit warns separately. Skipped on non-Linux and when systemd user service is unavailable. Adds unit tests for both paths, the linger=yes no-op, the install-failure isolation, the verification-failure no-warn regression, and the systemd-unavailable skip, plus response.test.ts cases covering onVerified running on success and failing safely when it throws. The readSystemdUserLingerStatus mock is typed with the full linger union to satisfy tsgo. Documents the linger step in docs/cli/node.md and docs/nodes/troubleshooting.md. Real-behavior evidence captured on a Linux host by toggling loginctl disable-linger/enable-linger and running the real install flow: linger=no emits the warning on successful install (text + JSON) and on the already-installed path; linger=yes emits nothing; a failed install or verification failure emits no warning. Fixes openclaw#107033 Co-Authored-By: deepseek-v4-flash <[email protected]> * fix(node-cli): align linger user with service owner * docs(node): narrow crash-loop claim to gateway units The duplicate-scope guard that raises on two managers running the same unit name is enforced for gateway units (two supervisors on the same port SIGTERM each other in a restart loop); assertNoSystemGatewayOwnership returns early for node services, so claiming node services crash-loop misattributes gateway behavior. Qualify the troubleshooting note accordingly. Addresses ClawSweeper P3 finding on PR openclaw#118430. * fix(systemd): align linger checks with service owner * test(doctor): align linger status mock contract * style(doctor): format linger mock * test(wizard): mock systemd service account --------- Co-authored-by: deepseek-v4-flash <[email protected]> Co-authored-by: Patrick Erichsen <[email protected]>
What Problem This Solves
openclaw node installdoes not warn when systemd user lingering is disabled, so the installed user-level node service is torn down when the last SSH session ends and the node silently goes offline after logout. This PR adds a read-only linger check that warns the operator to runsudo loginctl enable-linger <user>.readSystemdUserLingerStatusand warn in both text and JSON modessrc/cli/node-cli/daemon.ts(newwarnIfSystemdUserLingerDisabledhelper,warnhoisted, calls on both install paths),src/cli/node-cli/daemon.test.ts(6 cases),docs/cli/node.md,docs/nodes/troubleshooting.mdenableSystemdUserLingerauto-enable path; nix/Windows install flowsChange Type (select all)
Scope (select all)
Linked Issue/PR
Motivation
When a Linux node is installed as a systemd user service (
openclaw node install), theservice lives in the user's systemd session. systemd tears down the user manager — and every
user service in it — when the last session for that user ends, unless lingering is enabled
(
loginctl enable-linger <user>). Over SSH this means: install looks successful, you log out,and the node is gone. There is no hint at install time that lingering is the missing piece.
This is a narrow, well-understood gap: the fix does not require choosing a product direction —
it surfaces an existing operator step (
enable-linger) that the docs already imply. The checkis read-only and never auto-enables lingering, matching the operator-consent policy used
elsewhere in the installer (e.g. it warns rather than mutating host state).
Evidence
openclaw node installnow warns when systemd user lingering is disabled, only on the verified-success path (successful fresh install and already-installed short-circuit), in text and JSON modes. A failed install or a verification failure carries no linger warning.fd7c8732af398d2c1e039563380f1af7add79a6c): full real-CLI run ofopenclaw node installagainst a disposable systemd user service. The proof creates a throwaway OS user with its own fresh canonical~/.openclawand systemd user manager, opens a real SSH logind session for it via pam_systemd (the same way an operator reaches a node host over SSH), runs the real CLI built from this head, then uninstalls the service and deletes the user. Nothing is stubbed: the CLI really writes~/.config/systemd/user/openclaw-node.service, really enables/starts/verifies the unit, and really readsloginctl show-user <user> -p Linger. The proof host's own default profile, config, state, and linger setting are untouched.dist/entry.js) from this head.bash linger-proof-disposable-user.shin the exact-head worktree (script is worktree-only, not committed). Transcript redacted:<proof-user>= disposable account,<repo>= exact-head checkout,<node-dir>= Node binary copy used by the disposable user.Behavior matrix (real
loginctllinger state × install path):Systemd lingering is disabled for <user>. The node service will stop when you log out. Run: sudo loginctl enable-linger <user>in text mode.warningsarray of the success payload (ok:true,result:"installed").openclaw node installwhen already loaded, no--force) also warns.service.installthrows) emitsok:falsewith the install error and no linger warning (verified by the worktree-only evidence test; the real CLI cannot be forced to throw without breaking the disposable service).service.isLoadedreturns false after install) emitsok:falsewith "verification failed" and no linger warning — the linger diagnostic runs only after verification succeeds (review fix; verified by the evidence test + unit tests).434c2b471c8a, then docs commitfd7c8732): the real-CLI transcript above runs onfd7c8732; the follow-upresolveSystemdUserServiceAccountrepair (aligning the linger lookup with the systemctl service owner across sudo-to-root and real-root-user-manager states) is proven separately below. The resolver is a pure function ofprocess.env+os.userInfo()/process.geteuid(); to reproduce the sudo/root process states on a normal uid-1000 proof host,os.userInfoandprocess.geteuidare stubbed to the exact values the PR's own unit tests use insrc/daemon/systemd.test.ts(the "resolves the sudo caller..." and "resolves root for a real root user-manager..." cases), and the env objects are the verbatim env from those same test cases. The resolved account is then fed to the realloginctl show-user <user> -p Lingerbinary (systemd 239) — the exact commandsrc/daemon/systemd-linger.ts:readSystemdUserLingerStatusexecutes on this head — showing the linger warning targets the same account systemctl targets.tsx linger-proof.tsagainst the verbatimresolveSystemdUserServiceAccountchain copied fromsrc/daemon/systemd.ts(head434c2b47, lines 902-924 and 951-1001).0668000539(linger=yes).<real user>= the proof host's own account so loginctl answers instead of "no such user"):0668000539), not root, so the linger warning andsystemctl --machine=<caller>@target the same account; under a real root user-manager (B) it returnsroot(the genuine root session, not a staleSUDO_USER); under a non-root effective identity (C) it ignores a staleSUDO_USERand returns the effective account; (D) confirms the live wiring on the proof host. The sudo/root account-selection invariant — the gap the434c2b47repair closed — holds in all four states.Root Cause
The installer (
runNodeDaemonInstallinsrc/cli/node-cli/daemon.ts) installs a systemd userservice but never checks whether the user manager will persist after logout. systemd's user
manager exits with the last session unless
loginctl enable-linger <user>has been run, so a"successful" install silently goes offline on SSH logout. No prior code path read linger status
at install time (the existing
readSystemdUserLingerStatuswas only used by Doctor diagnostics,#97514).
Lifecycle placement (review fix): the shared installer
installDaemonServiceAndEmit(src/cli/daemon-cli/response.ts) writes the service, thenverifies it is loaded (
service.isLoaded), and only then emits the success payload. The lingerdiagnostic must run on that verified-success path — not inside the
installcallback (which runsbefore verification). This PR adds an optional
onVerifiedhook toinstallDaemonServiceAndEmitfor post-success diagnostics, and runs the linger warning there, soa failed install or verification failure never tells the operator to fix lingering.
Regression Test Plan
src/cli/node-cli/daemon.test.tsadds 7 cases: warns after fresh install (text), warns in JSONwarnings, warns on already-installed short-circuit, does NOT warn when linger=yes, does NOT
pollute failure output when
service.installthrows, does NOT warn when service-loadverification fails (review regression), and skips when systemd user service is unavailable.
All 19 cases in the file pass.
src/cli/daemon-cli/response.test.tsadds 2 cases for the new sharedonVerifiedseam: it runsafter verification succeeds and before the success emit, and a thrown
onVerifiedsurfaces as afailure with no success emit. All 6 cases in the file pass.
src/cli/daemon-cli/install.test.ts(37 cases) passes unchanged — the optionalonVerifiedhook does not affect the other installer caller.
loginctltoggle under both linger states.bash linger-proof-disposable-user.shruns the real
openclaw node installCLI at the exact PR head against a disposable systemduser service, covering fresh install text/JSON, already-installed text/JSON, linger=yes no-warn,
and full cleanup (service removed, user deleted, linger restored).
User-visible / Behavior Changes
openclaw node installon Linux now prints an additional warning line (text mode) or appends tothe
warningsarray (JSON mode) when systemd user lingering is disabled. No behavior change whenlingering is enabled or on non-Linux platforms. Host state is never modified.
Security Impact
loginctl show-user; never enables linger.loginctlalready used by Doctor.Human Verification
(warns on linger=no), already-installed text + JSON (warns), linger=yes no-op (no warning),
cleanup (service removed, disposable user deleted, linger restored). Unit/evidence-test scenarios:
verification-failure no-warn (review regression), install-throws no-warn, systemd-unavailable
skip — under both real linger states (toggled via
loginctl).onVerified(failure isolation for both install-throws and verification-fails), warn callback hoisted
before the already-installed short-circuit, non-Linux early return, systemd-unavailable early
return,
onVerifiedthrow surfaces as a failure (does not silently pass).systemd unit + second session); the auto-enable
enableSystemdUserLingerpath (intentionallynot reused — it changes host state).
Compatibility / Migration
Best-fix Verdict
on both install paths, reusing the existing
readSystemdUserLingerStatusrather thanduplicating detection. Avoids the two pitfalls that closed prior PRs (feat(node): warn when systemd linger is not enabled after node install #107061 linger-before-
install polluting failure output; fix(nodes): keep Linux nodes online after logout #107068 missing the already-installed path).
enableSystemdUserLingerexists) — rejectedbecause it mutates host state without operator consent; warning + documented command keeps the
operator in control, consistent with the installer's existing warn-don't-mutate posture.
AI Assistance
root-cause trace through
runNodeDaemonInstall→installDaemonServiceAndEmit→service.install, and review of the two closed prior PRs (feat(node): warn when systemd linger is not enabled after node install #107061, fix(nodes): keep Linux nodes online after logout #107068) to avoid theirfailure modes.
Risks and Mitigations
non-
enable-lingermechanism (e.g.systemd --userstarted manually, or a system-levelservice masquerading as user-level). Mitigation: the check only warns (does not block or
mutate), and the message names the exact remediation; a false positive is a harmless extra
line. The docs note not to mix user/system-level services.
change. Existing users with lingering enabled see no difference.
loginctl show-user, which is already used by Doctor (Doctor: expose systemd linger findings #97514); no newexternal dependency or privilege escalation.
Final exact-head landing proof
98404c7f63e5344a6355892c5dbe87a836fd1812.4fd7064eaab9d41a1cb8c5bb16bd905843a4ffd3and exercised a disposable non-root Linux systemd user withLinger=no. Gateway and Doctor both resolved the canonical service owner, emitted account-specificloginctl enable-lingerguidance, and completed disposable-user cleanup. The proof command completed before the wrapper was cancelled during post-proof teardown.98404c7f63e5344a6355892c5dbe87a836fd1812differs from that production-proven parent only by six mock-setup lines insrc/wizard/setup.finalize.test.ts; no production file changed.98404c7f63e5344a6355892c5dbe87a836fd1812with no pending or failing selected checks.