Repository navigation
docs(gateway): run Linux system services as the state owner - #136266
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 12:53 AM ET / 04:53 UTC (Revision 4). ClawSweeper reviewWhat this changesClarifies that Linux system services should run as the non-root account owning OpenClaw state and explains the existing 330-second shutdown allowance. Merge readiness✅ Ready for maintainer review Keep open: the service-account clarification remains useful and is absent from current main and the latest release. No actionable patch defects remain; the earlier group/home concern is resolved. The protected security label also precludes automated closure. Priority: P2 Review scores
Verification
How this fits togetherLinux systemd starts and supervises the Gateway under a selected operating-system account. That account’s home and explicit environment overrides determine which OpenClaw configuration and state the Gateway reads. flowchart LR
A[Operator writes service unit] --> B[Select state-owning account]
B --> C[systemd starts Gateway]
D[Home and path overrides] --> C
C --> E[Read configuration and state]
C --> F[Drain work before shutdown]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceDocs +24. Total +24 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep service-account selection explicit before activation while retaining systemd-derived home/group defaults and the existing managed shutdown settings. Do we have a high-confidence way to reproduce the issue? Not applicable to this documentation-only patch; source and systemd manuals substantiate the account-selection and timeout statements without executing a service. Is this the best way to solve the issue? Yes. Adding User= guidance at the system-service setup step addresses the omission without introducing runtime changes or hardcoded group/home assumptions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9636ae49e001. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
30aed1f to
ddf4232
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
The "Linux (system service)" tab told operators to reuse the user-unit body under /etc/systemd/system without User=, Group=, or HOME. Such a unit runs as root with no home, so the Gateway looks for its config under /root/.openclaw, exits with code 78 (Missing config), and RestartPreventExitStatus=78 keeps it stopped. The tab now adds the owning account to [Service], says the Gateway must not run as root, and points at loginctl enable-linger plus the user unit as the supported boot-without-login path. Both hand-written unit examples also carried TimeoutStopSec=30 while the managed unit renders 330 so systemd does not SIGKILL the five-minute stop and restart drain. Both examples now use 330 with a one-line reason. Related: openclaw#123872
Drop the Group= and Environment=HOME= lines from the system-service snippet; systemd supplies the primary group and home directory from User=, and an explicit /home/<user> value would override accounts whose home lives elsewhere.
ddf4232 to
e606747
Compare
|
Thanks @yetval! The Linux system-service instructions now require the non-root state owner before activation, explain the default group and home behavior, and retain the supported state/configuration overrides. Both examples preserve the current 330-second stop allowance and managed-unit fields, with the drain and teardown reserve explained. Validation: complete source/systemd-manual review, formatting and MDX checks for both pages, green hosted CI, and clean final exact-head review. No runtime or service behavior changed. The stale server comparison was restored with one same-base refresh at the unchanged signed head. Dependency Guard then passed against the actual two-file documentation contribution; no dependency approval or policy override was used. Merged as |
Related: #123872
What Problem This Solves
Operators following the Linux system-service example could omit
User=and run the Gateway under the root account instead of the account that owns its state and configuration.Why This Change Was Made
The system-service instructions now require the state-owning non-root account before enabling the unit. They explain systemd's primary-group and default home behavior, preserve the explicit state/configuration path controls, and warn against using root's home as a workaround.
Both unit examples retain the current managed fields, including
TimeoutStopSec=330,OOMPolicy=continue, andKillMode=mixed. The added explanation connects the stop allowance to the five-minute cooperative drain and teardown reserve. Existing Doctor ownership, user-unit lingering, and profile naming guidance remain intact.User Impact
Operators can configure the service account and locate the intended state before starting the Gateway. The examples explain the existing shutdown allowance without changing service behavior.
Evidence
git diff --checkpassed.Only two documentation pages change. No Gateway, service, configuration, shutdown, or runtime behavior is modified or operated by this repair. The original contributor commits are preserved.