Commit Graph

1558 Commits

Author SHA1 Message Date
Ben Brandt 57af58b3ad acp_thread: Share v2 configuration options (#65093)
Use SDK v2 configuration options and values at the shared model/UI
boundary while keeping the existing backend-owned collection and v1
transport. This is preparation for v2 integration, **not v2 wire
enablement**.

- Explicitly adapt legacy options, including `id` → `configId`, `group`
→ `groupId`, category strings, descriptions, and option/group/value
metadata. Convert full snapshots before replacing cached state.
- Lower supported shared setter values to the original v1 wire shape;
reject unsupported values before an RPC or state mutation.
- Preserve select/boolean controls, grouped pickers, favorites,
persistent settings, defaults, and live updates. Retain unknown option
payloads without editable controls; stale controls validate current
kind/choices before acting.

Dedicated v1 modes and protocol selection remain unchanged. No
additional configuration store or persistent-settings format is
introduced.

## Review guide

- [Shared
interface](https://github.com/zed-industries/zed/blob/d7116d9eb95ee5082b368a00f308f4e060821908/crates/acp_thread/src/connection.rs#L339)
and [explicit
adapters](https://github.com/zed-industries/zed/blob/d7116d9eb95ee5082b368a00f308f4e060821908/crates/acp_thread/src/config_options.rs#L4).

Release Notes:

- N/A
2026-10-02 16:54:30 +00:00
Ben Brandt 23d10a4754 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
2026-10-02 14:52:16 +00:00
Ben Brandt 3209c7d31f acp_thread: Add generic permission prompts (#65080)
Extend the request-owned permission model from merged #65039 to typed
ACP v2 permission requests and a minimal request-owned UI. This is a
shared-model/UI foundation, **not v2 wire enablement**.

- Retain the complete SDK request: title, description, subject, offered
options, unknown option kinds, and request/subject/option metadata.
Legacy tool permissions remain a separate variant in the same
authoritative pending-request store.
- Validate the owning session and nonempty, unique offered IDs before
insertion. Multiple requests for the same subject coexist under distinct
local request IDs; subjects never create or update tool history.
- Return the exact explicitly selected SDK option ID, including for
unknown kinds. Do not infer approval from unknown hints or apply legacy
tool-progress policy to generic choices. Selection and cancellation
target the exact session/request record.
- Render plain-text generic cards in the existing permission area
without transcript anchors or scroll-to-tool behavior. Root views
include child requests even without a spawning-tool anchor; standalone
child views remain session-scoped.
- Preserve legacy flat/dropdown/pattern controls, parameters,
grant-versus-action-choice behavior, and grouped request ordering. A
generic-first request blocks legacy shortcuts rather than allowing them
to skip to a later tool request. Generic records do not enter legacy
selection caches, authorization telemetry, tool counts, or scroll
summaries.
- Notify on registration/hydration and new permission requests so late
or unanchored child prompts do not depend on unrelated rendering events.
Bound long option controls and provide full-name tooltips.

## Review guide

Most added lines are regression tests. The production boundary stays in
the existing owners:

1. [Request
ownership](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L1055),
[typed
insertion/selection](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L5462),
and [canonical
settlement](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L5708).
2. [Conversation
hydration/invalidation](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L296)
and [legacy-only tool
counts](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L521);
the shared pending selector retains its generic-first barrier.
3. [Generic cards and exact-ID
callbacks](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view/thread_view.rs#L3767),
including bounded controls with complete-label tooltips.
4. [Lifecycle
regressions](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L20594),
[narrow-card
geometry](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L15075),
and [rendered
late-registration/deduplication](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L15389).

Release Notes:

- N/A
2026-10-02 11:07:39 +00:00
itsfuad 7362739f94 agent_ui: Fix elicitation radio indicator alignment (#63885)
## Summary

Addresses the selected radio dot alignment reported as the second issue
in #62955 (ask_user formatting issues), which is already closed.

Merged PR #63656 fixed long option wrapping by removing label
truncation. That fix was already present in this branch base. This PR
keeps option text rendering unchanged while fixing the remaining radio
alignment issue and extracting the radio behavior into a reusable UI
component.

Original Issue:
<img width="1672" height="844" alt="image"
src="https://github.com/user-attachments/assets/54422dec-f35a-4b83-b16c-831e8755cf50"
/>

After #63656:
<img width="769" height="386" alt="image"
src="https://github.com/user-attachments/assets/f659f518-2b4a-47cc-8e2d-c9d46bbdbe10"
/>


After:
<img width="777" height="385" alt="Screenshot From 2026-09-07 18-05-16"
src="https://github.com/user-attachments/assets/71ee9343-9623-46bc-8be8-09667fab89b6"
/>


## Implementation

- Add a reusable `ui::RadioButton` component that owns the full
option-row hit target, click handling, focus-visible styling,
configurable tab index, accessibility role/state, and theme-derived
radio styling.
- Keep the elicitation form responsible for selection state and the
selection callback while moving the radio control mechanics into
`crates/ui`.
- Paint the outer radio circle and selected dot from the same
pixel-snapped bounds instead of independently laid-out elements.
- Derive the dot using equal whole-device-pixel insets so the outer
circle and selected dot remain concentric when rounded device-pixel
diameters have different parity.
- Preserve the original `size_3()` visual radio inside the 20px control
slot, while the full row remains clickable.
- Provide an explicit accessible label for each radio option and expose
the selected state through `Role::RadioButton` / `aria_selected`.
- Preserve the existing elicitation row spacing, hover styling,
long-option layout, and keyboard navigation behavior.

## Scope

This PR does **not** re-enable the `ask_user` tool or change its default
profile settings. The tool remains opt-in following #63036. Subagent
question visibility and broader radio-group behavior such as
arrow-key/roving-tab-index navigation are outside this change.

## Validation

- `cargo check -p ui -p agent_ui` passed.
- `cargo test -p agent_ui form_choices_are_keyboard_accessible --
--nocapture` passed.
- `rustfmt --edition 2024 --check
crates/ui/src/components/radio_button.rs crates/ui/src/components.rs
crates/agent_ui/src/conversation_view/elicitation.rs` passed.
- `git diff --check` passed.
- Built and ran the updated application locally.
- Manually verified the single-select UI with short and long options:
the selected dot is centered, the visual radio retains its original
size, long option text wraps correctly, and the row layout remains
intact.
- Other display scales have not been visually verified.

Release Notes:

- Fixed selected radio indicator alignment in agent elicitation forms.

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2026-10-02 10:37:42 +00:00
Ben Brandt c5b6d4386e acp_thread: Scope permission lifetimes to requests (#65039)
Give each pending permission request a stable local identity and a
single lifetime owner. Existing v1/native permissions are the real
consumers; this prepares generic permission support without adding v2
wire handling or generic cards.

- `AcpThread` owns ordered pending request records, options,
authorization kind, and response senders. Tool calls retain only a link
to the current request; UUIDs are local and never become agent-visible
IDs.
- Creation and settlement emit state-owned notifications. Response tasks
only deliver outcomes, so dropping a waiter cannot keep resolved
requests in UI bookkeeping or prevent activity/sleep state
reconciliation.
- SDK cancellation and internally generated UI actions capture the exact
request ID and owning session. Replacing a request for the same tool
cancels its predecessor; late cleanup or captured controls cannot affect
the successor.
- Validate offered option IDs and derive permission kind from the record
rather than trusting action data. Preserve native dropdown/pattern
parameters and the permission-grant versus action-choice continuation
policy.
- Settle detached requests on terminal status, even when presentation
preparation fails, and clean up records on refusal/rewind/removal.
Legacy cancellation with no local running turn now settles pending
permissions without changing unrelated tool state or sending a new
no-turn wire cancellation.
- Keep session-bucket/per-session presentation ordering, but validate
lookups/counts against canonical pending records. Late registration
seeds those records rather than rescanning tool history.
- Give dropdown/pattern selections one shared `Conversation` owner.
Embedded child controls, displayed selection, authorization, and
exact-ID cleanup now use the same cache, preventing orphan UUID
selections after child resolution/supersession.

## Review guide

1. [Request identity/ownership
types](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L1052),
then [request APIs and
settlement](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L5396-L5583).
Check sender ownership, replacement, offered-choice validation, and
exact-ID idempotence.
2. [Tool update
detachment](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L5101)
and [legacy
cancellation](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L6135).
Status remains authoritative on presentation failure; idle cleanup is
deliberately narrow.
3. [SDK
adapter](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_servers/src/acp.rs#L5876)
and [real SDK cancellation
regression](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_servers/src/acp.rs#L4731).
The test requires the old RPC's `RequestCancelled` error, not merely a
superseded permission outcome.
4. [Conversation ordering/selection
owner](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/conversation_view.rs#L285),
[action
addressing](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/conversation_view/thread_view.rs#L3099),
and [optional action
fields](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/agent_ui.rs#L346).
5. [Rendered embedded-child
regression](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/conversation_view.rs#L13858)
and [new core boundary
tests](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L19396).
These cover actual controls, outcome params, UUID-cache cleanup, failed
replacement, last-handle release, stale actions, and request recreation.

Most of the diff is regression coverage and migration of existing
assertions/readers; no second pending lifecycle store is introduced. The
UI index and selections are presentation-only state.

Release Notes:

- N/A
2026-10-02 09:29:20 +00:00
Viraj Bhartiya 2a97fbf22b agent_ui: Keep the Awaiting Confirmation label on a single line (#64952)
## Summary

Closes #62772

The "Awaiting Confirmation" label below a pending tool call animates an
ellipsis by changing its text (`Awaiting Confirmation`, `.`, `..`,
`...`). When the text is close to the row's width, it wraps onto a
second line whenever the dots are drawn and goes back to one line when
they aren't. The row keeps changing height, so the tool call
confirmation above it bobs up and down.

This renders the label with `single_line()` so it never wraps and the
row height stays fixed.

This replaces #64887. That PR reserved the full `...` width, so the
label stopped bobbing but stayed wrapped onto two lines. As
@ChristopherBiscardi pointed out, the wrapping itself is the bug.

## Screenshots

The agent panel at its 300px minimum width with `"ui_font_size": 26`
(the easiest way to put the label right at its wrap point), captured
across one animation cycle.

**Before**: the row grows to two lines when the dots appear:


![Before](https://raw.githubusercontent.com/virajbhartiya/zed/pr-assets/pr-assets/confirm_before.png)

**After**: the label stays on one line in every frame:


![After](https://raw.githubusercontent.com/virajbhartiya/zed/pr-assets/pr-assets/confirm_after.png)

## Testing

1. Set `"ui_font_size": 26` and `"agent_ui_font_size": 26`, and shrink
the agent panel to its minimum width.
2. Ask the agent to do something that needs tool confirmation.
3. Watch the "Awaiting Confirmation" row as the dots cycle. It no longer
changes height.

The screenshots come from a stub agent with a pending permission
request, rendered in Zed's visual test harness on macOS. `cargo clippy
-p agent_ui --all-targets -- --deny warnings` and `cargo fmt --check`
pass.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [ ] Tests cover the new or changed behavior.

Release Notes:

- Fixed the agent panel's "Awaiting Confirmation" row jumping up and
down while its ellipsis animates.
2026-10-02 03:49:24 +00:00
Dom Porada f8c2cc8440 Fix selection loss while an agent thread is loading (#64252)
## Objective

Fix the bug where selected context is lost if “Add Selection to Thread”
runs before a new agent thread finishes loading. This can leave the
message empty, particularly with slower-starting external agents such as
Claude ACP.

This addresses the [loading bug
mentioned](https://github.com/zed-industries/zed/pull/62957#issuecomment-5408347793)
in #62957.

## Solution

Preserve selected context until the destination thread’s message editor
is ready, then add it without sending the message or taking focus from
the source. This fixes the existing “Add Selection to Thread” behavior
without introducing another action.

## Testing

GPUI regression tests pass on macOS for context delivery during delayed
startup, with additional authentication, draft lifecycle, and retry
coverage.

Recommended manual check: on macOS with the default keymap, temporarily
add [this
entry](https://github.com/porada/domfiles/blob/ad86e7d0a38cd477070dec7f12a1ade4a6dce504/home/.config/zed/keymap.json#L27-L33)
to your keymap:

```json
{
  "context": "!AcpThread > (Editor && mode == full)",
  "bindings": {
    "ctrl-enter": [
      "workspace::SendKeystrokes",
      "cmd-? cmd-n cmd-? cmd->"
    ]
  }
}
```

Make sure Claude ACP is set as the default for new threads. Select code
in the editor and press `ctrl-enter`. After the thread loads, confirm
that the selected context appears in the new message and the message
remains unsent.

## Self-Review Checklist:

- [x] I’ve reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed’s UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed the bug where selected context can get lost when added before an
agent thread finishes loading.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-01 01:49:50 +00:00
Ben Brandt f2cdf3d5bd acp_thread: Add authoritative terminal display updates (#64976)
Add a shared, byte-oriented terminal display update boundary without
enabling v2 transport. References, output-first updates, and snapshots
reuse the existing terminal registry and the same model, renderer, and
read-only view.

- Add tri-state terminal patches for command, cwd, decoded output
snapshots, exit information, and metadata. Keep terminal, snapshot,
exit, and content-reference metadata in their own scopes; consume
appended bytes without another raw-output history store.
- Create display placeholders for unseen v2 tool-content terminal
references. Existing v1 missing references remain errors.
Native/client-owned terminals, including no-PTY wrappers, reject display
patches.
- Keep append separate from replacement. Replacement rebuilds the
emulator/parser at the latest requested bounds, preserves configuration
and entity/view identity, and invalidates selection, search, hover,
scrolling, and cursor blinking.
- Stamp parser events with the output generation so queued old titles
cannot resurface. Drop all obsolete internal events, including
historical resizes, rather than applying them to the new screen.
- Preserve legacy first-Created/first-Exit behavior through independent
event markers. Late creation fills a placeholder without replacing its
renderer; pending legacy bytes drain before later snapshots. Reported
command values and explicit clears outrank caption fallbacks.

## Review guide

1. [Shared model and decoded patch
types](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/acp_thread/src/terminal.rs#L427),
then [registry/upsert entry
points](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/acp_thread/src/acp_thread.rs#L6768):
identity, metadata, output/exit independence, and legacy compatibility.
2. [Renderer
replacement](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/terminal/src/terminal.rs#L2007):
configuration/bounds, parser reset, process isolation, and stale-event
invalidation.
3. [View
invalidation](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/terminal_view/src/terminal_view.rs#L1211)
and the rendered tool-card regression: the existing read-only view
survives replacement and completion changes.

Release Notes:

- N/A
2026-09-30 13:05:18 +00:00
Ben Brandt 39b5329322 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
2026-09-30 08:42:44 +00:00
Fabrício Lima 414428c592 agent_ui: Fix agent notifications showing old title after rename (#64907)
## Summary

Renaming a thread whose agent can't set titles (external ACP agents such
as Claude Code) only stores the new name as a `title_override` in
`ThreadMetadataStore`, while the root `AcpThread` keeps the
agent-provided title. The sidebar and the panel's title editor already
prefer the override, but the agent notification read
`AcpThread::title()` directly, so after a rename it kept showing the
thread's original title.

This makes the notification prefer the title override, matching the
precedence already used by the `TitleUpdated` handler. The same title is
passed along when the notification's "View" button loads the thread.

- Extract `ConversationView::title_override` and reuse it in the
`TitleUpdated` handler and `show_notification`
- Add `StubAgentConnection::with_supports_set_title` so tests can model
agents without `set_title` support

## Testing

- Added
`test_notification_uses_renamed_title_when_agent_cannot_set_title`: it
fails without the fix (the notification shows the agent's title) and
passes with it
- `cargo test -p agent_ui notification` and `./script/clippy -p agent_ui
-p acp_thread` pass
- Manually tested on macOS with Claude Code in a dev build: create a
thread, rename it, send another prompt with Zed in the background; the
notification now shows the new title and "View" opens the thread

### Manual test

#### Before:

creating thread and run prompt:
<img width="1341" height="771" alt="image"
src="https://github.com/user-attachments/assets/76a42b32-b238-403d-91eb-4cdd38908fcf"
/>

notification working!
<img width="474" height="93" alt="image"
src="https://github.com/user-attachments/assets/3e7e4572-2abe-47fd-9044-ff69f82cb54d"
/>

rename and run prompt:
<img width="1456" height="830" alt="image"
src="https://github.com/user-attachments/assets/dbafe4b8-cbd0-4691-a34e-295123991774"
/>

notification with incorrect name and view button not working!
<img width="463" height="89" alt="image"
src="https://github.com/user-attachments/assets/360fd555-22a6-462f-b761-92c67e5acdd8"
/>

#### After

creating thread and run prompt:
<img width="1240" height="833" alt="image"
src="https://github.com/user-attachments/assets/09e530da-4de6-4ca3-b76d-26898bde6c12"
/>

notification working!
<img width="466" height="94" alt="image"
src="https://github.com/user-attachments/assets/5b998271-2ab7-4cec-8b0b-6c93a31e48b4"
/>

rename and run prompt:
<img width="1242" height="828" alt="image"
src="https://github.com/user-attachments/assets/dcbd88f3-ce92-4ce6-acd0-640941c7d12f"
/>

notification with correct name and view button working!
<img width="472" height="88" alt="image"
src="https://github.com/user-attachments/assets/3860768f-cc2b-4028-9e7f-3236001e24a3"
/>





## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed agent notifications showing a thread's original title after the
thread was renamed

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-09-30 05:03:06 +00:00
Viraj Bhartiya 017f9b89aa agent_ui: Hide wrap guides in the agent message editor (#64886)
## Summary

Closes #55958

When no conversation has started yet, the agent panel's message editor
uses `EditorMode::Full`. Wrap guides are only drawn in full mode, so a
user's `wrap_guides` setting (for example `"wrap_guides": [100]`) showed
a vertical line across the empty agent panel. The line does nothing
useful there.

The message editor already turns off indent guides. This PR turns off
wrap guides in the same place, the same way the inline assistant's
prompt editor already does (`inline_assistant.rs`).

## Testing

1. Add `"wrap_guides": [50]` to `settings.json`.
2. Open the agent panel before starting a conversation, and make it wide
enough to reach column 50.
3. Before this change a vertical wrap guide shows in the empty panel.
After it, none shows.

`cargo clippy -p agent_ui --all-targets -- --deny warnings` and `cargo
fmt --check` pass.

## Self-review

- [ ] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [ ] Tests cover the new or changed behavior.

Release Notes:

- Fixed wrap guides showing in the agent panel before a conversation
starts.
2026-09-29 17:43:33 +00:00
Ben Brandt 14dd03e896 agent_ui: Guard follow-up sends from stale send results (#64917)
Keep an older agent send's response from mutating the UI state of a
newer started turn.

After cancel/send, the old RPC response may still be outstanding. The
core already guards its own turn completion, but the view previously
cleared `in_flight_prompt` on every successful response and displayed
every returned error, even when a successor was running.

- Apply prompt cleanup, following-state refresh, and response errors
inside one view update guarded by the existing turn generation.
- Clear the previous displayed error again at actual turn start. This
covers an old error arriving while the successor's contents are still
resolving, without starting turn timing early.
- Preserve current-send error visibility, prompt recovery,
generation-protected timer cleanup, and per-send completion telemetry.
Superseded failures are debug-logged rather than shown on the newer
turn.
- Add a test-only controlled prompt-response gate and one regression
covering late success/error, deferred preparation, current success/error
cleanup, and timer ownership.

The guarantee starts when the successor reaches `start_turn`.
Cancellation alone does not invalidate the view generation; an old error
can appear while successor content is preparing, but cannot carry into
that new turn.

Release Notes:

- agent: Fixed stale agent responses clearing a newer prompt or showing
errors from an earlier send.
2026-09-29 10:51:49 +00:00
Ben Brandt 72d28c32c2 acp_thread: Add shared structured plan state (#64884)
Give structured agent plans one retained source record per identity and
a separate selected plan, while preserving the existing single-panel UI
and v1 behavior.

- Adapt complete v1 snapshots into shared SDK-v2 entry values before
mutating state. Retain entry metadata, plan-content metadata, and outer
update metadata at their respective levels.
- Add a keyed structured-items entrypoint without synthetic protocol
IDs. A new ID or meaningful ordered task change selects/reopens the
plan; identical and metadata-only snapshots do not switch the panel or
undo dismissal.
- Make Clear Plan dismiss presentation without deleting keyed source.
Keep v1's clear/repopulate behavior and restrict next-turn
completed-entry pruning to the legacy record.
- Reuse Markdown entities within each plan. Preserve unknown v2
statuses/priorities; distinguish cancellation from successful
completion.
- Observe ordinary thread notifications so status-only, selection-only,
and empty-plan changes repaint without depending on a Markdown update.

Release Notes:

- acp: Improved agent plan state handling and panel refreshes.
2026-09-28 16:59:30 +00:00
Hazi c821538b57 agent: Add configurable idle thread retention (#64547)
## Objective

Add a configurable limit for idle, loadable agent threads retained in
memory.

Previously, a thread that was still running when the user switched away
from it was retained correctly, but was not reconsidered for unloading
after it completed. It could remain loaded until a later cleanup
trigger.

## Solution

- Add the `agent.max_idle_retained_threads` setting, defaulting to `5`.
- Re-run retained-thread cleanup when a retained ACP thread transitions
to `Idle`.
- Remove retained-thread status subscriptions when their thread is
unloaded or reactivated.
- Add regression coverage for unloading a retained thread after it
completes when the limit is `0`.

## Testing

- Added a GPUI regression test covering a running thread that is
retained, completes, and is then unloaded with:

  ```json
  {
    "agent": {
      "max_idle_retained_threads": 0
    }
  }
  ```

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added a setting to control how many idle agent threads remain loaded.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-09-28 16:16:26 +00:00
Ben Brandt 986828d157 acp_thread: Add shared tool-call state and diff previews (#64875)
Review Thread:
https://delta.dev/trunk/join/thread_01m2swv74pzp4c6xk46sh19fmk#s=pVggqzly

Normalize legacy ACP tool reports and SDK v2 tool patches into one
shared `ToolCall` model, preserving protocol source separately from
local decisions and rendered views.

- Retain reported kind/status, first-class name, metadata, and complete
tool-content sources, including unknown v2 values and envelope metadata.
- Keep authorization ownership and local outcomes separate from reported
status. Support omitted/null/value patches without changing legacy
permission-continuation behavior.
- Preserve the status-before-content-validation contract: invalid
presentation cannot roll back a terminal report or leave its permission
unresolved.
- Render supported v2 patches with read-only diff editors using `diffy`.
Preserve sparse hunk coordinates, multi-file structure,
additions/deletions, and original source without reading or modifying
workspace files. Accept standalone unified patches and unambiguous bare
hunks; retain explicit fallback and export text for unsupported input.
- Keep native live diffs separate from protocol snapshots, preserve
render identity on metadata-only updates, and align patch
expansion/search with visible authorization content.

This adds the shared model and presentation boundary; it does **not**
enable v2 transport negotiation or change prompt lifecycle. Existing
v1/native adapters continue to work. The existing
one-active-authorization-per-tool policy is unchanged.

Release Notes:

- N/A
2026-09-28 15:53:24 +00:00
Ben Brandt 3794e5e979 acp_thread: Add keyed message updates (#64773)
Stacked on #64765, with `benbrandt/acp-message-updates` as the base
branch.

- Add typed SDK v2 user-message, assistant-message, and thought upserts,
plus keyed chunk appends, using the existing transcript records.
- Keep legacy optional-ID adjacency and optimistic echo behavior
separate. Keyed records retain their first-seen positions; conflicting
message kinds fail before mutation.
- Apply omitted/null/value content and message metadata independently.
Full snapshots replace content; later chunks append. Chunk-envelope
metadata does not patch message metadata.
- Reconcile rendered text runs and preserve compatible Markdown/image
entities. Replacing a message discards only its superseded streaming
cursor.
- Keep read-only user messages synchronized, including empty snapshots,
without resetting selection on metadata-only or identical updates. A
compact source-change token avoids caching another payload copy.

This does not select v2 connections or change prompt acceptance and
turn-completion semantics. Keyed lookup scans the existing records;
there is no second transcript or maintained ID index.

Release Notes:

- N/A
2026-09-28 09:26:37 +00:00
Ben Brandt ee43be113e acp_thread: Adopt shared ACP v2 content values (#64765)
Use SDK v2 content values as the shared representation inside the
existing message model and render-source owners, while keeping current
v1/native producers and wire APIs working through explicit adapters.

- Preserve payloads, annotations, metadata, optional/empty values, and
original content-block boundaries without a second transcript or
serialization-based conversion.
- Convert v1 inputs explicitly at message, tool/compaction,
prompt-display, and native replay boundaries. Existing v1 prompt
payloads, IDs/grouping, echo policy, streaming, editing, and rewind
behavior remain the compatibility baseline.
- Keep unsupported v2 user data canonical, show a read-only indication,
and prevent a lossy edit/resend. This includes unknown block types,
unknown audience roles, and nonempty v2-only resource-link icons. Empty
icon lists normalize to absence at the v1 boundary.
- Keep checkpoint restoration independent of edit eligibility. Refresh
unsupported focused messages, clear invalid editing state without moving
focus, and recheck the retained editor after asynchronous rewind before
resending.
- Avoid cloning retained source payloads when a focused, supported
editor will not be refreshed.

This enables SDK **type availability**, not v2 connections.

#### Review order

1.
[b166b0c52d](https://github.com/zed-industries/zed/commit/b166b0c52d3d035f05fedea8a9fa92f83e3a79ed)
— mechanical `acp_v1` alias rename and formatting, kept separate to
reduce noise in the functional review.
2.
[2d1b5345c0](https://github.com/zed-industries/zed/commit/2d1b5345c0f8b22a978db42af12e702d7bca1dfa)
— content-value migration, read-only handling, and regressions.
3.
[0c9befbc96](https://github.com/zed-industries/zed/commit/0c9befbc960eb4855b4427230bd8fbba4e7044aa)
— main integration, preserving the newly landed tool-output fallback
(#64708) and completed-plan removal (#64719).
4.
[de22432b3f](https://github.com/zed-industries/zed/commit/de22432b3f3758af7c069f314d7f217a7f1f326b)
— empty-icon normalization and expanded bidirectional/wire round-trip
coverage.

Release Notes:

- N/A
2026-09-28 09:11:35 +00:00
roboin d3ccd57194 Use correct theme colors for project headers and thread items (#62597)
# Objective

> The Threads Sidebar header and `ThreadItem` use `element.active` for
their selected and hover states instead of the theme colors intended for
those states. As a result, you can see a low text contrast ratio when
selecting a thread in some themes, such as
[Moonlight](https://github.com/Rick-VA/moonlight). According to a
comment in the existing code, the UI should use `element.active` for
interactions such as clicks, so it does not belong as the background
color for a selected thread.

Threads
Sidebarのヘッダーや`ThreadItem`を選択した際とホバーした際の色が本来対応するテーマカラーではなく`element.active`になっています。これにより、[Moonlight](https://github.com/Rick-VA/moonlight)のような一部のテーマでは、スレッドを選択した際のテキストのコントラスト比が低くなっていました。既存のコードのコメントによれば、`element.active`はクリックしたときなどに適用されるべきで、選択されたスレッドの背景色としては正しくありません。


https://github.com/zed-industries/zed/blob/0307288d903afd5673c361c548bd448fc8a684df/crates/settings_content/src/theme.rs#L634-L638

## Solution

> Using the existing branch picker and worktree picker implementations
as references, I updated the Threads Sidebar header and `ThreadItem` to
use `ghost_element_selected` for the selected-state background,
`ghost_element_hover` on hover, and `ghost_element_active` on click.
This aligns the implementation with the intended use of the theme
variables.

ブランチピッカーやワークツリーピッカーの既存の実装を参考に、Threads
Sidebarのヘッダーと`ThreadItem`の選択状態の背景色を`ghost_element_selected`に、ホバーしたときの色を`ghost_element_hover`に、クリックしたときの色を`ghost_element_active`に変更することでテーマ変数の意図に沿った実装になるようにしました。

## Testing

> I built the updated code and confirmed that the thread colors now
match the colors used for selected list items in UIs such as the branch
picker. You can test this change by opening the Threads Sidebar with one
or more agent threads present.


変更済みのコードをビルドして、スレッドの配色が、ブランチピッカーのようなリストアイテムを選択するUIの配色と一致していることを確認しました。この変更は1つ以上のエージェントスレッドが存在している状態でThreads
Sidebarを表示することでテストできます。

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

|Before|After|
|:-:|:-:|
|<img width="897" height="354" alt="image"
src="https://github.com/user-attachments/assets/35087912-adea-43ca-86cb-ab7e7f69b6d0"
/>|<img width="897" height="354" alt="image"
src="https://github.com/user-attachments/assets/42945d22-7c8b-4409-a607-251012e5da04"
/>|

---

Release Notes:

- Fixed incorrect selected and hover colors for threads in the Threads
sidebar

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-09-28 06:14:04 +00:00
Mikayla Maki 975845875b language_model: Make LanguageModel plain data served by its provider (#64750)
`LanguageModel` used to be a trait object. Each provider implemented it
on a private struct that bundled the model's metadata with the client,
credentials, rate limiter and a snapshot of its config, and consumers
held `Arc<dyn LanguageModel>` or a `ConfiguredModel { provider, model }`
pair.

This makes `LanguageModel` plain data: a `Clone + Debug + PartialEq`
struct with the same getters the trait had, held by value everywhere.
`ConfiguredModel` is gone. Providers serve requests themselves:
`LanguageModelProvider` gains `stream_completion` (plus the text/tool
helpers, `count_input_tokens`, `compact` and `api_key`), each taking
`&LanguageModel`. Senders look the provider up with
`LanguageModelRegistry::provider_for_model` when they send.

Every provider now has one lookup that decides which models it offers
and with what config. `provided_models` and the defaults are built from
it, and each request resolves the model's current config from it by id.
There are no per-model or per-request objects. A model the provider no
longer offers fails with a new, non-retried
`LanguageModelCompletionError::ModelUnavailable` instead of being served
from a stale snapshot.

This prepares for opening provider-side sessions over an append-only
message log. With models as plain data and requests on the provider, a
session can be one generic type rather than one per provider, and
deciding whether a session can be reused becomes a value comparison.

## Suggested reading order

1. `crates/language_model/src/language_model.rs` (the struct and
provider trait), `registry.rs`, and `fake_provider.rs`.
2. One representative provider:
`crates/language_models/src/provider/anthropic.rs`.
3. Providers that deviate: `bedrock.rs`, `llama_cpp.rs`,
`open_router.rs`, `crates/copilot_chat`, `crates/language_models_cloud`,
`crates/openai_subscribed`, `crates/x_ai_subscribed`.
4. Callers: `crates/agent/src/thread.rs`, then `agent_ui`, `git_ui`,
`sidebar`. Most of the remaining diff is tests.

## Behavior changes worth reviewing

- Rate limiting is one concurrency limit per model id, shared across the
app, with a limit of 16. Before, each model instance had its own limit
of 4.
- `Thread::refresh_model` re-selects a thread's model by id when its
provider reports a state change, so capability changes (for example a
llama.cpp model finishing loading) reach the thread.
- Bedrock resolves auth once per request for both Converse and Mantle,
off the foreground thread, with the SDK's default 5s credential load
timeout. Expiring credentials (SSO, STS, credential processes) are
cached until shortly before expiry and dropped on any auth change;
credentials without an expiry are re-read every request, so credential
files rewritten by external tools take effect immediately. Mantle
credential resolution now goes through Zed's HTTP client, like Converse.
- Bedrock honors `AWS_BEARER_TOKEN_BEDROCK`, then `AWS_BEARER_TOKEN`
(even if empty), over AWS credentials unless an API key is configured in
Zed, matching the SDK. This now applies to Mantle too, so users with
IAM/profile auth and one of these variables set must unset it (not empty
it) for Mantle to use IAM/profile.
- A Bedrock Mantle model with the same id as a Converse model replaces
it, so each id is offered and served once.
- OpenRouter and Vercel AI Gateway report default-model metadata from
the same lookup they serve requests from.
- A request for a model that has left a provider's list (for example
after signing out of Copilot or Zed) returns `ModelUnavailable`. Commit
message generation shows this as an error instead of doing nothing.

## Tests

`FakeLanguageModel` is gone. `FakeLanguageModelProvider` serves any
model id and owns every request sent to it; tests answer a request by
naming its model (`send_last_text(&model, ...)`, `send_text(&model,
&request, ...)`), so requests to different models can't be confused.

Tested: `agent` (753 tests), `language_model`, `language_models`,
`language_models_cloud`, `copilot_chat`, `openai_subscribed` and
`x_ai_subscribed`, plus `cargo check --workspace --tests`. The
`agent_ui`, `git_ui` and `sidebar` test binaries type-check but were not
run locally because of a linker issue in my environment; CI will cover
them. Providers have not yet been exercised against live services.

Release Notes:

- N/A
2026-09-25 17:08:34 +00:00
Chris Drackett f8adffe9d1 agent_ui: Fix terminal overflow in agent terminal output (#64328)
# Objective

Fix overflow of terminal background in the Agent Thread. Related to
#64163.

## Solution

- Added `terminal_view::TerminalView::background_corner_radii` which can
be optionally set in order to render the terminal view with rounded
corners
- Updated `agent_ui::entry_view_state::create_terminal` in order to
always set the `TerminalViews` background corner radii, for the bottom
corners. Since GPUI doesn't expose the radius values used by
`rounded_md`/`rounded_b_md`, these values have been hardcoded and
documented here.
- Updated `terminal_view::terminal_element::TerminalElement::paint` in
order to use the same corner radii for the quad being painted, as the
corner radii used in the `TerminalView` it is being painted within

## Testing

Manually verified by using a light theme, overriding the
`terminal.background` color to something like `#000000` and then asking
the agent to run a terminal command.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase
Before:
<img width="790" height="222" alt="Screenshot 000064 in Zed@2x"
src="https://github.com/user-attachments/assets/f1cffb94-c14e-43fa-931d-b674ce8e3da9"
/>

After:
<img width="648" height="234" alt="Screenshot 000062 in zed@2x"
src="https://github.com/user-attachments/assets/dee34713-1e82-4d30-8b5f-9b2529b2cf19"
/>

---

Release Notes:

- Fixed terminal tool call output covering the rounded corners of its
card in the Agent Panel.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-09-25 11:00:20 +00:00
PIYUSH RATHORE 6fae7f3513 sidebar: Fix window controls shifting when the sidebar is open (#64381)
## Objective

Fixes #63954

On Linux with client-side decorations, the window controls (close /
minimize / maximize) move 1px up and outward when the agent sidebar is
opened, and move back when it is closed.

## Solution

The title bar draws a 1px border in its own color to cover the window
border at the rounded corners, so the controls it renders sit 1px in
from the edge. When the sidebar is open,
`Sidebar::render_sidebar_header` renders the same controls without that
inset.

Added the matching 1px padding to the sidebar header under
`Decorations::Client`: top always, bottom only when no project is open
(otherwise the header's bottom border already accounts for it), and
left/right only on the side that renders the controls.

## Testing

Compared the close button position with the sidebar closed and open, on
stable 1.20.2 and on this branch, in a floating and a maximized window.
Before: moves by (-1, -1) px. After: stays on the same pixel in both
cases.

Tested on Fedora 44, GNOME on Wayland, with window buttons on the left.
Not tested with buttons on the right.

Validated with:

* `cargo build`
* `cargo test -p sidebar`
* `./script/clippy -p sidebar`
* `cargo fmt -p sidebar`

Before:

<img width="960" height="176" alt="before"
src="https://github.com/user-attachments/assets/c2b7dede-4c4c-4466-ba34-7666144e9cc1"
/>


After:

<img width="960" height="176" alt="after"
src="https://github.com/user-attachments/assets/d54172ca-be8e-4bb6-b5b3-ab193ac96423"
/>



## Self-Review Checklist

* [x] I've reviewed my own diff for quality, security, and reliability
* [x] Unsafe blocks (if any) have justifying comments
* [x] The content adheres to Zed's UI standards
* [ ] Tests cover the new/changed behavior
* [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed window controls shifting by 1px when the agent sidebar is open
on Linux.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-09-24 14:20:14 +00:00
Ben Brandt 557f85d25e acp_thread: Fix missing and stale agent tool output (#64708)
- Fix raw-only tool creation displaying no output and successive
raw-output updates leaving stale text visible.
- Keep structured content separate from the cached raw-output fallback,
with one `content()` accessor shared by rendering, search, visibility
checks, and Markdown export.
- Reuse the fallback's Markdown entity across raw snapshots while
preserving existing formatting, permission handling, and native replay
sequencing.

## Display rule

Nonempty structured content takes precedence. When structured content is
empty, display the latest retained raw output. Clearing structured
content restores that fallback without requiring the agent to resend its
raw output.

Release Notes:

- Fixed missing or outdated output in agent tool results.
2026-09-24 12:44:11 +00:00
Ben Brandt 99f947e5f6 acp_thread: Remove completed plan cards from conversation history (#64719)
Stop inserting completed-plan cards into conversation history. Plan
progress stays in the existing plan panel instead of gaining a second
transcript presentation when a turn finishes.

- Keep the completed current plan visible in the plan panel, including
its existing **All Done** state.
- Let later plan updates revise that state in place, preserving Markdown
entity identity.
- Preserve **Clear Plan** and the existing next-turn cleanup of
completed rows.
- Remove the completed-plan transcript variant, snapshot calls, card
renderer, and associated search/export/view-state handling.

This was an experimental UI change when we had an update_plan tool in
the Zed agent. But now that this is ACP only, I think this
simplification is warranted, also because there are upcoming changes to
plans in RFD for v1 and v2 that will be id-based and allow future
updates.

Release Notes:

- N/A
2026-09-24 12:43:39 +00:00
Ben Brandt a405fb91d5 acp_thread: Consolidate agent message content ownership (#64667)
- Make `MessageContent` own the original SDK content blocks and derive
rendering through borrowed views, removing the separately maintained
`UserMessage.chunks` vector.
- Retain assistant content-block metadata and payloads while revealing
streamed text through a source cursor, without a second pending-text
buffer or per-block shared ownership.
- Preserve existing v1 IDs, grouping, optimistic echo behavior, prompt
formatting, and Markdown/image identity. Standalone tool and compaction
output keeps its existing payload-retention contract.
- Reclaim spare source-vector capacity at turn settlement or
cancellation, with a bounded trailing range and stale-turn guards. Late
output can still append normally.

This is content-ownership preparation for ACP v2.

Release Notes:

- N/A
2026-09-24 09:23:58 +00:00
Ben Brandt a3ccafef66 Add ACP session notice support (#64606)
Implement Zed client support for the draft [ACP Session Notices
RFD](https://agentclientprotocol.com/rfds/session-notices), allowing
agents to surface operational advisories without turning them into
conversation history.

- Advertise the v1 notices capability behind the existing ACP beta
feature flag
- Keep notices in live, session-local state, with independent local
dismissal and no persistence, transcript/export entries, protocol
acknowledgement, or changes to generation status.
- Render dismissible callouts above the composer in a bounded scrolling
area. Support info, warning, and error treatments, with a generic
presentation for unknown severities and plain-text titles/descriptions.
- Provide screen-reader labels, keyboard dismissal with focus
restoration, and a single scrolling surface for long descriptions.
- Add a shared notice component and designer previews for severity
variants, title-only/detailed content, narrow layouts, and overflowing
stacks.

Open **workspace: open component preview**, then select **Agent →
Session Notice**.

<img width="829" height="316" alt="image"
src="https://github.com/user-attachments/assets/2a6eba57-465e-41e8-b99f-5f57c00199d8"
/>


Release Notes:

- N/A
2026-09-23 12:06:54 +00:00
Ben Brandt f2aa97c47f agent_ui: Track existing permissions when registering threads (#64644)
Discover permission requests that are already pending when a thread is
registered with a conversation. Previously, registration only subscribed
to future authorization events, so a waiting tool call could exist in
the thread but remain absent from the conversation's pending-request
lookup and subagent permission counts.

- Seed tracking from existing `WaitingForConfirmation` tool calls in
entry order.
- Use the same deduplicating insertion path for initial state and
subsequent request events, preserving already-tracked order.
- Leave authorization-received removal, conversation-wide shortcut
policy, and preview interaction unchanged.

Not really an issue in practice for the zed agent, but will be
potentially for ACP v2

Release Notes:

- N/A
2026-09-23 12:06:37 +00:00
itsfuad e5221fa295 agent: Add subagent model selection (#64498)
Adds optional model selection to `spawn_agent`, allowing a newly spawned
subagent to use a specific configured model.

This is an additive change. Existing `spawn_agent` behavior remains
unchanged when `model` is omitted: Zed continues to use the configured
subagent model when one is set, otherwise the subagent inherits the
parent model.

The resulting selection order is:

`explicit model override` → `configured subagent model` → `parent model`

Explicit model IDs use the `provider/model-id` format returned by
`list_agents_and_models`. When an explicit model is supplied, it is
validated against the currently available models. If it is unavailable,
the spawn fails instead of silently substituting another model.

Resumed subagent sessions keep their original model, so `model` cannot
be supplied together with `session_id`.

This follows the model-selection use case discussed here:

https://github.com/zed-industries/zed/discussions/60993#discussioncomment-18450658

The change also makes the active model visible in native subagent cards,
including when the subagent happens to use the same model as its parent.

## Screenshot

<img width="820" height="959" alt="Screenshot From 2026-09-19 22-53-26"
src="https://github.com/user-attachments/assets/210db6e7-0068-45cc-aa96-f3a5aca3f90c"
/>

## Implementation

- Add an optional `model` field to `spawn_agent`.
- Preserve the existing configured-subagent-model and parent-model
fallback behavior when no explicit model is supplied.
- Validate explicit model selections against currently available models.
- Reject model overrides when resuming an existing subagent session.
- Keep `list_agents_and_models` available independently of the
create-thread feature flag so `spawn_agent` can use it for model
discovery.
- Allow native model discovery to work without the sibling-thread host,
while still including external agents when that host is available.
- Display the active model name in native subagent card headers.

## Testing

Manually tested explicit model selection by first calling
`list_agents_and_models`, then spawning five subagents concurrently with
exact discovered model IDs:

- `openai-subscribed/gpt-5.6-sol`
- `openai-subscribed/gpt-5.6-luna`
- `openrouter/inclusionai/ling-3.0-flash-vl:free`
- `openrouter/nex-agi/nex-n2.5-mini:free`
- `openrouter/nex-agi/nex-n2.5-pro:free`

All five subagents completed successfully, returned distinct session
IDs, and displayed their selected model names in the subagent cards.

Also added coverage for:

- forwarding an explicit model selection through `spawn_agent`
- rejecting a model override when resuming a session
- preserving the existing configured subagent model behavior when no
override is provided
- preserving parent-model fallback behavior
- exposing `list_agents_and_models` independently of sibling-thread
creation

## Self-Review Checklist

- [x] I have reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks: none added
- [x] The content adheres to Zed UI standards
- [x] Tests cover the new and changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Added model selection for spawned subagents.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-09-22 22:54:41 +00:00
Neel 18ad8d1195 agent_ui: Remove redundant non-empty check (#64589)
This is already handled a few lines below, and early returns on an empty
selection which breaks the `Ctrl + >` shortcut.

Release Notes:

- Allow `Ctrl + >` to be used with empty selections.
2026-09-22 14:21:02 +00:00
Ben Brandt ca49b5dac8 agent_ui: Make provider-owned terminals read-only (#64550)
Make provider-owned terminal cards read-only for user input while
preserving local inspection. This builds on the explicit terminal
ownership introduced in #64544.

- Add a construction-time `TerminalView::with_read_only` option,
selected from ACP process ownership rather than PTY presence. Existing
views remain interactive by default, including client-owned headless
terminals.
- Reject typing, send actions, paste, file/path drops, IME input,
clear/rerun actions, and focus reports in read-only views.
- Preserve selection, copying, links, scrolling, search, and local Vi
navigation. Leaving Vi mode does not enable terminal input.
- Pass an explicit mouse-routing policy to the existing lower terminal
handlers so provider-requested mouse and alternate-scroll modes cannot
consume inspection gestures. Real modifiers remain unchanged, and
Linux/FreeBSD middle-click paste is suppressed.

Release Notes:

- N/A
2026-09-21 15:37:37 +00:00
Josh Kent 36726df0c3 sidebar: Group threads sidebar settings (#64395)
## Objective

Group the threads sidebar settings together in JSON and the Settings
Editor, using consistent “Threads Sidebar” terminology.

This follows up on #63452 now that #62883 has added configurable default
width, and includes the auto-open setting added since then.

## Solution

- Group `position`, `default_width`, and `auto_open` under
`agent.threads_sidebar`, and display their controls together in
Settings.
- Automatically migrate `agent.sidebar_side`,
`agent.threads_sidebar_default_width`, and
`agent.threads_sidebar_auto_open` across supported settings scopes,
preserving existing nested values.
- Apply changes to the default width immediately, including when the
sidebar was manually resized, and clear the saved width override.
Unrelated settings changes preserve manual sizing.
- Document all three settings, including the previously missing position
entry.

## Testing

The following targeted checks passed on the local changes:

- `cargo test -p migrator nest_agent_threads_sidebar_settings` — 7 tests
passed.
- `cargo test -p sidebar -p workspace -p agent_settings -p gpui_platform
--features gpui_platform/runtime_shaders --lib -- width
threads_sidebar_settings test_open_directory_in_existing_window` — 9
tests passed.
- `cargo fmt --all` completed successfully.
- `git diff --check` passed.
- From `docs`: `npx prettier --check src/reference/all-settings.md
src/ai/parallel-agents.md` passed.

Coverage includes migration precedence and supported scopes, settings
defaults and width limits, manual sizing and resets, persisted widths,
and auto-open behavior.

Full application tests and manual UI testing were not run. Clippy was
not rerun after the final terminology changes.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Improved threads sidebar settings by grouping position, default width,
and auto-open together, and applying default-width changes even after
manual resizing.
2026-09-21 15:15:54 +00:00
Ben Brandt 656e3aed84 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.
2026-09-21 12:59:56 +00:00
Ben Brandt df673c1b85 acp_thread: Preserve ordered mixed content in agent messages (#64456)
Preserve ordered mixed content in agent messages without disrupting text
streaming for existing native/v1 agents. The previous single-block
reduction could replace images with placeholders or lose non-text
content as subsequent chunks arrived.

- Introduce [ordered message display
content](https://github.com/zed-industries/zed/blob/929fba3e16f7a378eb1dca3d85ac2f1df2b902c6/crates/acp_thread/src/acp_thread.rs#L1500),
reusing adjacent text entities while retaining image/resource-preview
boundaries.
- Update rendering, text search, response copy/export, Mermaid cache
invalidation, and CLI output to visit the collection.
- Use block-local context menus and existing Markdown getters so copy
commands target the clicked part rather than another part's cached
state.
- Keep existing link/mention formatting, resource-button and blob-label
search behavior, compact prompt mentions, and original user-message
chunks.
- Preserve the separator between a leading resource link and subsequent
direct or streamed text.

Release Notes:

- N/A
2026-09-21 09:24:15 +00:00
Agus Zubiaga a8535d86b7 language_model: Allow explicit prompt cache keys (#64460)
## Objective

Related conversations can’t share an OpenAI cache key without also
sharing a thread ID. We currently derive `prompt_cache_key` directly
from `thread_id`, tying cache reuse to conversation identity.

## Solution

Add an optional `prompt_cache_key` to `LanguageModelRequest` and use it
in both OpenAI Chat Completions and Responses conversions. We still fall
back to `thread_id` when no key is supplied, so existing callers keep
their current behavior.

This lets callers share a cache key across parent and child
conversations while keeping their conversation and transport identities
separate.

## Testing

Added regression coverage for explicit keys, legacy fallback, provider
capability gating, and serialization compatibility.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-09-18 18:44:49 +00:00
restlessronin 6872711ff8 agent_ui: Stop the sidebar creating two terminals for one new entry (#62151)
# Objective

Starting a new terminal thread from the agent sidebar creates **two**
terminals instead of one, in a project that has no terminals yet. With
terminals already open, only one is created.

## Solution

`Sidebar::create_new_terminal` calls `AgentPanel::new_terminal` and then
focuses the panel. The spawn is async, so when `focus_panel` activates
the panel, `base_view` is still `Uninitialized` — and
`ensure_thread_initialized` reads that as an empty panel and spawns its
own "initial" terminal on top of the one already in flight.

Once terminals exist they are restored at panel load, so `base_view` is
already `Terminal` and the second spawn never happens. That's why the
bug only appears on a project with no terminals.

`restore_terminal` already guarded against this by marking the spawn
pending before calling `spawn_terminal`. This moves that marker into
`spawn_terminal` itself, so every spawn path arms it, and drops the
now-redundant assignment in `restore_terminal`. The marker is cleared
exactly where it already was: when the terminal lands, when the spawn
fails, and when the terminal is closed.

## Testing

- Added `test_new_terminal_prevents_initial_terminal_creation`, which
reproduces the sidebar's spawn-then-focus sequence. It fails without the
fix (the panel ends up with two terminals) and passes with it.
- `cargo test -p agent_ui --lib` — 405 passed.
- `cargo test -p sidebar --lib` — 142 passed.
- `./script/clippy -p agent_ui` — clean.
- Tested on macOS only. The race is platform-independent, but I can't
exercise the Linux/Windows terminal spawn paths.

## Self-Review Checklist:

- [X ] I've reviewed my own diff for quality, security, and reliability
- [ X] Unsafe blocks (if any) have justifying comments
- [ X] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ X] Tests cover the new/changed behavior
- [ X] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed the agent panel creating two terminals when starting a new
terminal thread in a project with no existing terminals

---------

Co-authored-by: Claude Opus 5 <claude-opus-5@claude-cli>
2026-09-18 05:46:01 +00:00
Ben Brandt 68ec865bfd agent_ui: Fix keyboard navigation in ACP elicitation forms (#64193)
Closes #61358

Address the keyboard-navigation portions. Image answers are
intentionally not included. ACP form responses support primitive values
rather than image attachments, and Claude Code's adapter treats the
"Other" answer as text. This PR therefore only partially addresses the
issue.

Release Notes:

- acp: Fixed submitting and navigating ACP elicitation forms with the
keyboard.
2026-09-17 14:39:57 +00:00
Jack Walters 52e0b848da Add a setting for Threads Sidebar auto-open (#64259)
Closes https://github.com/zed-industries/zed/discussions/64266

Opening a folder in an existing window force-opens the Threads Sidebar,
and there is no way to prevent it. `open_paths` called
`MultiWorkspace::open_sidebar` unconditionally on the reused window, so
the sidebar reopened on every such open regardless of whether the user
had closed it.

This adds `agent.threads_sidebar_auto_open`, defaulting to `true` so
current behavior is unchanged. With `false`, the folder still opens in
the existing window, but the sidebar stays closed.

This path is reached when `default_open_behavior` or
`cli_default_open_behavior` is set to `existing_window`.

`open_sidebar` was doing double duty: besides showing the sidebar, it
pinned the workspace being navigated away from so it survives the
switch. When the setting is disabled, `retain_active_workspace` is
called instead, so only sidebar visibility changes.


https://github.com/user-attachments/assets/fc299df0-27e2-4ac6-98cb-d817d5f71d0e

## Tests

Two tests in `multi_workspace_tests.rs` cover both branches: the sidebar
opens by default, and stays closed when the setting is disabled while
the folder still opens in the same window.

Release Notes:

- Added `agent.threads_sidebar_auto_open` to control whether opening a
folder in an existing window also opens the Threads Sidebar
2026-09-16 16:03:50 +00:00
MartinYe1234 739fdbef76 Correct Copilot token-limit metadata (#64195)
## Stack

Part 3 of the split. #64047 and #64194 are merged. This PR targets
`main`, which has been merged into the branch without rewriting history;
the already-merged output-limit and counting changes are preserved.

## Summary

Expose Copilot's actual prompt, combined-context, and output limits
through the shared model interface. Preserve `max_token_count()` as the
existing context capacity; add `max_input_tokens()` for independent
prompt limits, defaulting to context capacity for other providers.
Existing total-display and telemetry callers keep using
`max_token_count()` without fallback expressions. The values come from
the provider's model feed, not hard-coded model tables. Missing prompt
metadata falls back to context capacity; missing output metadata remains
unknown.

Use the independent prompt limit when deciding when to auto-compact,
while retaining the combined window for total usage display and
telemetry. For example, a 90k prompt limit within a 200k context window
is not treated as 200k input and does not lose a second output
reservation.

The existing split-display ring and tooltip use the same usable input
capacity. This PR does not enable split display for Copilot, so it does
not introduce a visible Copilot input-limit display. No counting
endpoints, consent changes, or Delta changes are included.

## Validation

- After the review follow-up, all 47 selected Copilot and agent
compaction tests passed. Local testing used the existing
`gpui_platform/runtime_shaders` feature because the Apple Metal compiler
is unavailable.
- Scoped script/clippy passed for copilot_chat, agent, and agent_ui.
- Formatting and whitespace checks passed.
- Fixtures cover unequal prompt/context/output limits, absent/zero
metadata, and existing compaction workflows.
- Reviewed the complete diff against current main: only the input-limit
API, Copilot metadata, its compaction/display consumers, and tests
remain. The live tooltip workflow was not exercised.
- No live provider calls were made.

Downstream Delta integration must use `max_input_tokens()` for input
admission when updating its Zed dependency; that pin update remains
separate.

## Review follow-up

- Added a real Thread regression with 200k context, 90k input, and
16,384 output: compaction changes from inactive at 80,999 tokens to
active at 81,000; total displayed capacity remains 200k.
- Changed the split input ring to use the same capacity as its tooltip.
This does not enable split display for Copilot.
- All 47 selected tests passed locally, along with scoped Clippy,
formatting, and whitespace checks. Temporarily restoring the incorrect
context-limit call made the new regression fail; that mutation was
removed.

Release Notes:

- Fixed auto-compaction thresholds for GitHub Copilot models with a
prompt limit below their context window.
2026-09-15 23:25:47 +00:00
Dom Porada aef893e276 Add a setting for the Threads Sidebar width (#62883)
## Objective

The Threads Sidebar opens at a hard-coded 300px and can be resized only
by dragging. `agent.default_width` controls the Agent Panel rather than
the sidebar, leaving no way to configure the sidebar’s preferred width.

## Solution

Add `agent.threads_sidebar_default_width` for the width used when no
user-chosen sidebar width is stored. The value is clamped to the
existing 200–800px drag range. Existing, unresized sidebars follow
settings changes immediately. Double-clicking the divider resets the
sidebar to the configured width and resumes following subsequent
settings changes.

The sidebar previously saved its width whenever any sidebar state
changed, not only when the divider was dragged. `SerializedSidebar` now
records `width_set_by_user`, so settings-driven widths are no longer
persisted. Manually resized widths take precedence until the divider is
reset.

## Testing

- `test_threads_sidebar_default_width` in
`crates/agent_settings/src/agent_settings.rs` covers the default, a user
override, fallback for `null` and an unset field, and preservation of
the Agent Panel width and sidebar position.
- Five width-focused tests in `crates/sidebar/src/sidebar_tests.rs`
cover reset behavior, live settings updates, clamping, legacy-width
restoration, and persistence. They also check that manually resized
widths resist settings changes and that resetting resumes following the
setting.
- To check by hand: set `"agent": { "threads_sidebar_default_width": 360
}`, reset the divider, and confirm the sidebar is 360px wide. Change the
setting and confirm the width updates immediately. Drag it wider,
restart, and confirm the dragged width is kept. Double-click the divider
and confirm it returns to the configured width. Set the value to `5000`
and confirm the untouched sidebar clamps to 800px.

## Self-Review Checklist:

- [x] I’ve reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed’s UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Added `agent.threads_sidebar_default_width` for setting the width of
the Threads Sidebar.
2026-09-15 14:53:12 +00:00
Chris Drackett 0be5558912 Use terminal.background behind terminal tool call output (#64163)
Right now there is some margin that uses `editor background` above the
output of the terminal that carries `terminal_background`. If the editor
uses a light background and the terminal is dark you'll end up with a
light area of margin above the dark terminal. The terminal background
also clips the rounded border of the box. This patch switches this to
match the terminal background and makes sure the background never clips
the rounded border.

Before:
<img width="720" height="212" alt="Screenshot 000044 in Zed@2x"
src="https://github.com/user-attachments/assets/333a0e17-2869-4cc9-b696-f24eec8630aa"
/>


After: 
<img width="646" height="228" alt="Screenshot 000050 in zed@2x"
src="https://github.com/user-attachments/assets/54293de1-bc64-450f-b354-e64ba0e3d5e9"
/>

Release Notes:

- Fixed terminal tool output in the Agent Panel to consistently use the
theme’s `terminal.background` color.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-09-15 13:26:56 +00:00
MartinYe1234 59d996d8db Add per-request model output limits (#64047)
## Stack

- This PR: output-limit plumbing, based on `main`.
- #64194: provider input counting and consent, based on this branch.
- #64195: Copilot metadata and consumers, independently based on this
branch.

After this PR lands, rebase/retarget both children onto `main` as
needed, especially after a squash merge. At split time, a synthetic
merge of the two child heads exactly matched the saved pre-split source
tree. PR1 has since consolidated overlapping tests without changing
production code.

## Summary

Part 1 of a three-PR split: add optional per-request
`max_output_tokens`, forward it through provider payloads, and clamp it
against known output limits. Unset requests preserve existing defaults.
Unknown Copilot output metadata is not treated as a zero-token maximum
when forwarding a cap.

This PR also supplies the combined-window and native-capability
interfaces used by downstream budget calculations. It does not add
input-token counting, data-retention consent integration, or change
Copilot prompt/context metadata, compaction thresholds, or tooltips.
Those changes are split into two child PRs based on this branch.

The net diff is 24 files, +438/-55. Forward narrowing commits preserve
the original review history; there was no force-push.

## Test consolidation

Eight overlapping standalone tests have been folded into existing
conversion tests, preserving coverage of unset limits, explicit limits,
clamping, and serialized payloads. Four distinct tests remain separate:
request serialization compatibility, Copilot wire formats, DeepSeek
conversion (no existing conversion suite), and hosted OpenAI
normal-completion HTTP behavior. This cleanup changes no production Rust
code.

## Validation

- Latest run: 269 tests passed across anthropic, google_ai, open_ai,
language_models, copilot_chat, and language_models_cloud.
- Five extended existing tests failed when cap selection was temporarily
broken and passed after restoration. No mutations remain.
- Latest scoped script/clippy, formatting, and whitespace checks passed.

Earlier split validation:

- 229 tests passed across language_model_core, anthropic, open_ai,
copilot_chat, and language_models_cloud.
- Scoped script/clippy passed for copilot_chat, language_models_cloud,
language_models, agent, and agent_ui.
- Formatting and whitespace checks passed.
- Permanent tests cover payload propagation, absent/explicit limits,
unknown output metadata, direct and hosted native-compaction caps, and
hosted OpenAI clamping.
- No live provider requests were made for the split.

## Review notes

The separately identified fixed/non-interleaved thinking-budget versus
smaller output-cap concern remains open in this PR; it must not be
hidden in the counting or metadata PRs. The README acknowledgment is
retained for human review.

Downstream applications using input counting must consume the counting
child PR as well, not repin to this branch alone.

Release Notes:

- N/A
2026-09-14 20:15:15 +00:00
Kirill Bulatov 47b8ea5894 Reveal in all multi buffers (#64154)
Closes https://github.com/zed-industries/zed/issues/62909
Closes https://github.com/zed-industries/zed/issues/57396

Release Notes:

- Fixed project panel reveal not working in git diff-related multi
buffers
2026-09-14 15:54:54 +00:00
Ben Brandt 7cda6f0523 acp: Add agent license if available from the registry (#64178)
The JetBrains team started added links to the relevant license terms for
each agent. Seems worth linking out to if we have it.

Release Notes:

- N/A
2026-09-14 14:04:21 +00:00
Ben Brandt f50ebf2975 agent_ui: Show tool-name fallbacks and tooltips (#64177)
Surface tool-call names without adding a permanent subtitle or badge to
every call.

- Keep nonblank titles as the primary label. Blank or whitespace-only
titles fall back to the exact programmatic tool name, then to "Tool
call" if no usable name is available.
- Preserve real titles on name-only updates, and let later title updates
replace a fallback. Fallback names render literally and remain
searchable; exports escape them at the Markdown boundary.
- Show `Tool: <name>` on existing non-terminal tool icons. Keep the
terminal command layout unchanged, and preserve the existing Go to File,
Interrupted Edit, and Copy Command interactions.
- Apply the same behavior to native and external agents, without an
ACP-beta gate.

Release Notes:

- N/A
2026-09-14 14:04:09 +00:00
Ben Brandt d1dae815f2 acp: Add ACP context compaction support (#64081)
Add support for ACP context-compaction updates and streamed summaries.
The ACP beta flag gates only the capability advertised to external ACP
agents. Native Zed-agent compaction (manual and automatic), including
the shared rendering, search, and export behavior, remains available
regardless of that flag.

- Apply updates by compaction ID without moving their timeline entries,
preserving omitted/null/replacement semantics for summaries and errors.
- Retain rich summary content and show explicit placeholders for
unsupported content instead of silently dropping it.
- Render progress, completion, failure, cancellation, and unknown
statuses. Expanded summaries and literal error details participate in
thread search, and Markdown exports preserve status and details.
- Keep native compaction compatible: failed retry attempts become
terminal, and cancellation is delivered before the stop event even when
the bridge has not yet applied the queued start event. Preserve native
streaming and save/reload behavior.

Release Notes:

- N/A
2026-09-14 10:31:51 +00:00
Ben Brandt 3e442f25b7 acp: Use first-class ACP tool-call names (#64080)
Follow up on #64077 by using first-class ACP tool-call names while
continuing to accept legacy `_meta.tool_name` from older agents.

- Prefer the first-class name when creating a tool call. Explicit name
updates replace the stored name; legacy metadata only fills an absent
name and cannot overwrite a canonical name.
- Emit first-class names from the native agent, including replay when a
tool implementation is unavailable.

Release Notes:

- N/A
2026-09-14 09:30:52 +00:00
Conrad Irwin fffb52c6dd Fix Zed upgrade prompts for non-Zed payment errors (#64094)
## Summary

Fixes #63401.

Only payment errors originating from the Zed provider now use the Zed
free-usage-limit callout. Other providers use the existing Request
Failed display with their original message and no Zed upgrade button.
Telemetry follows the same distinction.

Rename the UI error variant to `ZedPaymentRequired` to make its scope
explicit. Add regression coverage for OpenRouter, OpenAI, and Anthropic
errors both with and without an HTTP status, plus the Zed upgrade path.

## Verification

- `cargo test -p agent_ui --lib conversation_view::tests`: 104 passed,
including both new regression tests.
- Rustfmt checks and `git diff --check` passed.
- Provided a temporary OpenCode payment-error override for manual
testing; the override has been removed and is not included in this PR.
- Corgi failed to link `clang_rt.osx`; the Cargo fallback succeeded.
Details were recorded in the requested local Corgi log.

Release Notes:

- Fixed payment errors from non-Zed model providers incorrectly
prompting users to upgrade to Zed Pro instead of displaying the original
provider error message.
2026-09-11 17:11:33 +00:00
Maurício R Duarte 251854020a agent_ui: Enable terminal thread renaming from the Agent Panel (#63660)
## Summary

- Follow up on #63578 by extending the existing
`agent::RenameSelectedThread` action to the active Terminal Thread in
the Agent Panel.
- Preserve the existing Threads Sidebar behavior and default
keybindings.
- Document custom keymap assignment and add focused Agent Panel
regression coverage.

## Testing

- `cargo test -p agent_ui
agent_panel::tests::test_rename_selected_thread_action --lib`
- `cargo test -p sidebar rename_selected_thread --lib`
- `cargo fmt --package agent_ui -- --check`
- `npx prettier --check src/ai/terminal-threads.md`
- Manually tested locally with a custom `AgentPanel > Terminal` keymap
binding.

Release Notes:

- Added support for custom keybindings to rename Terminal Thread titles
from the Agent Panel.

### screenshots
<img width="921" height="205" alt="Screenshot 2026-09-02 at 18 40 31"
src="https://github.com/user-attachments/assets/b1edabfc-35f9-42ef-b368-486003202349"
/>
2026-09-11 01:07:36 +00:00
Xiaobo Liu 450775244f gpui: Prevent idle sleep during AI response streaming (#53130)
Release Notes:

- Added button tu prevent idle sleep during AI response streaming


**Context / Motivation:**
When an AI agent takes a long time to generate a response, the operating
system might enter an idle sleep (or display sleep) state if there is no
user interaction (mouse or keyboard). This can interrupt the workflow.
This PR aims to prevent the system from sleeping during an active AI
turn by invoking native OS APIs, and provides a UI toggle for users to
control this behavior.

**Key Changes:**

1. **Cross-Platform Idle Sleep Prevention in GPUI (`gpui`, `gpui_*`)**
- Added a new `prevent_idle_sleep` method to the `Platform` trait. It
returns a RAII-based `PreventIdleSleepToken`, which automatically
restores the original sleep policy when dropped.
- **macOS**: Utilizes `NSProcessInfo`'s `beginActivityWithOptions` with
`NSActivityIdleDisplaySleepDisabled`.
- **Windows**: Uses `SetThreadExecutionState` to prevent display and
system sleep, incorporating a reference counter to handle concurrent
requests safely.
- **Linux**: Uses `ashpd` to request `org.freedesktop.portal.Inhibit`
(inhibiting `Idle` and `Suspend` states) via D-Bus.

2. **AI Agent State Integration (`crates/acp_thread`)**
- Introduced idle sleep prevention logic in `AcpThread`: Acquires the
token at the beginning of `run_turn`, and automatically releases it when
the turn completes normally, errors out, or is explicitly canceled by
the user.
- Added comprehensive unit tests to ensure the token is correctly
acquired and released under various cancellation and concurrency
scenarios.

3. **Settings and UI (`crates/agent_settings`, `crates/agent_ui`)**
   - Added `AgentOutputIdleSleepControl` to global state.
- Added a new toggle button (screen icon) to the toolbar at the bottom
of the `ThreadView` (AI conversation panel). Users can hover to view the
tooltip and click to toggle the feature on or off.

<img width="419" height="132" alt="截屏2026-04-04 16 09 08"
src="https://github.com/user-attachments/assets/619da9ff-10f7-46e0-b959-d7c74b16b918"
/>

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-09-09 13:49:13 +00:00
Kirill Bulatov 6f72bdb7b2 Unify copy actions for agent panel and markdown (#63884)
Before, it was not possible at all to copy the text from the agent
panel, only its markdown.
The PR breaks the existing ctrl/cmd-c binding there by using the same
approach markdown preview does: copy as text by default, allow to copy
as markdown via the context menu.

Before:


https://github.com/user-attachments/assets/2014f363-5167-4700-be86-9c0774d7e4fd

After:


https://github.com/user-attachments/assets/1dad253c-7a3b-4ca7-99c8-e8df8b3c3fd6


Release Notes:

- Changed agent panel to copy text with cmd/ctrl-c, as markdown preview
does. `markdown::CopyAsMarkdown` action is available still and can be
bound if needed.
2026-09-08 11:21:20 +00:00
Chara e578430582 agent_skills: Count description length in characters (#63766)
Closes #63620

Count Agent Skill descriptions by Unicode characters rather than UTF-8
bytes across validation, load-time warnings, the skill creator counter,
and imported-description truncation. This aligns Zed with the Agent
Skills specification and reference validator.

Testing:

- `cargo test -p agent_skills --lib`
- `cargo test -p settings_ui --lib`
- `cargo build -p zed`
- Manually verified that a 342-character CJK description containing
1,026 UTF-8 bytes can be saved successfully
- `./script/clippy -p agent_skills -p settings_ui --tests` is blocked by
an unrelated existing `clippy::drain_collect` diagnostic in
`crates/rpc/src/proto_client.rs`

<img width="667" height="210" alt="Successfully created Unicode test
skill"
src="https://github.com/user-attachments/assets/2427fce2-9f0f-462d-959f-e08ad160b3d1"
/>

Confirmed that the Codex agent panel discovers the skill and exposes it
in command completion without a length warning.

<img width="953" height="367" alt="image"
src="https://github.com/user-attachments/assets/8c100197-2e6e-4627-b3f8-862bdfaac918"
/>

Release Notes:

- Fixed valid multibyte Agent Skill descriptions being rejected for
exceeding a byte-based length limit.

---------

Co-authored-by: Chara <249489759+cmdr-chara@users.noreply.github.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-09-07 16:34:18 +00:00