Commit graph

879 commits

Author SHA1 Message Date
Bennet Bo Fenner
68340172a1
agent: Remove unused LanguageModelImage APIs (#57050)
Pulled out from #56866. Will help with MCP image support

Release Notes:

- N/A
2026-05-18 12:22:22 +00:00
Ben Brandt
23231879cd
acp: Add ACP session deletion support (#57004)
Still behind a flag until RFD progresses. But also fixes one area where
we would have called delete even if we didn't have support.

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
2026-05-17 17:03:17 +00:00
Danilo Leal
700b0b5de6
agent_ui: Render skills as creases (#56689)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Closes AI-230

This PR makes skills, added as /-mentions, be rendered in the agent
panel as creases, like anything you'd @-mention. Naturally, clicking on
the crease button opens the corresponding skill file in a buffer.

It turned out to be quite a bit of plumbing to make this work,
particularly as I am also introducing an interface to display dividers
and headers in the completion menu. This was relevant to me to add
because it sets a good foundation to convert many agent panel-related
actions as slash commands.

Release Notes:

- N/A

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
2026-05-14 22:20:34 +00:00
Richard Feldman
29ca37fdcc
Load global AGENTS.md into native agent system prompt (#56757)
Watches a user-global `AGENTS.md` file alongside `settings.json` (at
`~/.config/zed/AGENTS.md` on macOS/Linux, `%APPDATA%\Zed\AGENTS.md` on
Windows) and includes its trimmed contents in the native agent's system
prompt.

This matches the pattern used by Codex (`CODEX_HOME/AGENTS.md`,
defaulting to `~/.codex/AGENTS.md`) and OpenCode
(`~/.config/opencode/AGENTS.md`): personal instructions live next to
other app config and apply across every project the user opens.

## Behavior

- Native Zed agent only. Not passed to ACP / external agents.
- Reads the local config dir, so SSH-remoted projects still get the
local user's personal `AGENTS.md` (project rules continue to come from
the remote workspace).
- Missing, empty, or whitespace-only files are silently treated as no
`AGENTS.md`.
- Read errors surface through the same notification UI as settings
errors, with a stable notification ID that's dismissed once the file
becomes readable again.
- The file is read in full, matching how existing project rules / repo
`AGENTS.md` files are loaded today.

## System prompt rendering

In the system prompt, the user-global `AGENTS.md` appears as `###
Personal AGENTS.md` immediately before `### Project Rules`, so the model
sees personal defaults first and project guidance later (project rules
take precedence on conflicts).

## Tests

- `user_agents_md` watcher: initial load, empty/whitespace ignored,
reacts to file edits.
- `SystemPromptTemplate`: renders personal `AGENTS.md` before project
rules; omits the section when no user `AGENTS.md` is present.

Closes AI-231

Release Notes:

- Added support for a global `AGENTS.md` file alongside `settings.json`
that is automatically included in the agent's instructions for every
project.
2026-05-14 15:02:33 +00:00
procr1337
9fe2931297
agent: Fix tool paths preferring files in subdirectories named after the project root (#56230)
The tool definition is very clearly contradicting the previous behavior.
Performance impact is unclear to me, we increase the work in a
potentially expensive loop, but it seems necessary to have both the
specified behavior from the tool definition, as well as the
heuristic/fallback for misbehaving models that seems to be intended.

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 #56225

Release Notes:

- Fixed tool paths preferring files in subdirectories named after the
project root
2026-05-14 10:12:56 +00:00
Cameron Mcloughlin
2301e61d2a
agent_ui: Mermaid diagrams (#56430)
Adds mermaid diagrams to the agent UI

Defaults to rendering the diagram, toggle to switch back to code.

<img width="605" height="837" alt="image"
src="https://github.com/user-attachments/assets/ed87f4e3-77f3-4602-b783-65eda909ad01"
/>
<img width="615" height="334" alt="image"
src="https://github.com/user-attachments/assets/1a422c83-fed4-4099-b895-b5a16e9d2222"
/>


Also makes markdown preview markdown rendering use theme colors:

Before:
<img width="593" height="781" alt="image"
src="https://github.com/user-attachments/assets/8598ca42-d44a-426b-ac4a-fb3cd1288780"
/>

<img width="593" height="781" alt="image"
src="https://github.com/user-attachments/assets/737fdd62-0a37-48dd-a13a-4e11bf80f038"
/>


Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-13 09:57:17 +00:00
Richard Feldman
fe9f956460
Restrict tools from editing sensitive agents folders (#56456)
Treat `.agents/skills/` (project-local) and `~/.agents/skills/` (global)
as **sensitive paths**, on par with `.zed/` and the global config
directory. The agent's built-in editing tools (`edit_file`,
`write_file`, `create_directory`, `delete_path`, `move_path`,
`copy_path`) now require explicit user authorization before modifying
anything inside those paths, because the contents of skill files control
agent behavior.

This protection is worth landing on its own, ahead of Zed adding its own
skills support: other agents (e.g. Claude Code) already write skill
files into these locations, so a Zed installation may already have
skills on disk that should not be silently editable by the agent.

Also tightens the **pre-existing `.zed/` check** to compare path
components case-insensitively. macOS and Windows use case-insensitive
filesystems by default, so without this fix a malicious settings author
could bypass the local-settings classifier with `.ZED/settings.json`
(the canonicalized inode would match, but the path-component comparison
would miss it). The new `.agents/skills/` check has the same hazard and
now shares a single `component_matches_ignore_ascii_case` helper with
the `.zed/` check.

Introduces the `agent_skills` crate, scoped for now to just the path
constants and helpers (`global_skills_dir`,
`project_skills_relative_path`, `SKILL_FILE_NAME`) so the
tool-permission machinery can recognize the agent skills tree without
depending on a skill discovery / parsing / loading layer. Those will
land in follow-up PRs.

Closes AI-217

Release Notes:

- Agent: Require user confirmation before letting tools modify files
inside `.agents/skills/` (per-project) or `~/.agents/skills/` (global),
so skills installed by any agent are protected from unsolicited edits

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
Co-authored-by: Martin Ye <martinye022@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-05-12 22:47:51 +00:00
Cameron Mcloughlin
4074eabb3d
agent_ui: Images (#56427)
Adds images to the agent panel

Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-05-12 21:03:27 +00:00
Ben Brandt
c35996dbfb
agent: Promote experimental agent system prompt (#56543)
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
2026-05-12 15:41:31 +00:00
Ben Brandt
78c889c21d
open_ai: Responses API improvements (#56476)
Release Notes:

- Removed deprecated OpenAI models
- Added support for gpt-5.4-nano/mini models for OpenAI provider
- Improved output quality when using OpenAI models

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Co-authored-by: Gaauwe Rombouts <mail@grombouts.nl>
2026-05-12 14:47:16 +00:00
Ben Brandt
db6039d815
agent: Remove open tool (#56295)
At this point, this tool rarely gets called and the agent can likely
figure out how to call these itself.

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 open tool from built-in Agent tools.
2026-05-11 08:58:03 +00:00
Cameron Mcloughlin
de14e3fcad
agent: Separate flag for rename tool (#56228)
Pulls the rename tool into a separate flag and staff ships it

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-09 11:03:36 +00:00
Ben Brandt
942f90a5e3
agent: Refresh agent system prompt (#56164)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Streamline the instructions around communication, tool use, planning,
and project roots.

Remove the `now` tool and also clean up several tool descriptions.

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

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-09 09:56:17 +00:00
Bennet Bo Fenner
be83c952f6
agent: Allow specifying which model is used for subagents (#56203)
Closes #52042 

Release Notes:

- agent: Added setting `subagent_model` to specify which model is used
when subagent is spawned

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-08 17:06:02 +00:00
Bennet Bo Fenner
e78ddcac8d
agent: Improve UX when agent tries to edit unsaved buffer (#55655)
Before:

1. Agent tries to edit unsaved file
2. Tool call fails with error telling the agent to ask the user to save
or discard edits
3. User types save/restore
4. Agent uses save/restore tool


https://github.com/user-attachments/assets/c94dd361-e8e0-48ee-be31-da8afe594419

After:

1. Agent tries to edit unsaved file
2. User is prompted to save/restore file
3. User accepts/rejects or saves/discards file manually


https://github.com/user-attachments/assets/1d98a0c4-4420-4426-94f2-42355de230be

Release Notes:

- agent: Improved UX when agent tries to edit unsaved buffer

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-08 11:26:03 +00:00
Bennet Bo Fenner
7556cf8ced
agent: Fix race-condition for LSP tool registration (#56044)
This fixes a race condition where the thread would not get the LSP tools
at startup if the feature flag was not resolved yet.
We now always add the tools, but filter them out when we start a new
turn if the feature flag is not set.

Release Notes:

- N/A
2026-05-07 13:47:13 +00:00
Bennet Bo Fenner
47ea7de9c8
Fix leak detector causing panics in unit evals (#56029)
Fixed an issue where the leak detector would sometimes cause panics when
running unit evals. Fixed this by matching the tear-down logic that we
use in the `gpui::test` macro

> thread 'tools::evals::edit_file::eval_from_pixels_constructor'
(14336149) panicked at crates/gpui/src/app/entity_map.rs:1116:9:
Exited with leaked handles:
Leaked handle for entity language::buffer::Buffer (EntityId(50v1)):

Release Notes:

- N/A
2026-05-07 10:51:34 +00:00
Bennet Bo Fenner
42017bcad2
agent: Handle out of order old_text/new_text in edit file tool (#55894)
In the case where the model would respond with `new_text` before
`old_text`, we would just emit an empty `old_text`, because the parsing
layer was operating under the assumption that `old_text` occurs before
`new_text`.

We now hold back new text chunks if we receive them first, and only emit
them once old_text is complete.

In addition to that we also need to handle the case where the first
chunk contains `old_text` and `new_text`. In that case we don't know
which one of the two fields have finished streaming, since we can't rely
on the ordering anymore. Therefore we hold back all events until we
receive the full edit, and emit a single OldTextChunk (done = true) and
a single NewTextChunk (done = true)

Closes #55398

Release Notes:

- agent: Fixed an issue where editing would sometimes fail for specific
models (Deepseek v4)
2026-05-07 08:59:28 +00:00
Bennet Bo Fenner
70ee54da8f
agent: Add write_file tool (#55865)
Splits the edit tool into two separate tools `write_file` (previously
`mode = write`), and `edit_file` (previously `mode = edit`).
This makes the JSON schema for the `edit_tool` much simpler. We've seen
models (especially older ones) struggle with providing `mode = edit +
edits` and `mode = write + content` fields. This seems to improve eval
scores for Sonnet 4.6 slightly.

Also added two unit evals to ensure that the model uses the tool to
create new/override existing files

Release Notes:

- N/A

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-06 15:47:18 +00:00
Prohect
3afcafe3fc
agent: Return clear error when read_file tool path is a directory (#54303)
Fixes #54244

When the `read_file` tool is called with a path that points to a
directory instead of a file, it now returns a clear, actionable error
message telling the agent to use `list_directory` instead.

Previously the tool would fail with an unhelpful generic error. Now it
explicitly checks whether the path is a directory before attempting to
read it.

A test covering this case is also included.

Release Notes:

- Fixed `read_file` tool returning an unhelpful error when given a
directory path; it now suggests using `list_directory` instead.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-06 13:26:09 +00:00
Kuroda Kayn
5d55b93def
agent: Fix create-directory tool icon (#55549)
Fixes #55436

The create-directory agent tool was classified as a read tool, which
caused
  the agent UI to render it with the search icon.

This PR marks `create_directory` as an edit tool and gives it a
folder-add
icon in the conversation tool card. Creating a directory mutates the
project,
so treating it as an edit tool better matches the behavior and avoids
the
  misleading search icon.

  Validation:
  - `cargo build -p zed`
- `cargo test -p agent test_create_directory_tool_kind_is_edit --
--nocapture`
  - `git diff --check`
- Manually verified in a local dev build that asking the agent to create
`tmp-
zed-icon-test-dir` shows a folder icon instead of a search icon, and
that the
  directory is created successfully.

  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:

  - Fixed create-directory agent tool cards showing a search icon.

<img width="593" height="281" alt="07547c9f-2cf2-432b-8c0f-86f336dce3c5"
src="https://github.com/user-attachments/assets/a5a277ee-56c5-4801-a7d8-27c347222169"
/>
<img width="594" height="157" alt="2b3f2b62-4782-42f1-a20d-c26f9cfe8940"
src="https://github.com/user-attachments/assets/37845785-5145-4701-9060-1dd1bdb60801"
/>

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-06 12:17:42 +00:00
Conrad Irwin
be705e677b
Merge gpui::Task and scheduler::Task (#53674)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-05 22:41:13 +00:00
Richard Feldman
c60c0d5f49
Strengthen guidance for git commands in the terminal tool (#55787)
Move guidance about pty-blocking commands from the `TerminalToolInput`
struct-level doc comment to the `command` field's doc comment so it's
surfaced more prominently to the model in the tool's JSON schema, and
call out `--no-pager` and `GIT_EDITOR=true` explicitly for git
operations.

In practice, the previous wording about `git --no-pager diff` was easy
for agents to overlook, leading to terminal calls that block waiting on
`less` (for `git log`/`git diff`/`git show`) or on an interactive editor
(for `git rebase`/`git commit`/`git merge`).

Unit eval change before/after wording change:

<img width="1662" height="740" alt="image"
src="https://github.com/user-attachments/assets/5f7921f3-87fa-4f88-9839-193ca4522572"
/>

Closes AI-154

Release Notes:

- Zed Agent's terminal tool now much more consistently uses `--no-pager`
and `GIT_EDITOR` with `git` commands
2026-05-05 19:51:55 +00:00
Bennet Bo Fenner
02af528c5a
agent: Allow model to provide stringified timezone in now tool (#55776)
See
https://github.com/zed-industries/zed/issues/55186#issuecomment-4376114420

I think the recent changes to the tool schema in #55763 will make this
more unlikely, but does not hurt to allow the model to provide `"utc"`.

Release Notes:

- N/A
2026-05-05 14:40:43 +00:00
Bennet Bo Fenner
9955c4579d
agent: Simplify tool schemas for enums (#55763)
Previously schemars generated oneOf variants for these enums (because we
added inline comments), making the schemas more complicated than they
had to be.

E.g. `edit_file` `mode`

Before:
```json
{
  "mode": {
    "description": "The mode of operation on the file. Possible values:\n- 'write': Replace the entire contents of the file. If the file doesn't exist, it will be created. Requires 'content' field.\n- 'edit': Make granular edits to an existing file. Requires 'edits' field.\n\nWhen a file already exists or you just created it, prefer editing it as opposed to recreating it from scratch.",
    "oneOf": [
      {
        "description": "Overwrite the file with new content (replacing any existing content).\nIf the file does not exist, it will be created.",
        "type": "string",
        "const": "write"
      },
      {
        "description": "Make granular edits to an existing file",
        "type": "string",
        "const": "edit"
      }
    ]
  }
}
```

After:
```json
{
  "mode": {
    "description": "The mode of operation on the file. Possible values:\n- 'write': Replace the entire contents of the file. If the file doesn't exist, it will be created. Requires 'content' field.\n- 'edit': Make granular edits to an existing file. Requires 'edits' field.\n\nWhen a file already exists or you just created it, prefer editing it as opposed to recreating it from scratch.",
    "type": "string",
    "enum": ["write", "edit"]
  }
}
```

Release Notes:

- N/A
2026-05-05 12:39:41 +00:00
Bennet Bo Fenner
5eb6a465dc
agent: Remove display_description from edit tool (#55752)
We did not really use it in practice (we would only display it in the
tool card header until we received a path), so as is it just wastes
tokens. Therefore removing it.

Release Notes:

- agent: Reduce token usage when LLM edits file
2026-05-05 12:11:24 +00:00
Bennet Bo Fenner
d6cc34c167
agent: Cleanup edit_file evals (#55750)
- Rename `streaming_edit_file` to `edit_file`
- Remove workaround for replacing old edit tool with streaming edit file
tool

Release Notes:

- N/A
2026-05-05 09:58:05 +00:00
Cameron Mcloughlin
f482f9e18c
agent: LSP tools (#55744)
Adds 4 (technically 5) new tools to the zed agent, corresponding to LSP
actions:
- `find_references`
- `goto_definition`
- `rename_symbol`
- `get_code_actions` and `apply_code_actions`

Notes:
- `rename_symbol` skips doing a `prepare_rename`. If there is nothing to
rename at the position, it will forward the error to the agent
- The code action tools are stateful. The state is stored in the
`get_code_actions` tool itself as a `PendingCodeActions`. It is not
passed into/out of subagents. Calling `apply_code_actions` without
calling `get_code_actions` first is an error, but I've never seen an
agent do this

Symbols are identified by:
- file name
- line number
- symbol

If there is no substring match on that line for the symbol text, it is
an error. If there are multiple, it chooses the first. This may not be
great if you have a line like: `fn convert(x: foo::Something) ->
bar::Something` - the second `Something` is a different symbol, but is
inacessible to these tools. Probably fine for now, but we can look into
improving


Release Notes:

- Added: New tools for the Zed Agent for interacting with language
servers

---------

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
2026-05-05 09:35:08 +00:00
Bennet Bo Fenner
8f2ab516d0
agent: Refactor edit file tool state handling (#55663)
Ports some changes introduced in #51165 out to make merge conflicts
easier to handle.

Splits the `Pipeline` into two separate types for mode edit/write so we
don't need to maintain that invariant inside the pipeline/in the parser

Also moves the parser to be a submodule of `edit_file_tool`

Release Notes:

- N/A
2026-05-04 15:45:06 +00:00
Bennet Bo Fenner
193a8c75a3
agent: Better error messages when tool fails (#55616)
Does not actually seem useful to the LLM to include `Failed to receive
tool input: ...` in the error message. We now only include the actual
error.

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)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-04 10:27:33 +00:00
Bennet Bo Fenner
9cbdc46d96
agent: Remove old edit file tool (#55612)
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:

- agent: Improve reliability when LLM edits file
2026-05-04 09:54:39 +00:00
Bennet Bo Fenner
7de96710e2
agent: Do not fail if buffer has changed on disk (#55606)
Previously, we would always return an error if the LLM attempted to edit
a file that had been modified on disk or by the user in the meantime.
However, this often led to unnecessary failures and slowdowns. So,
instead of failing every time, we now attempt to resolve a match. If we
don't find one, we return an error to inform the LLM that the file has
been modified since the last read.

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:

- agent: Do not fail edit tool if file has unsaved changes
2026-05-04 08:54:20 +00:00
Anthony Eid
ff8fa053ff
agent: Remove new thread location setting (#55575)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
cc:  @danilo-leal 

This setting is from when we had the git worktree picker in the agent
panel, now that it is in the menu bar it doesn't make sense to keep it.
We plan to add a similar feature in the future to handle the "new thread
== new git worktree" workflow

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
2026-05-03 19:30:04 +00:00
Agus Zubiaga
db5a9be2ff
edit tool: Support stringified mode parameter (#55498)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / check_wasm (push) Blocked by required conditions
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / extension_tests (push) Blocked by required conditions
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
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
2026-05-02 16:11:10 +00:00
Oleksiy Syvokon
c499a95218
tools: Make time-zones more case-insensitive (#55288)
gpt-5.5 likes to call the `now` tool with upper-case "UTC", leading to
this error:

> Failed to receive tool input: tool input was not fully received


Release Notes:

- N/A
2026-04-30 09:15:36 +00:00
Bennet Bo Fenner
24f62484e9
Support latest MCP protocol version (#54494)
Updates our MCP implementation to support `2025-06-18` and `2025-11-25`

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 #54458, #53456

Release Notes:

- Support latest MCP version (`2025-11-25`)
2026-04-29 16:29:48 +00:00
Ben Brandt
0dcb6731df
agent: Remove streaming edit feature flag (#55152)
We already enabled the feature flag, but that only applies to logged in
users. Going to make sure that everyone gets the new tool as long as the
model supports it.

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:

- agent: Improve edit tool performance for models that support streaming
tool calls.
2026-04-29 08:43:56 +00:00
Matt Van Horn
a8ca954066
agent: Stop over-escaping dashes in tool_permissions regex patterns (#51603)
Fixes #51537

`regex::escape()` escapes dashes, but dashes are only special inside
`[]` character classes in regex. This means tool_permissions patterns
end up with unnecessary backslashes:

**Before:** `^https?://typescript\-eslint\.io`, `^git\-lfs\s+pull(\s|$)`
**After:** `^https?://typescript-eslint\.io`, `^git-lfs\s+pull(\s|$)`

The fix adds a small `escape_for_pattern()` helper that calls
`regex::escape()` then strips the unnecessary dash escaping via
`.replace("\\-", "-")`. This is applied to all five call sites in
`pattern_extraction.rs`.

Tests updated to expect unescaped dashes, plus a new
`test_dashes_are_not_escaped` test covering terminal commands, URLs, and
paths with dashes.

This PR was developed with AI assistance.

Release Notes:

- Fixed unnecessary escaping of dashes in agent tool permission patterns
(e.g. `typescript\-eslint` is now `typescript-eslint`)

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-04-28 21:57:41 +00:00
Ben Brandt
a8ae1677a3
Implement tool result conversion for anyhow errors (#55001)
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
2026-04-27 13:03:33 +00:00
Bennet Bo Fenner
bf3fc2336d
agent: Allow tools to output multiple content parts (#54518)
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
2026-04-27 12:36:11 +00:00
Richard Feldman
4a15e201ba
Don't block thread creation when PromptStore fails to initialize (#52333)
NativeAgentServer::connect used `prompt_store.await?` which turned any
PromptStore initialization failure (permission denied, disk issues,
etc.) into a hard connection error, putting the ConversationView into
LoadError state and preventing all new native agent threads from being
created.

Changed to `.log_err()` so the error is logged at ERROR level but thread
creation proceeds with `prompt_store: None`. `NativeAgent::new` already
accepts `Option<Entity<PromptStore>>` and handles `None` gracefully —
user custom prompts won't load but threads still work.

Added a regression test that serializes a stale thread ID, loads the
panel (triggering the "last active thread not found in database"
warning), then dispatches NewThread through the real NativeAgentServer
path and verifies it produces a connected thread.

Release Notes:

- Agent panel now handles filesystem errors more gracefully
2026-04-24 12:32:28 +00:00
Oleksiy Syvokon
250e697ff7
project_search: Fix project search status text and refactor search state (#54753)
This change fixes a small bug where we were showing "Loading project..."
even when in fact we had already started the search.

It also refactors three booleans in the `SearchState` enum, so that it's
harder to make similar mistakes in the future.


Release Notes:

- N/A
2026-04-24 10:45:16 +00:00
Lukas Wirth
c5a2807492
Remove smol as a dependency from a bunch of crates (#53603)
We aren't making use of it in these crates and it unblocks some
web-related work

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-24 10:29:51 +00:00
Tom Houlé
67e41996be
agent: Propagate tool permission decisions to pending permission prompts (#54679)
When the agent issued several parallel tool calls that all required
confirmation, clicking "Always for en.wikipedia.org" (or similar) on the
first prompt would persist the new rule to settings but leave the
sibling prompts stuck waiting on their own oneshot channels. The same
happened across subagents, and whenever the user edited settings.json by
hand while prompts were on screen.

`ToolCallEventStream::authorize()` now takes full ownership of the
permission decision. It evaluates the tool-permission settings up front,
and on Confirm it spawns a task that races the user's response against a
`SettingsStore` observer. When settings change, it re-runs the decision;
a new Allow or Deny drops the response receiver, flips the tool call
status to dismiss the prompt UI, and resolves the task without user
input. Subagents fall out of this for free since each thread observes
`SettingsStore` independently.

A few tools (`copy_path`, `move_path`, `delete_path`,
`create_directory`, `save_file`, `restore_file_from_disk`, and the
`edit-file` helper) sometimes need to prompt even when settings say
Allow — for example, edits that target `.zed/settings.json`. For those,
a new `authorize_always_prompt()` method skips the settings check and
always waits for user input; tools pick between the two at the call site
based on whether the path is sensitive.

Closes #54101.

Release Notes:

- In the agent panel, when you click "Always allow" for a tool, this
decision now gets propagated to other pending calls to the same tool.

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-04-24 08:42:44 +00:00
Eric Holk
9adb4ea63e
Fix agent threads missing from sidebar after upgrade (#54723)
Fixes #54618.

## Summary

After upgrading from `v0.232.x` to `v0.233.5+`, many users reported that
most
of their agent threads "disappeared" from the sidebar. The threads are
still
on disk in the legacy `threads.db` — but they never make it into
`sidebar_threads`, which is the only table the new sidebar UI reads
from, so
they're unreachable from the UI.

The root cause is a race between `ThreadStore::reload` and
`migrate_thread_metadata`:

- `ThreadStore::new` constructs with an empty in-memory `Vec` and kicks
off
  `reload()` as a fire-and-forget task.
- `migrate_thread_metadata` runs during `agent_ui::init` and reads
  `ThreadStore::global(cx).read(cx).entries()` synchronously, without
  awaiting that reload.
- On cold boot the migration observes an empty iterator, early-returns
on
  `to_migrate.is_empty()`, and never populates `sidebar_threads`. The
  migration runs every launch, so it keeps losing the race forever.

Empirically, the only rows that *did* end up in `sidebar_threads` for
affected users came from `handle_conversation_event` writing rows when
the
user actively interacted with a thread. That's why users would typically
see
a handful of recently-touched threads rather than their full history.

## Fix

1. `ThreadStore` now tracks its current reload as a `Shared<Task<()>>`
and
   exposes it via `reload_task()`. `migrate_thread_metadata` awaits this
   before reading `entries()`.
2. Move the top-5-per-project unarchive pass out from under the
   `is_first_migration` guard. Previously the rescue only ran when
   `sidebar_threads` was empty, which meant any user who had even one
pre-existing row (e.g. from interacting with a thread on a prior launch)
got every subsequent batch of migrated threads archived with no rescue.
   Running the rescue per-batch is stateless and idempotent — a user who
bounces between older releases and newer ones still gets their top 5 per
   project surfaced each time a new batch is migrated.

No new KVP flag or one-shot backfill is needed: because the migration
already dedupes by session_id and runs on every launch, the next cold
boot
on a fixed build picks up any legacy threads that earlier launches
missed.

## Structure

The PR is split into two commits to make the diff easy to verify:

1. **Regression test** — fails on `main`, reproduces the cold-boot race
by
seeding the legacy DB, reinitializing `ThreadStore` to get a fresh empty
   cache, and running the migration without parking first.
2. **The fix** — gates entries reads on `reload_task().await`, and
adjusts
the per-batch rescue policy. Updates one existing test's assertions to
   match the new per-batch rescue policy.

## Validation

- The regression test fails on `main`, passes after the fix.
- All `agent_ui`, `agent::thread_store`, and `sidebar` lib tests pass.
- `./script/clippy -p agent -p agent_ui` is clean.
- End-to-end repro with a real on-disk data dir: launched `v0.230.2 →
v0.231.2 → v0.232.3 → v0.233.8` as a non-staff user, creating 15 threads
  and interacting with one, reproduced the reported state (1 thread in
sidebar, 14 missing). Launched a debug build of this branch against the
same data dir: `Migrating 14 thread store entries` in the log, 15 rows
in
`sidebar_threads` with 6 unarchived (the interacted-with thread plus the
  5 most recent), 9 archived and reachable from the archive view.

Release Notes:

- Fixed agent threads appearing to be missing after upgrading to the
parallel-agents sidebar. The thread-metadata migration was racing
against the on-disk thread store's async reload and skipping itself on
every launch. Upgrading to this build runs the migration successfully;
previously-missing threads are surfaced either in the sidebar (5 most
recent per project) or in the archive view.
2026-04-24 03:09:30 +00:00
Finn Evers
9b40411c6a
Fix bad GitHub merge queue merge (#54721)
No, sadly, the title is not a typo. See
https://www.githubstatus.com/incidents/zsg1lk7w13cf for the context.
I'll read with joy and popcorn through that root cause analysis.

It makes literally zero sense what happened here, but for some completly
bonkers reason GitHub completely messed up the merge queue with
https://github.com/zed-industries/zed/pull/54632.

I have no idea how it happened. It makes literally zero sense. A PR
going into the merge queue should have the same LoC when getting out of
it. GitHub obviously does not check this. GitHub causes extra work with
a feature that is supposed to save time.

Thanks, I guess.

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-23 23:47:30 +00:00
Danilo Leal
0ab64d6414
branch_picker: Add button to filter remote branches (#54632)
This PR brings back the button to filter remote branches when accessing
the title bar's branch picker with the mouse. It was unintentionally
removed when we introduced the new worktree picker.

Release Notes:

- N/A
2026-04-23 18:26:44 +00:00
Kirill Bulatov
5f68479937
Stop showing backtraces in default logging (#54660)
When using `.log_err()` or `.detach_and_log_err(cx)` or similar.

See also https://github.com/zed-industries/zed/pull/36404,
https://github.com/zed-industries/zed/pull/46383,
https://github.com/zed-industries/zed/pull/44896,
https://github.com/zed-industries/zed/pull/43917 and many more.

Before, a
62bd61a679/crates/languages/src/go.rs (L568)
line would show a backtrace even for `.context("no cached binary")?;`
case, same as many other usages around the code:

<img width="2032" height="1162" alt="before"
src="https://github.com/user-attachments/assets/ef2188b3-74c9-4c86-82b8-9fdaed3c26ae"
/>

After:

<img width="1896" height="157" alt="after"
src="https://github.com/user-attachments/assets/a1067d9f-61f4-4833-aeab-9f1042d2514a"
/>



To show a backtrace as before, use `log_err_with_backtrace`.

Release Notes:

- Improved Zed's log output on errors
2026-04-23 14:14:11 +00:00
Oleksiy Syvokon
5294e16547
Wait for worktree scan to complete before starting search (#54534)
When starting a search on a project that is in the middle of a scan, we
used to miss results in files that had not yet been scanned.

This change makes the search wait for the scan to complete.


Closes #9858

Release Notes:

- Fixed incomplete search results when the project scan is incomplete
2026-04-23 13:35:13 +00:00
Ben Brandt
58e2b7ecdd
acp: Use new Rust SDK (#52997)
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
2026-04-22 15:02:57 +00:00