Skip to content

feat(cli): commonly daemon install — the login service (ADR-026 D1) - #1570

Merged
lilyshen0722 merged 6 commits into
mainfrom
feat/daemon-install
Sep 6, 2026
Merged

lilyshen0722 merged 6 commits into
mainfrom
feat/daemon-install

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

ADR-026 D1's "installed once": after commonly daemon register + commonly daemon install, the machine needs no terminal ever again — the daemon starts at login, launchd/systemd restarts it if it dies, and every reboot brings the whole supervised seat set back (the failure class that silently killed 22 fleet seats twice on 2026-09-03).

What changed

  • macOS: writes ~/Library/LaunchAgents/me.commonly.daemon.plist (KeepAlive + RunAtLoad, logs to ~/.commonly/logs/daemon/daemon.log), launchctl load -w. Same shape as the proven fleet-supervisor agent.
  • Linux: ~/.config/systemd/user/commonly-daemon.service (Restart=always), systemctl --user enable --now.
  • Both run the exact interpreter + CLI entry that executed the install, resolved at install time — a PATH lookup at boot races version managers and silently runs a different install than the one the user tested. The unit's PATH deliberately carries homebrew for the children: seats spawn the user's claude/codex by name, and under launchd's default PATH the daemon comes up healthy while every seat dies at adapter detection.
  • install refuses without a registered daemon credential (the service would just crash-loop); a failing launchctl load surfaces as an error, never as success. daemon uninstall unloads and removes; nothing installed is a no-op.

Verification

8 new tests (unit content: label/argv/KeepAlive/PATH/log paths; darwin + linux install flows; load-failure surfacing; uninstall + no-op) with every side effect injected. Full CLI suite 431 green, lint clean. cli → 0.1.35 (0.1.33 claimed by open #1561, 0.1.34 by #1568).

Not in scope: actually migrating the operator fleet (D7) — that's a deliberate, careful step because the mint-rotate path can kill live seats.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT

`commonly daemon install` registers the resident daemon as a login service:
a launchd LaunchAgent on macOS (KeepAlive — launchd restarts a dead daemon),
a systemd user unit on Linux (Restart=always). Both run the exact
interpreter + CLI entry that executed the install, resolved at install time —
a PATH lookup at boot would race version managers and silently run a
different install than the one the user tested. The unit's PATH carries
homebrew for the CHILDREN: seats spawn the user's claude/codex by name, and
launchd's default PATH would kill every seat at adapter detection while the
daemon itself looked healthy.

Install requires a registered daemon credential (a service without one just
crash-loops at boot). `daemon uninstall` unloads and removes; a failing
launchctl load surfaces instead of reporting success. 8 new tests on the
generated units and both flows, side effects injected. cli 0.1.34 → 0.1.35
(0.1.33 is claimed by open #1561, 0.1.34 by #1568).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT
@lilyshen0722
lilyshen0722 merged commit 3c58787 into main Sep 6, 2026
13 checks passed
@lilyshen0722
lilyshen0722 deleted the feat/daemon-install branch September 6, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant