acpmux: inter-session messages steer a running turn

Merged
TE
17d ago
+101-15

Summary

A message sent from one agent session to another waited for the recipient's running turn to end, which can take minutes, before the recipient read it. Now a message steers into the running turn when the recipient's agent supports steering, and queues behind the turn otherwise:

  • acpmux send --no-wait steers by default; --no-steer queues instead. A send that waits for its reply still queues unless given --steer, because a steer is answered as soon as the agent reads it, before the reply. With --no-wait it prints steered or queued, and --json gains steered.
  • The cmux agent message pump hands messages to acpmux sessions with steer: true.
  • chief tell sends its prompt to a child with steer: true.

Provenance is unchanged. Sub-session send_message is out of scope: the subsession-visibility lane (cmux/subsession-visibility) already makes it steer.

Testing

Regression: cmux-tui.yml focused, test_filter=the_pump_delivers_a_queued_message.

New unit tests: send_steers_messages_by_default_and_queues_waiting_sends (acpmux) and a_message_to_a_child_steers_its_running_turn (optchat-chief). PR CI runs them.

python3 scripts/cmux-next/prepush-gate.py: no new violations.

Observed / Not run

Observed: the focused runs above and the pre-push gate.
Not run: a live steer between two real sessions in a tagged build. The steer path itself (prompt_with with steer) is the existing one that acpmux send --steer already uses.

Changelog

Changed: Messages between agent sessions reach a busy recipient's running turn at once when its agent supports steering, instead of waiting for the turn to end

Proof

CLI and daemon behavior only; see Testing.

Agent session: cosmic-gray

🤖 Generated with Claude Code


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


Summary by cubic

Messages between agent sessions previously waited for the recipient's running turn to end—which could take minutes—before being read. Now a message steers into the running turn when the recipient's agent supports steering, and queues behind the turn otherwise. A steer without interrupt never stops a turn whose agent cannot steer; it queues and waits for the turn to end.

  • acpmux send --no-wait steers by default; --no-steer queues instead.
  • A send that waits for its reply still queues unless given --steer.
  • --no-wait prints steered or queued, and --json gains a steered field.
  • queued is reported from the hub's decision, so a pending permission no longer shows queued when the agent steers.
  • The cmux agent message pump and chief tell now send messages to agents with steering enabled.