# acp_thread: Separate submission receipts from session activity \(\#64930\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/39b5329322f4d2c14dc8fd6db535a31ac5431770)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 39b5329322f4d2c14dc8fd6db535a31ac5431770

Requested commit: 39b5329322f4d2c14dc8fd6db535a31ac5431770

Commit: 39b5329322f4d2c14dc8fd6db535a31ac5431770

Tree: a353c92fcfeb76caa81ed09a97aab40c9b44b6b0

Author: Ben Brandt

Committer: GitHub

## Message

```
acp_thread: Separate submission receipts from session activity (#64930)

Separate prompt submission from session activity without enabling v2
transport. A receipt acknowledges acceptance; it does not mean the agent
has finished working.

- Select an optional, session-bound receipt capability before sending.
Existing v1/native connections retain completion-based prompt behavior.
- Give submissions and foreground activity separate owners. Submission
records own response tasks, IDs, echo correlation, and recoverable
content; activity owns Running/RequiresAction/Idle state, timing,
generations, and cancellation waiters.
- Keep receipt-driven pending text outside the transcript. Only agent
echoes create canonical user messages, with receipt/echo correlation
working in either order. Pending and failed submissions have recovery
controls; restoring an editable copy keeps the original until explicit
Discard.
- Carry generation, duration, and stop reason in completion events.
Stale events cannot advance a newer activity's queue or display old
errors. Timers also reconcile correctly when Running and Idle arrive
before the UI observes either transition.
- Preserve legacy completion/cancellation semantics while running
completion directly in the record-owned task, removing a redundant
task/channel bridge. Native subagent and eval consumers explicitly
require completion rather than accepting a receipt as a finished run.

## Review guide

This is a cross-layer lifecycle change, not a wire adapter. Suggested
review order:

1. [Submission and activity
ownership](https://github.com/zed-industries/zed/blob/279f0074bae5ec7e85acac363fcadbefb04de6d5/crates/acp_thread/src/submission.rs#L98):
retention, echo correlation, task ownership, and idle waiters.
2. [Core
settlement](https://github.com/zed-industries/zed/blob/279f0074bae5ec7e85acac363fcadbefb04de6d5/crates/acp_thread/src/acp_thread.rs#L3910)
and [legacy turn
completion](https://github.com/zed-industries/zed/blob/279f0074bae5ec7e85acac363fcadbefb04de6d5/crates/acp_thread/src/acp_thread.rs#L5765):
receipt settlement must not finish activity; cancellation still waits on
the transport task.
3. [UI activity
reconciliation](https://github.com/zed-industries/zed/blob/279f0074bae5ec7e85acac363fcadbefb04de6d5/crates/agent_ui/src/conversation_view/thread_view.rs#L1446)
and
[recovery](https://github.com/zed-industries/zed/blob/279f0074bae5ec7e85acac363fcadbefb04de6d5/crates/agent_ui/src/conversation_view/thread_view.rs#L1533):
queue/error ownership, batched updates, and recoverable originals.

The receipt capability defaults to absent. Existing agents still use
optimistic v1 messages and completion-based send/command/retry behavior.
Legacy refusal, pending-action cleanup, and native subagent behavior
retain their compatibility paths.

Delta Thread:
https://delta.dev/trunk/join/thread_01m2swv74pzp4c6xk46sh19fmk#s=MYAgERzq

Release Notes:

- N/A
```

## Parents

- [5d80b4e784636899e209cae89626c3be4487e14f](https://git.cafe/gitcafe/zed/commit/5d80b4e784636899e209cae89626c3be4487e14f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/39b5329322f4d2c14dc8fd6db535a31ac5431770?format=markdown)
