Refactor shared systemd helpers across agentd and deployer

t-807·WorkTask·
·
·
Created4 days ago·Updated4 days ago·pipeline runs →

Dependencies

Description

Edit

Reduce duplication between agentd persistent systemd management and Omni.Deploy.Systemd while preserving separate control planes.

Problem:

  • Omni/Agentd/Daemon.hs and Omni/Deploy/Systemd.hs both implement overlapping systemd mechanics (unit rendering/writing and systemctl lifecycle ops).
  • This creates drift risk for shared defaults and command semantics.

Scope:

  • Introduce a shared low-level systemd helper module (e.g. Omni/Systemd/Core.hs) for common primitives only:
  • process wrappers for systemctl/systemctl --user
  • reusable unit rendering building blocks (section/kv helpers), not policy objects
  • common write/symlink/reload helpers where semantics are truly identical
  • Keep policy and ownership boundaries separate:
  • Deployer remains manifest-driven, root/system scope
  • Agentd remains user-scope interactive runtime with per-agent env/fifo/checkpoint concerns
  • Migrate call sites in Omni/Deploy/Systemd.hs and Omni/Agentd/Daemon.hs to shared helpers.
  • Add tests covering parity of generated unit text and lifecycle command behavior for both scopes.

Acceptance:

  • No behavior change in deployer or agentd user-facing flows.
  • Reduced duplicated systemd command/unit helper code in both modules.
  • Existing tests pass; add focused tests for shared helper module.

Timeline (0)

No activity yet.