acpmux host update (Linux): detect a daemon that survived its shutdown by its pid
Follow-up to #22899, which merged before its re-review finished.
On a Linux host, acpmux host update shuts down a detached daemon and hands it over to acpmux.service. #22899 added a check meant to stop the update with an error (exit 4) when the old daemon survives its shutdown. That check looked for "running": true in acpmux --json daemon status, but a live daemon's status never has a running key (only pid, version, ready and so on). The only running key is "running": false on the not-running path. So against a real daemon the check never fired: the update reported success while the old daemon kept serving and acpmux.service failed to take the lock.
The check now looks for the live daemon's pid, the same field the foreign-unit check already reads. The test's fake acpmux now prints the real status shape (version, pid, ready, no running).
Changelog
none
Observed / Not run
cargo test -p acpmux --lib cli::hosts::tests::a_daemon_that_outlives, with the realistic fake and the old check: FAILED (panic at hosts.rs:749, enable ran). With the fix: all 7cli::hoststests pass on huge-blue.- Not run: a live update against a real surviving daemon.
Agent session: huge-blue
๐ค Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes acpmux host update on Linux so it stops with an error when the old daemon survives its shutdown.
The previous check looked for "running": true in acpmux --json daemon status, but a live daemon never reports that key โ only a stopped one reports "running": false. The check now looks for the daemon's pid field instead, matching the actual status output. The test fake was updated to emit the realistic status shape.