fix(service): do not auto-enable systemd service on install#5693
fix(service): do not auto-enable systemd service on install#5693darrenzeng2025 wants to merge 3 commits intozeroclaw-labs:masterfrom
Conversation
zeroclaw service install previously ran systemctl --user enable, causing the daemon to auto-start on every login/boot and creating port conflicts when users later tried to run zeroclaw daemon manually. Removing the enable step keeps the service installed but inactive until the user explicitly runs zeroclaw service start. Fixes zeroclaw-labs#5628
|
Hi @darrenzeng2025 — this is a service behavior change so we need more context. Please update to follow our PR template — specifically Summary, Validation Evidence, Compatibility/Migration (since this changes systemd behavior), and Rollback Plan. Thanks! |
Reviewer Verdict: Needs author action0.7.0 Relevance Check
Comprehension SummaryRemoves the Security Assessment
Findings[suggestion] Cross-platform inconsistency. This PR only removes auto-enable for systemd. Other init systems still auto-start at boot/login:
After this change, systemd users get "install ≠ auto-start", but OpenRC/macOS/Windows users still get auto-start. Either align the other paths with the new contract, or scope the PR title/body to clarify it is systemd-only by design. [question] No path for users who want auto-start. [nit] PR body label mismatch. Body's "Label Snapshot" claims [nit] Validation evidence. Body lists Rollback StorySingle-line revert; clean. No state migration. Acceptable. |
singlerider
left a comment
There was a problem hiding this comment.
Comprehension Summary
Removes systemctl --user enable zeroclaw.service from install_linux_systemd so that zeroclaw service install no longer auto-starts the daemon on login. Blast radius: service install behavior, systemd path only. Closes #5628.
Template Issues
- Label mismatch: PR body claims
risk: low; the applied label isrisk: high.service/mod.rsis in the runtime crate —risk: highis correct. Update the Label Snapshot section. - Validation evidence: Body lists
cargo fmt/clippy/testbut acknowledges the local build was blocked bylibsqlite3-sys. State explicitly that none of the three commands ran to completion rather than listing them as run.
Security / Performance
Strictly reduces surface area — removes one shell-out. No new injection or privilege risk. No unit-template content changed.
|
|
||
| fs::write(&file, unit)?; | ||
| let _ = run_checked(Command::new("systemctl").args(["--user", "daemon-reload"])); | ||
| let _ = run_checked(Command::new("systemctl").args(["--user", "enable", "zeroclaw.service"])); |
There was a problem hiding this comment.
[blocking] This removes enable for systemd only. Three other init paths still auto-start on install:
install_linux_openrccallsrc-update add zeroclaw default— the OpenRC equivalent ofsystemctl enableinstall_macoswrites a plist withRunAtLoad=true+KeepAlive=trueinstall_windowsregisters a scheduled task with/SC ONLOGON
After this change, systemd users get "install ≠ auto-start" while all other platforms still auto-start. Either align the other init paths to the same contract or explicitly scope this PR as systemd-only in the title, body, and a code comment here.
[question] There is no CLI path for users who want the service to survive a reboot. start_linux_systemd only runs systemctl --user start, never enable. Consider adding zeroclaw service install --enable (opt-in) or at minimum documenting the manual workaround (systemctl --user enable zeroclaw.service) in the post-install output.
Summary
masterzeroclaw service installpreviously ransystemctl --user enable, causing the daemon to auto-start on every login/boot.zeroclaw daemonmanually, and violated the expectation that "install" does not imply "auto-start".enablestep fromzeroclaw service install; the service remains installed but inactive until the user explicitly runszeroclaw service start.start/stop/uninstallcommands or any service-unit template content.Label Snapshot
risk: lowservicebugserviceLinked Issue
Validation Evidence
cargo fmt --all -- --check cargo clippy --all-targets -- -D warnings cargo testcargo buildcould not be fully validated due to a pre-existing toolchain issue (libsqlite3-syscompilation failure on this host). The change is isolated to the service-install command path.Compatibility / Migration
zeroclaw service startexplicitly.Human Verification
installcommand flow to confirmenableis removed andstartis unaffected.cargo testrun due to locallibsqlite3-sysbuild failure.Side Effects / Blast Radius
zeroclaw service installbehavior.Rollback Plan
git revertthe single commit on this branch.Risks and Mitigations
None.