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
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
`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
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
This is a pure refactoring PR to make our FS watching code more
testable. It does two things:
1. Make the `GlobalWatcher` be owned by `RealFs` or `FakeFs` instead of
being a process-wide global.
2. Delete `FakeWatcher` and its `Watcher` implementation, and instead
mock the notify crate itself in `FakeFs` tests via the existing
`WatchBackend` trait. Now all our FS watching code down to the notify
boundary runs the same in tests and production.
Release Notes:
- N/A
# Objective
Fix the agent `terminal` tool in headless eval environments. In the eval
sandbox, terminal commands failed before the shell ran with `IOError:
Not a tty (os error 25)` because PTY setup attempted to acquire a
controlling terminal.
## Solution
- Add a `terminal::HeadlessTerminal` global that is set by `eval_cli`
only.
- When headless mode is enabled, run terminal task commands as plain
subprocesses with piped stdout/stderr instead of opening a PTY.
- Pump subprocess output through the existing terminal emulator/event
channel so output capture, completion, and task killing keep working.
- Build ACP terminal commands non-interactively in headless mode.
- Keep the normal editor terminal path unchanged when the global is
unset.
- Handle non-PTY output edge cases by preserving split CRLF sequences
and avoiding an indefinite wait if subprocess exit-status polling
errors.
## Testing
- `cargo fmt --all`
- `cargo test -p util non_interactive_omits_interactive_flag`
- `cargo test -p terminal test_no_pty_task_terminal_captures_output`
- `cargo test -p terminal test_convert_lf_to_crlf_preserves_split_crlf`
- `cargo test -p terminal test_write_output`
- `cargo check -p eval_cli`
- `git --no-pager diff --check`
## 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 terminal tool failing with "Not a tty" in
headless/eval environments
This separates the two user-message identities we currently need in
agent threads:
- `protocol_id`: the ACP `messageId` used to group or split streamed
message chunks from ACP agents.
- `client_id`: the Zed-generated user message ID used by the native
agent for truncate, rewind, edit/regenerate, checkpoints, token usage,
and persistence.
The main behavior change is that ACP protocol message IDs now affect
message merging/rendering without leaking Zed-native client IDs into ACP
agents by default. Agents that can accept Zed-generated user message IDs
opt into that path through `AgentSessionClientUserMessageIds`, which
owns both ID generation and prompt submission. The native Zed agent
implements that capability; normal ACP agents continue through the
protocol-only `prompt` path.
In ACP v2 we'll have a mechanism for getting user message replays that
will allow the agent to adequately generate it's own opaque id that we
can then use for these other capabilities. But for now, this split at
least makes sure we keep the two concepts distinct.
Release Notes:
- N/A
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
We finally have a cancellation mechanism to use! Made the non
side-effectful handlers stop their work if we get a cancel request
notification.
Release Notes:
- N/A
Broke the headless builds for evals. Open to cleaner ways of doing
this...
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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
Given the model list is dynamic now, we need a wait
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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
Move `git_ui` to `agent_ui` test dependencies
and bump the eval CLI Docker image to Rust 1.95.0 while pinning
the Python `harbor` dependency to 0.6.4
Release Notes:
- N/A
Testing out Niko's new SDK design
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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
This PR decouples `language_model`'s dependence on Zed-specific
implementation details. In particular
* `credentials_provider` is split into a generic `credentials_provider`
crate that provides a trait, and `zed_credentials_provider` that
implements the said trait for Zed-specific providers and has functions
that can populate a global state with them
* `zed_env_vars` is split into a generic `env_var` crate that provides
generic tooling for managing env vars, and `zed_env_vars` that contains
Zed-specific statics
* `client` is now dependent on `language_model` and not vice versa
Release Notes:
- N/A
🫡
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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- Removed legacy Text Threads feature to help streamline the new agentic
workflows in Zed. Thanks to all of you who were enthusiastic Text Thread
users over the years ❤️!
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Closes #ISSUE
Release Notes:
- N/A
Closes #ISSUE
Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
Release Notes:
- N/A
## Context
Fixes some issues I ran into when running this on a remote machine.
## Self-Review Checklist
<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
This removes the assumption that one project <-> one native agent. The
native agent now maintains a project per session. We don't make use of
this right now, but it will come in handy once we start sharing ACP
connections globally.
Release Notes:
- N/A
Emit client-side organization changed events through
`RefreshLlmTokenListener` so it produces the same `RefreshLlmTokenEvent`
used for server-pushed `UserUpdated` messages.
This keeps token refresh fan-out in one place.
Closes CLO-383.
Release Notes:
- N/A
---------
Co-authored-by: Tom Houlé <tom@tomhoule.com>