Skip to content

mini: auto-handoff: run as a Home Manager agent - #53

Merged
Jish2 merged 1 commit into
mainfrom
fix/auto-handoff-user-agent
Oct 21, 2026
Merged

Jish2 merged 1 commit into
mainfrom
fix/auto-handoff-user-agent

Conversation

@Jish2

@Jish2 Jish2 commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Follow-up to #52. After the switch, the watcher's first run failed with ModuleNotFoundError: handoffs, and its log was owned by root.

Cause: nix-darwin's activation runs as root and launchctl loads /Library/LaunchAgents/*.plist. That loads the agent into the system domain (launchctl print system/org.jgoon.auto-handoff shows type = LaunchDaemon). So it ran as root with HOME=/var/root: no catch-up skill and no login Keychain.

Fix: declare it through home-manager.users.<user>.launchd.agents. Home Manager writes ~/Library/LaunchAgents/org.jgoon.auto-handoff.plist and bootstraps it into gui/<uid> as the user. On the next switch, nix-darwin removes and unloads the old /Library/LaunchAgents copy.

Checked with nix eval: mini now has no nix-darwin launchd.agents, the job is under Home Manager's, and HM's activation bootstraps into gui/$UID.

Not fixed here: fleet.herdr (non-daemon mode, used on work/personal) and fleet.keepAwake use the same nix-darwin launchd.agents path, so they're probably loaded as root too until the next login.

🤖 Generated with Claude Code

…stem agent

nix-darwin's activation runs as root and launchctl-loads /Library/LaunchAgents
into the system domain, so the job ran as root (HOME=/var/root): no catch-up
skill, no login Keychain. Home Manager bootstraps it into gui/<uid> instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jish2
Jish2 merged commit f0879b7 into main Oct 21, 2026
2 checks passed
@Jish2
Jish2 deleted the fix/auto-handoff-user-agent branch October 21, 2026 00:39
@claude

claude Bot commented Oct 21, 2026

Copy link
Copy Markdown

Claude review: skipped (PR is already merged/closed)

Checked only the PR state; no code review was run.

Not approved: the PR is closed, so there is nothing left to approve.

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