Agent pane: Reply in place on another agent's message card

Merged
TE
15d ago
+1298-32

Stacked on #22013 (cx-eibkk), which adds the incoming message card. Until #22013 merges, this diff includes its commits; the commits for this change are the four after 6e023b286ed. Merge after #22013.

Bead: cx-kybz1

What

Another agent's message card in the agent pane gets Reply (button, or R with the card focused; Escape closes it unsent). The reply goes to the sending chat the way send_to_session sends a message: a session/prompt to that chat with an agent_message provenance naming this chat, the message's threadId, and replyTo set to the message. It lands in the sender's chat as this chat's threaded reply.

acpmux

Only the unix socket could send provenance before. Now the app's own pane (Origin::LocalApp) can send one too, but only as a reply:

  • replyTo has to be set, and to has to be the prompt's chat;
  • from has to be another chat of this daemon whose log has the agent_message with that msgId, sent by to (Hub::app_reply_fits). A cmux agent message sender (acp:<id>) matches by its bare id.

Web clients and peers are still refused (provenance.origin_refused). The shared pane policy now lists provenance under session/prompt's _meta.acpmux, matching the Swift table. The check lives in hub/withdraw.rs so requests.rs stays within its god-file budget.

Tests

  • webviews/test/agent-pane-suggested-tasks.test.ts › messages from other agents: Reply sends the right session/prompt (sender chat, threadId, replyTo, provenance); R opens the reply and Escape closes it unsent; a Claude Code envelope's card has no Reply.
  • cmux-tui/crates/acpmux/tests/hub_integration/prompt_provenance.rs › the_app_pane_may_send_a_reply_from_a_chat_here_and_nothing_else: the app pane's reply to a received message is recorded with its provenance. These are refused: no replyTo, a message the chat never got, a sender that isn't a chat here, the prompt's own chat as sender, a to that isn't the prompt's chat, and any reply from a web client.
  • Gallery entry agent-pane.incoming-message (short, long).

Review: SHIP at c426d09217c4 (independent cmux-review subagent; correctness first)

Proof

Gallery stage agent-pane.incoming-message/short. The card with Reply (R):

card

With the reply open in place:

reply open

🤖 Generated with Claude Code