cmux link agent move: stop a running turn only where it goes on; never mid-compaction

TE
5d ago
+69-1

Follow-ups 2 and 3 of #30460, from the review of #30280 (receipt https://github.com/manaflow-ai/cmux/pull/30280#issuecomment-6555072858). That work is for cmuxterm-hq#5846 item 1. Leo, 2026-11-01: "those all seem good".

What changes

Since #30280, Move to Cloud and Bring Back Local always pass --interrupt, so a move stops a running turn and acpmux continues it where the chat lands. Two cases lost work:

  • An older source daemon (an un-updated Cloud machine on Bring Back) stopped the turn and queued no continuation, so the turn ended for good. The daemon now lists agent-transfer-continues-v1 beside the transfer verbs. The pump (cmux link agent move) sends interrupt only to a source whose identify lists it. Any other source gets no Stop and refuses the move while the turn runs (transfer.busy), as before #30280.
  • A move while Claude compacts. The Stop's compaction branch (cancel.rs) withdraws the person's queued prompts. transfer_begin with interrupt now refuses while the chat is compacting (transfer.busy: the chat is compacting; move it once that ends), before anything is logged or stopped. The check is the same one cancel.rs makes.

spec/commands.md says both.

Tests

  • tests/link_agent_move.rs a_running_turn_is_stopped_only_on_a_source_that_continues_it: an older source's begin gets interrupt: false, one that lists the capability gets true, and with no flag it is never set.
  • tests/cli/agent_session_start.rs: a daemon that serves transfer lists agent-transfer-continues-v1.

cmux-ci receipt below.

Follow-ups (from its review, kept in #30460)

  • acpmux, not the daemon beside it, should say it continues a stopped turn: on a Cloud VM the two can update apart.
  • An acpmux test of the compaction refusal.
  • The narrow window between the compaction check and the Stop.

Changelog

none

🤖 Generated with Claude Code

Agent session: agent session


Summary by cubic

Fixes cmux link agent move so a move never stops a running turn unless the source's acpmux continues it where the chat lands, and never stops one mid-compaction.

  • The daemon now lists agent-transfer-continues-v1; the pump sends interrupt only to a source that lists it. An older source (an un-updated Cloud machine on Bring Back) would stop the turn for good, so there the move is refused while the turn runs, as before --interrupt.
  • A move with --interrupt is refused (transfer.busy: the chat is compacting) while the chat compacts, since the Stop would withdraw the person's queued prompts.
  • Both cases (and the capability) are documented in spec/commands.md.