cmux-host updater: never restart acpmux while an agent is starting

Merged
TE
19h ago
+148-7

A Cloud machine's self-updater (#36185) restarted acpmux while a chat's agent was still starting, which ended that start.

The updater waits until no session runs a turn or waits on a permission, but an agent still starting (its session/new not answered yet) matches neither, so the machine reads as idle. A fresh machine's image is older than the channel, so the update lands in its first minutes, which is exactly when the first chat starts.

Evidence, from a production test-account run (cmuxterm-hq run 42119371232, the machine's journal):

21:59:18 cmux-host: updater: profile 1 -> 2: cmux-tui a01b0efae7ce (e1d32a5b8e0b); restarting the services
21:59:18 acpmux[12128]: stopping: SIGTERM ... (a restart handoff)
21:59:19 acpmux.service and cmux-host.service restart
21:59:24 cmux-host: updater: updated ... (profile 2, serving 6 s after the flip)

Changes

  • acpmux session rows (ls, info) carry starting: true while the session's spawn lease is held. That is the same signal stop --if-idle already reads as busy("starting"). The field is left out when false.
  • cmux-host's updater (busy_sessions_in) and acpmux host update (the Mac app's in-place machine update) both wait on a starting session, the same way they wait on a turn.
  • spec/acpmux-protocol.json and the generated webview client gain the field.
  • Tests: a starting session reads as busy and a started one does not, in both update paths.

Changelog

  • Cloud: a machine updating its software no longer cuts off a chat that is still starting.

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

The updater could restart acpmux while an agent was starting, ending that start with daemon_closed. Session rows now carry starting while the spawn lease is held, and both update paths wait on it; with an older acpmux that doesn't send the field, they treat sessions created or changed within two minutes as busy.

Acpmux's SpawnLease now counts taking and releasing the lease as list changes, so a cached ls never shows a stale starting. The protocol spec and generated acpmux types are updated, with tests for both update paths and the list rebuild.