acpmux: a tagged DEV build never takes NIGHTLY's daemon home from an agent shell

Merged
AU
3d ago
+442-14

Fixes https://github.com/manaflow-ai/cmux/issues/29050

What

A tagged DEV build no longer adopts NIGHTLY's acpmux home (or another build's) from an inherited ACPMUX_HOME.

Every agent under acpmux inherits ACPMUX_HOME=~/.acpmux and ACPMUX_SOCKET from its daemon. When an agent launched a tagged DEV app from its shell, AcpmuxEnvironment.resolve let that inherited pair win over the build's own ~/.acpmux/builds/<key>. The DEV app then found NIGHTLY's daemon on that socket, saw another build, and AcpmuxVersionHandoff shut it down and started the DEV build's daemon on NIGHTLY's home. NIGHTLY's new chats then waited on wait_startup while the DEV daemon re-adopted about 100 agent hosts, so the composer looked hung. The 2026-10-14 fix covered an inherited socket alone, not the home-and-socket pair.

How

  • AcpmuxEnvironment.inheritsAnotherBuildsHome (Swift) and environment::inherits_another_builds_home (Rust policy): a build whose own home is not the shared root ignores an ACPMUX_HOME that names the root or <root>/builds/<other key>, and drops the socket that came with it.
  • Homes outside ~/.acpmux (Chief brain homes, tests) still win. NIGHTLY and unbundled runs are unchanged. Reading NIGHTLY's chats from a DEV build is still CMUX_NEXT_ACPMUX_ATTACH, which never hands off.
  • New shared cases in tests/cases/environment.json, run by the Swift resolveMatchesTheSharedCases and the Rust parity test, plus AcpmuxHomeIsolationTests.anInheritedNightlyHomeAndSocketPairIsAnotherBuilds.

Testing

The regression commit (e23d571e4a1c) comes before the fix.

  • Swift, cmux-ci run --class light --script scripts/ci/package-test-lane.sh --arg suite --arg Packages/macOS/CmuxNext --arg AcpmuxHomeIsolationTests:
    • Red on e23d571e4a1c (step 8f7a8727a305e3be03ba7478, aws-m4pro-4). anInheritedNightlyHomeAndSocketPairIsAnotherBuilds and resolveMatchesTheSharedCases fail because the DEV build resolved /Users/me/.acpmux (and .../builds/com.cmuxterm.app.debug.other) instead of its own home.
    • Green on 587c4be7fcfe (step d03e996509590aa7264bf671, aws-m4pro-6): AcpmuxHomeIsolationTests passed.
  • Rust, rbx -- cargo test -p cmux-agent-pane-policy --test parity --locked:
    • Red with the fix reverted: environment_tokens_and_sockets fails on "a tagged DEV build ignores NIGHTLY's home and socket inherited from an agent shell (cmux#29050)".
    • Green on 587c4be7fcfe: 16 passed.

Observed / Not run

  • Observed on the reporter's Mac: daemon.log shows NIGHTLY's daemon shutting down, then a daemon from /private/tmp/.../cmux DEV 28978-chief-zoom-base.app listening on ~/.acpmux/acpmux.sock with DEV daemon: stops after 3600s, and its environment held ACPMUX_HOME=~/.acpmux. New sessions created during re-adoption took 20-80 s, and acpmux ls timed out. A graceful acpmux daemon shutdown (103 agent hosts kept) brought NIGHTLY's own daemon back.
  • Not run: a tagged-build dogfood that launches a DEV app from an agent shell. The change is confined to environment resolution, which the unit cases cover.

Review

Review (claude-subagent): SHIP at 587c4be7fcfec96fa9a53b370d617dc42909fe8d

My own check of the exact head: I read the diff, the local, remote and PR heads match, the Swift suite builds and passes on this head (cmux-ci step d03e996509590aa7264bf671), and the Rust parity tests pass (16/16).

Changelog

Fixed: Starting a cmux NEXT development build from an agent's terminal no longer takes over the nightly's agent daemon and stalls new chats.

šŸ¤– Generated with Claude Code