Skip to content

fix(#894): detect systemd-supervised sync engines - #1006

Open
joelmitz wants to merge 2 commits into
fujibee:mainfrom
joelmitz:fix/894-systemd-engine-detection
Open

fix(#894): detect systemd-supervised sync engines#1006
joelmitz wants to merge 2 commits into
fujibee:mainfrom
joelmitz:fix/894-systemd-engine-detection

Conversation

@joelmitz

Copy link
Copy Markdown
Contributor

Summary

Fixes the duplicate-engine failure described in #894.

  • Add a shared systemd user-unit probe based on LoadState, ActiveState, SubState, and MainPID.
  • Reuse the probe from status and sync start.
  • Treat verified active units as running, active units with unverified identity as unknown, and inactive/failed units as systemd-owned.
  • Keep the existing pidfile path for teams without a systemd unit.
  • Keep stop/reap and internal pidfile lifecycle operations scoped to pidfile-owned engines.
  • Add fake-systemctl characterization coverage for verified, duplicate-prevention, unknown-identity, and inactive states.

Design

The probe validates the MainPID liveness and the exact remote-sync engine/team argv before calling an active unit running. If the unit is active but identity cannot be verified, sync start fails closed instead of creating an unmanaged duplicate. If the unit is inactive or failed, sync start refuses and directs the operator to the systemd user unit.

A hook-only change would miss direct sync start callers. Writing a pidfile from the service would reintroduce pidfile ownership and TOCTOU risks. Therefore the ownership probe is shared at the remote CLI boundary.

Related: #894

joelmitz added a commit to joelmitz/agmsg that referenced this pull request Aug 28, 2026
fix(fujibee#894): detect systemd-supervised sync engines (local patch, upstream PR fujibee#1006 pending)
@joelmitz
joelmitz force-pushed the fix/894-systemd-engine-detection branch from 3a1cf8e to 0ba9d1c Compare September 12, 2026 15:48
@joelmitz joelmitz closed this Sep 12, 2026
@joelmitz joelmitz reopened this Sep 12, 2026
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.

2 participants