Repository navigation
fix(systemd): KillMode=process preserves retained Codex sidecars across unit restarts - #847
Merged
Merged
Conversation
…ss unit restarts The server's graceful shutdown deliberately retains adopted terminal-pane Codex sidecars (SAFE-11), but systemd's default KillMode=control-group (and the live host's explicit one) kills them after the main process exits — every systemctl restart destroyed in-flight Codex conversations. - Ship KillMode=process in the unit (accepted trade-off, matching the setsid launcher's crash semantics: a crashed server's children are not reaped by systemd). - Point the SAFE-11 comment in main.rs at the shipped setting instead of a hypothetical adoption note. - Update the runbook's unit-coupling note: retention survives unit restarts when the installed copy carries the line; verify + re-copy + daemon-reload guidance included. Config/comment/doc only; no executable behavior changed in-repo. Host install staged separately (daemon-reload done; effective at the next approved restart).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The server's graceful shutdown deliberately RETAINS adopted terminal-pane Codex sidecars across restarts (SAFE-11 — "killing sidecars at shutdown is NOT acceptable; surviving restarts is a feature",
crates/freshell-server/src/main.rs). But systemd's defaultKillMode=control-groupsignals every remaining process in the unit's cgroup after the main process exits — so everysystemctl --user restart freshell-rustslaughtered exactly the sidecars the server just saved, destroying in-flight Codex conversations. The live host's installed unit even pinnedKillMode=control-groupexplicitly.installers/systemd/freshell-rust.service: shipKillMode=process(signal only the main process). Accepted trade-off, documented in the unit: a CRASHED server's children are not reaped by systemd — matching the setsid launcher's crash semantics. Verified withsystemd-analyze verify.crates/freshell-server/src/main.rs: the SAFE-11 comment now points at the shipped setting (its old text said the unit "is NOT installed today" — stale, and this host's production server runs under the unit).docs/development/self-hosted-launch-runbook.md: the unit-coupling note now says retention survives unit restarts when the installed copy carries the line, with verify/re-copy/daemon-reload guidance.Config/comment/doc only — no executable behavior changed in-repo.
Validation
systemd-analyze verifypasses on the modified unit.rust-tests/rust-gaterun them).daemon-reloadd (staged, no restart — effective at the next approved restart);systemctl --user show freshell-rust -p KillModenow reportsprocess.