daemon: hand an auto-spawned daemon to the systemd user manager #271
No reviewers
Labels
No labels
priority/P0
priority/P1
priority/P2
release/v0.1.0
status/blocked
status/planned
type/bug
type/design
type/test-gap
type/tracker
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
natsukium/felis!271
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-261"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #261.
Implements the plan reviewed in #261 (comment) (rev 23, "Implementation scope" only).
What changes
READY=1on$NOTIFY_SOCKETright after the socket is bound;NOTIFY_SOCKETjoinsENV_DENYLISTso PTY children never inherit it; the relay's fork scrubs it too.--socket/$FELIS_SOCKETis anchored to the current directory at resolution, so the path handed to the manager is absolute. AddsRetryPolicy::MANAGED_BOOT(15 s).user@<uid>.service/,connect_or_spawn_daemonfirst asks the systemd user manager to run the siblingfelis-daemonas a transient notify service (felis-daemon-<fnv1a64(socket)>,app.slice,OOMPolicy=continue,RefuseManualStop=yes,TimeoutStartSec=15s,--expand-environment=noon systemd ≥ 254). Helper calls are bounded (3 s probes, 20 s start) andkill_on_drop. A non-zero exit spends exactly onesystemctl --user show -p ActiveStatequery:active/activatingmeans a concurrent launcher won, so the loser waits for the socket instead of forking. Everything else falls back to today's detached fork (withNOTIFY_SOCKETremoved) and oneWARNline inclient.log. Non-Linux, non-systemd, and session-scope launchers (SSH, tty) are unchanged.FELIS_SYSTEMD_TESTS=1) against a live user manager: hand-off placement read back from the unit,sessions spawn --format jsonoutput stays clean, concurrent launchers converge on one daemon; RAII cleanup of the transient unit.cli.mdAuto-spawning /--socket/ Log files, decision record insession-lifecycle.md(rationale, rejected alternatives, deferred list as Revisit-if),non-goals.mdplatform shims,spec.mdREQ-009a,testing.md,security-model.md,skills/felis/SKILL.md, CHANGELOG.Deferred per the plan (recorded as Revisit-if triggers): relay hand-off,
daemon statussupervisor field, doctor detail, linger, cgroup v1.Verification
just checkgates green on this host (fmt, clippy-D warnings, nextest 3523 passed / 16 skipped, deny, prose-check on the range, skill-check, proto-compat).FELIS_SYSTEMD_TESTS=1 cargo nextest run -p felis-cli --test cli_systemd_handoff --test-threads=1: 2 passed on systemd 261 (launcher cgroup…/[email protected]/session.slice/niri.service); no transient units left behind.$doubling / version gate, everyActiveStatebranch incl. the single-query invariant, the bounded-helper kill, and stdio isolation (test binary re-executed as a subprocess with noisy stubs).cef0d815d5b5316411b4