Skip to content

agent_ui: Show each linked message to an ACP subagent as its own card - #66102

Open
benbrandt wants to merge 1 commit into
acp-session-message-linksfrom
acp-subagent-delegation-cards
Open

benbrandt wants to merge 1 commit into
acp-session-message-linksfrom
acp-subagent-delegation-cards

Conversation

@benbrandt

@benbrandt benbrandt commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Stacked on #66101 (linked session message views). Item 6 part 2 of the ACP subagents RFD work.

Until now an ACP parent's first message to a subagent was drawn as one card for the whole subagent, and later messages stayed "To …" rows. Native subagents get one card per spawn_agent call. This PR gives ACP subagents the same: one card per delegation.

Which messages are cards

Status of earlier cards
The subagent reports one state for all its work, and the protocol has no per-message outcome. So:

  • A card for an earlier message shows the first idle state the subagent reported after receiving it. That idle ended the message's work.
  • Until that idle arrives, the earlier card shows the current state, like the latest card. That is the case when a message arrives while the subagent is still working on the previous one, so both are part of the same run.
  • AcpThread records each idle state an ACP subagent reports, with its entry count at that time, for this (subagent_outcome_after). Replayed states are recorded in order, so earlier cards keep their outcome after a reload.
  • The latest card and the child's titlebar still show the current state. Stop still needs a running subagent that advertises cancel.

Not changed: a card's full-screen button opens the subagent where it was last scrolled, as for native cards. The row link from #66101 jumps to the linked entry; doing the same here would also change native cards, so I've left it as a follow-up.

Testing

  • test_each_linked_message_to_an_acp_subagent_is_its_own_card:
    • two delegations, the second arriving while the first is still running: both cards show their part and are running;
    • then a refusal and a third delegation: the first two cards show Failed and the third Running;
    • an unlinked fourth message stays a row.
  • That test fails with the per-delegation slices disabled, and with earlier cards using the current state.
  • test_first_message_to_an_acp_subagent_shows_its_card (unlinked messages) passes unchanged.
  • cargo nextest run -p acp_thread -p agent_servers -p agent_ui -p agent -p sidebar (2021 tests, rebased on main after Update agent-client-protocol to 3.6.0 (schema 1.13) #66245), ./script/clippy and cargo fmt pass locally.
  • Not tried in the running app.

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Oct 24, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Oct 24, 2026
@benbrandt
benbrandt added this pull request to stack #66108 October 25, 2026 06:08
Every message an ACP parent sends to one of its subagents that is linked
to the subagent's view of it is now drawn as a subagent card, like each
native spawn_agent call. The card covers its part of the subagent's
transcript: from the linked view up to the next message from the parent.
Without a link, only the first message gets a card, which covers the
whole subagent, as before.

The subagent reports one state for all its work, and the protocol has no
per-message outcome. A card for an earlier message therefore shows the
first idle state the subagent reported after receiving it, which ended
that message's work; until then it shows the current state, as the
latest card does. AcpThread records each idle state an ACP subagent
reports, with its entry count at the time, for this.
@benbrandt
benbrandt force-pushed the acp-subagent-delegation-cards branch from ad00b90 to 19ae01f Compare October 28, 2026 13:12
@benbrandt
benbrandt removed this pull request from stack #66108 October 28, 2026 13:13
@benbrandt
benbrandt added this pull request to stack #66249 October 28, 2026 13:13
@benbrandt
benbrandt marked this pull request as ready for review October 28, 2026 13:30
@benbrandt
benbrandt requested a review from bennetbo October 28, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant