# acp: Fix provider-owned terminal lifecycle \(\#64544\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 656e3aed84e0febc2107d31f5752df157d83bb63

Requested commit: 656e3aed84e0febc2107d31f5752df157d83bb63

Commit: 656e3aed84e0febc2107d31f5752df157d83bb63

Tree: c471a2ecdee79aa5f4c7c9cbdff3a718a6088ced

Author: Ben Brandt

Committer: GitHub

## Message

```
acp: Fix provider-owned terminal lifecycle (#64544)

Provider terminal metadata creates a display buffer, not a client-owned
process. These terminals previously entered the process-completion path,
which completed immediately when no local task existed and cached empty
output. Provider exit status was also discarded.

- Distinguish client-owned processes from provider-owned display
terminals, including headless processes that use the same lower-level
display renderer.
- Complete display terminals on provider exit and retain ACP exit
codes/signals. Duplicate creation and exit events preserve identity and
completion; late output refreshes cached content without changing exit
time or status.
- Refresh tool-card metadata when provider completion arrives without
another tool update.
- Show Stop only for client-owned processes and avoid treating display
terminals as background processes when their tool completes.
- Preserve the full unsigned exit-code range without manufacturing `-1`
for signal-only exits.

Process wait/kill behavior, PTY release, and sandbox cleanup remain
intact. Header rendering continues to use cached metadata rather than
extracting terminal contents.

Release Notes:

- acp: Fixed premature completion and incorrect exit-status reporting
for external-agent terminals, and removed Stop controls from terminals
managed by the agent.
```

## Parents

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

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