optchat-chief: Chief survives an update handoff while the old acpmux still holds its lock

Merged
AU
6d ago
+368-16

Chief can remain unavailable after an app update when its old acpmux daemon still holds daemon.lock. The new host now waits for the lock and retries startup within a 60-second limit. If another starter makes the socket available while retaining the lock, the host adopts that daemon without claiming ownership. Stopping the host cancels the lock wait; shutdown allows 65 seconds for an in-flight start.

The socket-adoption path fixes the blocking review finding: a running daemon retains its lock, so waiting only for lock release could otherwise time out despite a healthy socket.

Validation

Head: 48fbb8f4eb3c3bca2d076e307bf79cdc9e679af8.

  • cmux-ci Rust step fa8ae898550f751845276f06: scripts/ci/cmux-tui-rust-check.sh optchat-chief a_local_host passed all four selected startup tests, Clippy with warnings denied, and rustfmt.
  • cmux-ci app compile 58fc338bdea81127618ac66e: passed.
  • The new lock-held socket-adoption regression failed with a timeout before the repair at 39433409b02c696913497ea65d16332ea19f608e (step 779fb851c2e8020ec6a2d35e) and passes at this head.
  • Independent correctness subagent review: PASS at this exact head. Pre-push static checks passed.
  • Chief first-turn cost step 8b13a39e416efd1ab5778830: passed at 17,773 estimated tokens against a 50,000 limit. The token-count service returned HTTP 502, so the gate used its documented local estimate.

Observed / Not run

The behavior tests use isolated fake daemon executables, Unix sockets, and a real file lock. The full Chief test suite and a live app-update handoff were not run. No capture: this changes background daemon startup, with no visible UI changes.

Performance

No perf numbers: this repairs a bounded background startup race; no performance benchmark or main-thread profile was run.

Changelog

Fixed: Chief keeps answering after cmux updates when an older daemon is still stopping or another starter brings the daemon up first.