Derive collapsed state from `Editor.has_any_buffer_folded` instead of
tracking it separately, removing redundant `ResultsCollapsedChanged` event
and stale `is_collapsed`/`results_collapsed` fields.
Closes#48734
Release Notes:
- Fixed collapse/expand all button in buffer search and project search
not syncing correctly when toggling individual file sections
---------
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
It's possible that a given project/workspace has symlinks that go
outside the current directories. In order to alert the user of some
potential files the agent is accessing they may not be expecting, we ask
for permission first.
Release Notes:
- agent: Prompt for permission if the agent tries to access files whose
symlinks resolve outside the current workspace
When a tool's JSON response fails to parse, the system would:
1. Create a `LanguageModelToolResult` with the error
2. Add it to `pending_message.tool_results`
3. **Never add the corresponding `ToolUse` to
`pending_message.content`**
This left an orphaned `tool_result` that would be sent to the LLM API
without a matching `tool_use` block, causing the provider to reject the
entire request with an error like:
```
messages: Assistant message must contain at least one content block, if
immediately followed by a user message with tool_result
```
The issue was in `handle_tool_use_json_parse_error_event()`. It created
and returned a `LanguageModelToolResult` (which gets added to
`tool_results`), but **failed to add the corresponding `ToolUse` to the
message `content`**.
This asymmetry meant:
- `pending_message.content`: [] (empty - no ToolUse!)
- `pending_message.tool_results`: {id: result}
When `AgentMessage::to_request()` converted this to API messages, it
would create:
- Assistant message: no tool_use blocks ❌
- User message: tool_result block ✅
APIs require tool_use and tool_result to be paired, so this would fail.
**Without this fix, the conversation becomes permanently broken** -
every subsequent message in the thread fails with the same API error
because the orphaned tool_result remains in the message history. The
only recovery is to start a completely new conversation, making this a
particularly annoying bug for users.
Modified `handle_tool_use_json_parse_error_event()` to:
1. **Add the `ToolUse` to `pending_message.content`** before returning
the result
2. Parse the raw_input JSON (falling back to `{}` if invalid, as the API
requires an object)
3. Send the `tool_call` event to update the UI
4. Check for duplicates to avoid adding the same `tool_use` twice
This ensures `tool_use` and `tool_result` are always properly paired.
Added comprehensive test coverage for
`handle_tool_use_json_parse_error_event()`:
- ✅ Verifies tool_use is added to message content
- ✅ Confirms tool_use has correct metadata and JSON fallback
- ✅ Tests deduplication logic to prevent duplicates
- ✅ Validates JSON parsing for valid input
## Manual Testing
To reproduce and test the fix:
1. Install the test MCP server:
```bash
cargo install --git https://github.com/dastrobu/mcp-fail-server
```
3. Add to Zed settings to enable the server:
```json
{
"context_servers": {
"mcp-fail-server": {
"command": "mcp-fail-server",
"args":[]
}
}
}
```
4. Open the assistant panel and ask it to use the `fail` tool
5. Without the fix: The conversation breaks permanently - every
subsequent message fails with the same API error, forcing you to start a
new thread
<img width="399" height="531" alt="image"
src="https://github.com/user-attachments/assets/533bdf40-80d3-4726-a9d9-dbabbe7379e5"
/>
7. With the fix: The error is handled gracefully, displayed in the UI,
and the conversation remains usable
<img width="391" height="512" alt="image"
src="https://github.com/user-attachments/assets/73aa6767-eeac-4d5d-bf6f-1beccca1d5cb"
/>
The mcp-fail-server always returns an error, triggering the JSON parse
error path that previously caused orphaned tool_result blocks.
Release Notes:
- Fixed an issue where errors could occur in the agent panel if an LLM
emitted a tool call with an invalid JSON payload
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Delete all the hacks and do things properly instead.
Closes https://github.com/zed-industries/zed/issues/45574
Before you mark this PR as ready for review, make sure that you have:
- [X] Added a solid test coverage and/or screenshots from doing manual
testing
- [X] Done a self-review taking into account security and performance
aspects
Release Notes:
- N/A
Following up on #49183 which fixed the category filter for remote
extensions.
This PR applies the same category filter logic to **dev extensions**.
Previously, dev extensions were always shown regardless of the selected
category filter (e.g., "Themes", "Languages").
Changes:
- Add `filtered_dev_extension_indices` to track which dev extensions
match the active `provides_filter`
- Add `dev_extension_matches_provides()` helper to map
`ExtensionManifest` fields to `ExtensionProvides` variants
- Update `render_extensions()` and list count to use filtered dev
extension indices
Release Notes:
- Fixed extension category filter not applying to dev extensions in the
extensions panel.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Closes#48537
**Explanation:**
The Deno test task example wasn't appearing because the undefined
ZED_CUSTOM_DENO_TEST_NAME variable made the filter invalid. Instead of
adding a default value, simplify the example to run all tests in the
file, which is the most common use case and works out of the box.
Before you mark this PR as ready for review, make sure that you have:
Screenshots:
Before:
<img width="3434" height="1349" alt="image"
src="https://github.com/user-attachments/assets/bc514103-9b33-489f-a69e-84257ea82acf"
/>
After:
<img width="3438" height="1376" alt="image"
src="https://github.com/user-attachments/assets/47674dde-ede8-4a9d-b365-d2df8e128e18"
/>
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 *or* Added/Fixed/Improved ...
---------
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Updating content with more detailed information, cross-linking pages
when useful (primarily the new docs for tool permissions), rearranging
information architecture a bit (e.g., putting examples last and
guidelines first, putting text threads vs. threads disclaimer above
everything, etc.), removing outdated images, etc.
Release Notes:
- N/A
---------
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Lsp-based folding disables indentation-based folding. Even though
indentation-based folding is non-functional, the crease icon is still
displayed in the gutter. This PR fixes this mismatch.
Before:
<img width="651" height="199" alt="before"
src="https://github.com/user-attachments/assets/ebd202e8-9eda-43c9-adbd-767e9802e590"
/>
After:
<img width="666" height="197" alt="after"
src="https://github.com/user-attachments/assets/b498e325-cd06-4c51-afdb-fcda4f1a25e6"
/>
Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
Release Notes:
- Removed non-functional folding creases from the gutter.
Co-authored-by: ozacod <ozacod@users.noreply.github.com>
Follow-up to #49187.
Instead of silently skipping updates when `try_borrow_mut` fails, this
PR defers the update by spawning it on the foreground executor. This
ensures the state change is eventually processed after the current
borrow completes.
Release Notes:
- N/A
The `on_thermal_state_change` and `on_keyboard_layout_change` callbacks
in `App::new_app()` called `borrow_mut()` unconditionally. These
callbacks are invoked asynchronously by macOS via dispatch queues when
the system's thermal or keyboard state changes, which can happen while
the app's RefCell is already borrowed during an update cycle, causing a
panic.
This change uses `try_borrow_mut()` instead. If the borrow fails
(because the app is already borrowed), the callback silently skips the
update - the state can be queried on the next frame.
Fixes [ZED-4WM](https://zed-dev.sentry.io/issues/ZED-4WM)
Closes#49181
Release Notes:
- Fixed a crash on macOS caused by thermal or keyboard layout state
changes occurring during UI updates.
This PR updates the extensions UI to respect the category filter for
already-installed extensions when searching for extensions.
Closes#48628.
Release Notes:
- The extension search will now properly respect the category filter for
extensions that are already installed
([#48628](https://github.com/zed-industries/zed/issues/48628)).
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
Reverts the whole "project search on type" set of PRs until we figure
out better ways to deal with flickering between search results
appearing.
Release Notes:
- N/A
## Bug
**Sentry:**
[ZED-3W3](https://sentry.io/organizations/zed-dev/issues/7085300207/)
(13 events, first seen 2025-12-03)
`summaries_for_anchors` panics with "cannot seek backward" when
iterating selection anchors whose excerpt locators are no longer in
ascending order after an `update_path_excerpts` call.
### Root cause
`update_path_excerpts` merges new excerpt ranges with existing ones.
When an existing excerpt has no overlap with any new range (e.g.
`existing_range.end < new.context.start`), it is removed from the
excerpts tree but is **not** recorded in `replaced_excerpts`. Its stale
locator persists in the `excerpt_ids` tree.
Later, when a new excerpt is inserted for a different path whose locator
falls between the stale locator and another surviving excerpt,
`summaries_for_anchors` can encounter anchors in an order where it needs
to seek the cursor *backward* — violating the forward-only cursor
invariant.
Concretely, the scenario requires:
1. A path with ≥3 excerpts (E_B1, E_B2, E_B3) with anchors in E_B2 and
E_B3.
2. An `update_path_excerpts` call that keeps E_B1, **removes E_B2** (no
overlap → no `replaced_excerpts` entry), and replaces E_B3 with a new
excerpt N.
3. A new path D inserted between paths B and C, whose excerpt E_D gets a
locator between N and E_B2's stale locator.
4. Resolving the old anchors: E_B2's stale locator seeks past E_D, then
E_B3→N tries to seek backward to N — **panic**.
## Fix
In the two branches of `update_path_excerpts` where existing excerpts
are removed without being absorbed into a new range, map the removed
excerpt to the nearest surviving neighbor (the last kept or inserted
excerpt) in `replaced_excerpts`. This ensures stale anchors always remap
to a valid, correctly-ordered locator.
The two branches are:
- `existing_range.end < new.context.start` — existing excerpt falls
entirely before the next new range
- `(None, Some(...))` — no more new ranges for remaining existing
excerpts
## Verification
- A reproduction test
(`test_cannot_seek_backward_after_excerpt_replacement`) that constructs
the exact crash scenario now passes.
- Full `multi_buffer` test suite (48 tests) passes with no regressions.
- Clippy is clean.
Release Notes:
- Fixed a possible crash when updating excerpts in multibuffers
Closes#42842
Previously, OpenFolderInWsl action assumed a valid path is on the host
and failed to open paths inside the WSL filesystem (accessed through
UNC)
Now the action checks for a WSL path and opens it with the appropriate
distro (skipping the choice modal)
This was manually confirmed to not regress as well as work with WSL
paths.
Code was written by hand, with extra checking by OpenAI Codex.
Release Notes:
- Fixed paths inside the WSL filesystem failing to open when using "open
folder in wsl"
Release Notes:
- Fixed prevent shell command injection in conda environment activation
The conda environment name was directly interpolated into the shell
command without proper escaping, which could allow command injection
if the environment name contained malicious shell metacharacters.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Document how to configure the Tailwind CSS language server for the
following languages:
- Astro
- Elixir
- HTML
- PHP
- Svelte
- Vue
Refs: #43969
Release Notes:
- N/A
---------
Co-authored-by: Kunall Banerjee <hey@kimchiii.space>
## Summary
- Adds a "Rules Hygiene" section to `.rules` after the existing Build
Guidelines section
- Establishes clear guidelines for when/how AI agents should propose
`.rules` changes
- Adds a "Crash Investigation" section with reference to
`script/crash-to-prompt` and other crash tooling
## What's in the Rules Hygiene section
**After any agentic session:** Agents should include a "Suggested .rules
additions" heading in their PR description if they discover non-obvious
patterns. Reviewers decide what gets merged.
**High bar for new rules:** Editing existing rules is always welcome.
New rules must be (1) non-obvious, (2) repeatedly encountered, and (3)
specific enough to act on. Single-crate rules go in that crate's
`.rules`.
**No drive-by additions:** Rules emerge from validated patterns through
a 3-step workflow: agent notes pattern → team validates → dedicated
commit.
## Context
Part of the Background Agent Pipeline initiative (BIZOPS-801). As we
scale automated crash investigation, we need guardrails to prevent
`.rules` bloat from agent sessions.
## Test plan
- [ ] Open a test agent session and confirm it sees the Rules Hygiene
guidance
- [ ] Verify the guidance is clear enough to follow without additional
context
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
on windows 10, When a laptop is plugged into or unplugged from a
monitor, Zed and my using GPUI app will restore from minimized state to
the foreground.
Closes #ISSUE
- [ ] Tests or screenshots needed?
- [ ] Code Reviewed
- [ ] Manual QA
Release Notes:
- N/A *or* Added/Fixed/Improved ...
---------
Co-authored-by: John Tur <john-tur@outlook.com>
This PR uses the recently introduced `CircularProgress` component to
display context window use information. It creates more space for the
message editor controls as well as simplifies the UI a little bit.
Through a tooltip, we communicate the same things we communicated before
(and more, actually, because rules use will be displayed there, too).
Note that this doesn't touch the display of split token use (for models
like GPT and whatnot).
<img width="500" height="484" alt="Screenshot 2026-02-13 at 6 16@2x"
src="https://github.com/user-attachments/assets/831cdfbf-fddd-4a11-8ac6-e9a25609aae9"
/>
Release Notes:
- Agent: Simplified context window use display by using a circular
progress component.
## Summary
- **Add category-claiming keywords** to 4 key AI doc intros (overview,
agent panel, edit prediction, configuration) so Google associates these
pages with "AI code editor" search terms
- **Expand AI overview into a pillar page** with substantive feature
summaries and a "How Zed approaches AI" differentiation section (open
source, native performance, multi-model, external agents, privacy)
- **Improve internal linking** across 11 files to strengthen the AI
topic cluster
## Internal linking changes
**Inbound links (non-AI docs → AI section):**
- `editing-code.md` → AI overview
- `terminal.md` → Inline Assistant + Agent Panel
- `configuring-zed.md` → AI Configuration
- `remote-development.md` → AI overview
**Fix orphans within AI section:**
- `billing.md` linked to subscription + plans (was orphaned with zero
internal links)
- `tools.md`, `rules.md`, `llm-providers.md`, `tool-permissions.md`,
`models.md` all now cross-link to related AI pages
**Outbound:**
- `overview.md` → `zed.dev/ai` and `getting-started.md`
## Test plan
- [ ] `mdbook build docs` succeeds
- [ ] Spot-check links resolve correctly in built output
- [ ] Review overview.md content for docs voice fit
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Seems like a small oversight, or rather, we didn’t have this discussion
at that point? Either way @JosephTLyons feel free to merge once you
confirm this is the intended URL.
Closes#49119.
Release Notes:
- N/A
Here's some backstory:
* on macOS, @cole-miller and I noticed that since roughly Oct 2025, due
to some changes to latest macOS Tahoe, for any spawned child process we
needed to reset Mach exception ports
(https://github.com/zed-industries/zed/issues/36754 +
6e8f2d2ebe)
* the changes in that PR achieve that via `pre_exec` hook on
`std::process::Command` which then abandons `posix_spawn` syscall for
`fork` + `execve` dance on macOS (we tracked it down in Rust's std
implementation)
* as it turns out, `fork` + `execve` is pretty expensive on macOS
(apparently way more so than on other OSes like Linux) and `fork` takes
a process-wide lock on the allocator which is bad
* however, since we wanna reset exception ports on the child, the only
official way supported by Rust's std is to use `pre_exec` hook
* posix_spawn on macOS exposes this tho via a macOS specific extension
to that syscall `posix_spawnattr_setexceptionports_np` but there is no
way to use that via any standard interfaces in `std::process::Command`
* thus, it seemed like a good idea to instead create our own custom
Command wrapper that on non-macOS hosts is a zero-cost wrapper of
`smol::process::Command`, while on macOS we reimplement the minimum to
achieve `smol::process::Command` with `posix_spawn` under-the-hood
Notably, this changeset improves git-blame in very large repos
significantly.
Release Notes:
- Fixed performance spawning child processes on macOS by always forcing
`posix_spawn` no matter what.
---------
Co-authored-by: Cole Miller <cole@zed.dev>
This PR #47407 broke thinking models for non-zed providers (Nightly
only) because we set `thinking_allowed` to `thinking_enabled`
(previously `true`)
[here](b671c8cdc5/crates/agent/src/thread.rs (L2400)).
The value of `thinking_enabled` eventually comes from the
`LanguageModel::supports_thinking` function, which returns `false` for
all models except the ones coming from Zed.
This PR implements `thinking_enabled` for other providers.
Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
Release Notes:
- N/A
Closes#47854
Move `disable_ai` from root settings to `ProjectSettingsContent` to
enable per-project AI configuration via `.zed/settings.json`.
- Update settings UI to allow viewing/editing at both user and project
level
- Update editor to check project-level settings for edit predictions and
context menus
- Prevent MCP servers from starting when AI is disabled at project level
Note: SaturatingBool ensures that if user globally disables AI, projects
cannot re-enable it. Projects can only further restrict AI, not grant
it.
Release Notes:
- added support for disabling AI in project settings
---------
Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
LSP servers may return symbol names containing newlines. Since outline
panel, breadcrumbs, and project search modal all expect single-line
items, collapse newlines before display.
- Document symbols: collapse newlines to spaces in name
- Workspace symbols: collapse newlines with `↵ ` separator for name and
container_name, preserving visual hint of original structure
Closes #ISSUE
Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
Release Notes:
- N/A
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Closes#46795
This PR aims to correctly detect the hyperlinks in cases like the
following, where box-drawing characters immediately precede the path
(without spaces in between).
```
╭─[Cargo.toml:55:1]
...
╰────
```
The only false negative with the fix in this PR would be that a file
path really contains leading box drawing characters which I think is
very unlikely.
---
Release Notes:
- Fixed an issue where the hyperlinks would not be properly detected in
the terminal if they were preceded by box-drawing characters (like ─, │,
┌, ┐)
Signed-off-by: Charlie-XIAO <yx2436@nyu.edu>
Closes#45135
Since neither the project search nor file finder search was showing
project's root name, including it in the history was unnecessary,
especially when the user had `project_panel.hide_root` set to `true`.
Release Notes:
- Made file finder to respect `project_panel.hide_root` settings
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
We had a call to `BlockMap::unfold_intersecting` that ended up
recomputing the entire block map for the RHS _without_ spacers, only to
throw it away in favor of the version with spacers a few lines down. Now
we only sync each block map once in `set_companion`.
Release Notes:
- Improved performance when toggling from the unified diff to the split
diff.
Co-authored-by: Jakub <jakub@zed.dev>
Co-authored-by: Cameron McLoughlin <cameron.studdstreet@gmail.com>
Fixes#28339
## What
- Normalize cwd-relative path-like targets that include leading `..`
before worktree lookup.
- Update issue #28339 tests to expect `WorktreeExact` for local and
remote resolution.
## Why
- Prevent terminal links like `../foo/bar.txt` from creating invalid
entries; resolve to the correct worktree file instead.
## How to test
- `cargo test -p terminal_view issue_28339 -- --nocapture`
- Manual: open a workspace, run `echo ../foo/bar.txt` from a subdir in
the terminal, then cmd/ctrl-click and confirm the correct file opens.
## Risk
- Low: only changes terminal path-like resolution for `..` paths;
expected to match normalized behavior.
## Checklist
- [x] Tests run (`cargo test -p terminal_view issue_28339 --
--nocapture`)
- [x] Docs updated (not needed)
- [x] Backwards compatibility considered
Release Notes:
- Fixed an issue where relative paths starting with `..` would not resolve correctly when clicking the link in the terminal
---------
Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
Follow-up to #21137
The manual install instructions in `linux.md` set `Exec=` to
`libexec/zed-editor` (main binary) instead of `bin/zed` (cli).
Using `zed-editor` directly throws "zed is already running" error and
files won't open from the file explorer. The "Open a new workspace"
right-click option on the desktop entry also doesn't work correctly.
Release Notes:
- N/A