# acp_thread: Append streamed tool-call content \(\#65090\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 23d10a4754bb917e635b584b5686bc492ea25995

Requested commit: 23d10a4754bb917e635b584b5686bc492ea25995

Commit: 23d10a4754bb917e635b584b5686bc492ea25995

Tree: f5c12009ce341ddf56a0e00180d1fc0646ca0757

Author: Ben Brandt

Committer: GitHub

## Message

```
acp_thread: Append streamed tool-call content (#65090)

## Summary

Add a typed SDK v2 tool-content append path. `ToolCallContentChunk`
appends one complete item; `ToolCallUpdate.content` still replaces the
collection. No wire handler or protocol selection is added.

- Target exact/historical tool IDs without rebuilding the existing
snapshot. New IDs create minimal records with reported fields unset;
this is a lenient client policy.
- Reuse item preparation and registered terminal placeholders. Preserve
existing render entities, native diff ownership, tool
status/permissions/metadata/locations/raw values, and normal raw-output
fallback behavior.
- Emit updates for the actual row; only new rows use the existing
streaming-flush boundary.
- Retain item/body metadata. Delivery-scoped chunk `_meta` is not
promoted into aggregate state or stored as a separate history, matching
message chunks.

## Review guide

Production code is unchanged by the cleanup:

- [Append and fallback
refresh](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L1574).
- [Shared single-item
preparation](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L2949).
- [Exact-ID append and first-seen
defaults](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L5332).

Coverage is now three focused regressions, reduced from seven and
approximately **1,000 → 300 test lines**:

1.
[Ordering/targeting](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L13068):
historical ID, append vs replacement, clear/raw fallback, defaults,
metadata isolation, original Markdown, and row events.
2.
[Preservation](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L13180):
real permission waiter, reported state, native diff identity, and
unrelated buffered text/new-row flush.
3. [UI
integration](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/agent_ui/src/conversation_view.rs#L10077):
an existing expanded search automatically refreshes after older-tool
append, while row/entity identity and the later tool remain unchanged.

Broad content-variant, full diff-editor, and repeated render/search
matrices remain covered by existing tests rather than being repeated
here. Fixtures use SDK builders; no helper framework was added.

## Validation

- Full suites: **240 core**, **496 UI** (serial).
- Two core regressions: **100 seeds**; UI regression: **20 seeds**.
- Six-package `./script/clippy`, formatting and `git diff --check`
passed.
- Production text was verified byte-for-byte unchanged by this test-only
cleanup.

## Suggested .rules additions

GPUI testing guidance: `VisualTestContext::debug_bounds` needs a static
selector. Reuse allocated fixture selectors for runtime IDs; do not
borrow temporary `&format!(...)` strings.

Release Notes:

- N/A
```

## Parents

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

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