acpmux: wait for live daemon peers
Merged
TE
2d ago+291+291+012345678901234567890123456789-264-264-012345678901234567890123456789
Summary
Local acpmux CLI calls now wait while the daemon peer is alive and fail promptly when the peer is gone. Default acpmux send/new prompt collection waits for the live peer; explicit --stall and --timeout remain caller choices. Daemon handover, lock, socket and startup paths use peer liveness, with only cleanup and a documented hung-child readiness fallback bounded.
Leo's words (2026-11-04): “shouldn't be this short. no reason for this. i imagine there's other nonsensical gates like this to remove in the broader app/acpmux”.
Gates audited
| Location | Old gate | What it guarded | Verdict |
|---|---|---|---|
cmux-tui/crates/acpmux/src/cli/command.rs:249 | --stall default 30s | default prompt collection | Removed default wall-clock failure; live peer waits; explicit flag preserved |
cmux-tui/crates/acpmux/src/cli/command_new.rs:71 | --stall default 30s | new-session prompt collection | Removed default wall-clock failure; explicit flag preserved |
cmux-tui/crates/acpmux/src/daemon.rs:1255 | lock handover 60s | daemon takeover | Removed; kernel lock release is liveness |
cmux-tui/crates/acpmux/src/daemon.rs:1270,1275,1294 | connect/status/shutdown 5s/5s/10s | takeover peer calls | Removed; closed sockets fail through transport, live peers may answer later |
cmux-tui/crates/acpmux/src/daemon.rs:1393,1621 | handover 20s | start/stop handover | Removed; lock/socket liveness controls retry |
cmux-tui/crates/acpmux/src/daemon/running.rs:42 | HANDOVER_BUDGET | acpmux ls | Removed; live lock holder is retried and a released lock fails promptly |
cmux-tui/crates/acpmux/src/daemon/handover.rs:19 | HANDOVER_BUDGET | ready-fd start race | Removed; retries until lock ownership or live winner answers |
cmux-tui/crates/acpmux/src/daemon.rs:1432,1452 | systemd probe 1s | service probing | Probe timeout falls through to the real launch path |
cmux-tui/crates/acpmux/src/daemon.rs:1321 | detached readiness 8s | child that never reaches readiness | Kept as a real hung-child hazard bound, documented beside the constant |
cmux-tui/crates/acpmux/src/daemon.rs:1797, daemon/windows.rs:276 | no winner bound after losing start | hung lock winner | Restored START_BUDGET; process/lock liveness still controls ordinary handover |
cmux-tui/crates/acpmux/src/daemon/snapshot_clear.rs:12 | connect could hang forever | accepted socket that never initializes | Kept 2s initialization grace so lock-protected offline cleanup can decide safely |
cmux-tui/crates/acpmux/src/daemon.rs:1325 | shutdown exit grace | cleanup after stop/death | Kept; cleanup bound, not a live-peer answer deadline |
Regression coverage
daemon::running::tests::a_slow_but_alive_daemon_is_not_cut_off_by_the_old_budgetwaits through 120 failed probes before success.daemon::running::tests::a_closed_socket_fails_fast_even_when_the_connect_future_is_slowcovers closed/refused peer failure.daemon::running::tests::no_daemon_is_an_error_at_once_and_nothing_is_startedcovers no live peer.- Fleet green at the final exact head: fast-checks run 41829007548, tested
6c626322732c64e03f9e5502b4ef577efaec387d; 5 passed. - Earlier fleet red runs exposed and were fixed: 41815398549 (duplicate lock helper/readiness type), 41828393439 (readiness error conversion).
Changelog
Fixed: local acpmux CLI and daemon handover calls wait for live peers instead of failing on arbitrary default wall-clock limits.
🤖 Generated with Codex
Agent session: agent session