Skip to content

Sonny triggers from different HOMEs share one launchd domain and label namespace #453

Closed

Description

@lydakis

On macOS, sonny/src/trigger.rs writes a trigger's plist under $HOME/Library/LaunchAgents. It then bootstraps the plist into gui/<uid> with the label me.lydakis.agent.trigger.<name>. The domain and the label depend only on the uid, never on HOME. So two Sonny setups under one user, each with its own HOME, store and daemon, share both the launchd domain and the label namespace. Test HOMEs and evals are the usual case.

Seen in a role eval (bench/role_eval.py): each run gets its own fake HOME, daemon and socket, yet triggers its leads added (shop.lead.next, a weekly reminder) were loaded in the real user's gui/<uid>. They were unloaded before they fired. What can go wrong:

  • A job from a throwaway HOME stays loaded in the real user's launchd after its HOME is deleted, and fires into nothing or starts a daemon there.
  • Two HOMEs with a trigger of the same name overwrite each other's job, or one's rm boots out the other's.
  • A test HOME can replace or remove a real trigger of the same name.

Options:

  1. Put something unique to the store or HOME in the label, such as a short hash of the store id (me.lydakis.agent.trigger.<hash>.<name>), so each setup owns its labels. That costs a one-way migration of existing labels.
  2. A switch that keeps triggers out of launchd and systemd, for tests and evals, where the trigger runs from a scheduler the HOME owns or not at all.
  3. Both: (1) for correctness, (2) so evals never touch the user's session.

Until then, bench/role_eval.py will remove each run's triggers when the run ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions