Commit graph

37876 commits

Author SHA1 Message Date
Nathan Sobo
3b2c12a111
sidebar: Remove View More batched thread expansion (#53956)
Remove the `DEFAULT_THREADS_SHOWN` limit and the View More / Collapse
row from the sidebar thread list. When a project group is expanded, all
of its threads are now shown. Fold/unfold of project group headers is
preserved.

### Changes

- Remove `ListEntry::ViewMore` variant and `render_view_more`
- Remove `DEFAULT_THREADS_SHOWN`, `group_extra_batches`,
`set_group_visible_thread_count`, `expand/collapse_thread_group`
- Remove `visible_thread_count` from `ProjectGroupState`,
`SerializedProjectGroupState`, `ProjectGroup`, and persistence
- Remove `ShowMoreThreads` / `ShowFewerThreads` actions and vim
keybindings

cc @danilo-leal

Release Notes:

- N/A
2026-04-15 08:41:54 -06:00
Nick C
3f2baed6a0
docs: Add Dexter language server to Elixir documentation (#53793)
### Docs update.

  - adding 'what is Dexter' one-liner
  - adding config examples

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [~] Unsafe blocks (if any) have justifying comments
- [~] 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
- [~] Performance impact has been considered and is acceptable

 Elixir LS update -
[PR](https://github.com/zed-extensions/elixir/pull/115) merged

Release Notes:
- N/A

---------

Co-authored-by: AltCode <altcode@vivaldi.net>
2026-04-15 13:55:32 +00:00
Kunall Banerjee
47059dc578
settings: Remove settings field from HTTP context_servers (#48003)
HTTP context servers don’t support the settings field, so remove it
during migration to avoid confusion. Other context server types are
unaffected.

Closes #44786.


https://github.com/user-attachments/assets/4cabf405-c9e7-4d6e-a43d-f642fc4771e0



Release Notes:

- Removed deprecated key from HTTP `context_servers`

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
2026-04-15 15:12:32 +02:00
Bennet Bo Fenner
bfc34a620b
sidebar: Refine archive view (#53975)
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

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Gaauwe Rombouts <mail@grombouts.nl>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-15 11:01:29 +00:00
Katie Geer
e69b112755
agent: Add telemetry for parallel agents (#52919)
Track new telemetry:


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

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-04-15 12:41:12 +02:00
Danilo Leal
ab93615716
sidebar: Fix removed projects not immediately disappearing from the UI (#53974)
Release Notes:

- N/A
2026-04-15 07:25:04 -03:00
Mikayla Maki
2ea5644a81
Simplify draft threads (#53940)
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: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-04-15 10:08:01 +00:00
Danilo Leal
e676365c04
agent_ui: Fix focus moving to buffer on worktree creation (#53972)
Follow-up to https://github.com/zed-industries/zed/pull/53941

Release Notes:

- N/A
2026-04-15 06:55:19 -03:00
Cameron Mcloughlin
f81a5ecabd
workspace: Native open dialog multi-select (#53963) 2026-04-15 10:18:10 +01:00
Cameron Mcloughlin
963329c7b0
sidebar: Propagate workspace trust when creating new worktrees (#53833)
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-04-15 10:16:45 +01:00
Toni Alatalo
ac02b1bf24
remote: Set current_dir for cargo zigbuild cross-compilation (#53951)
## Summary

- The cross-compile path for building `remote_server` via `cargo
zigbuild` was missing `.current_dir()`, causing it to inherit the
process cwd
- This fails with "cannot specify features for packages outside of
workspace" when Zed is launched from outside its source tree
- The native build path at the same location already sets
`.current_dir()` correctly — this aligns the cross-compile path

Closes #53950

## Test plan

- [x] Build Zed from source
- [x] Launch from `/tmp`: `cd /tmp && /path/to/zed some-project
--dev-container`
- [x] Verify dev container cross-compilation succeeds

Release Notes:

- Fixed dev container cross-compilation failing when Zed is launched
from outside its source directory

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 09:07:53 +00:00
Kirill Bulatov
b928e595c2
Select and scroll to the best search match in settings (#53916)
When adding code lens to the long list of search items, I've failed to
find it when searching, as we always select first item in the matches
list, which is not necessarily the best one.

Left is before, right is after:


https://github.com/user-attachments/assets/9033dfd8-abde-4a45-a214-ae859105d6ad


Release Notes:

- Improved settings search ergonomics
2026-04-15 11:59:49 +03:00
Finn Evers
44305e61ca
compliance: Remove irrelevant case (#53936)
We will not be proceeding with this, thus removing it here to have less
variants.

Release Notes:

- N/A
2026-04-15 10:46:53 +02:00
Bennet Bo Fenner
dec1a2a3b8
gemini: Fix tool schema issues when type field is array (#53834)
Closes #53919

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:

- gemini: Fixed an issue with MCP servers specifying tools with specific
schemas
2026-04-15 10:11:44 +02:00
Eric Holk
bc84d80ea7
settings_ui: Gate CLI open behavior setting on feature flag (#53964)
The `cli_default_open_behavior` setting controls how `zed <path>` opens
directories, but the underlying behavior is gated behind the
`AgentV2FeatureFlag` in `open_listener.rs`. Without the flag enabled,
the setting has no effect — Zed always falls back to `NewWindow`
behavior.

This change gates the settings UI entry behind the same feature flag so
it only appears when the feature is actually active.

**Changes:**
- Converted `general_settings_section()` from a fixed-size array to a
`Vec` so the CLI setting can be conditionally appended
- Added `feature_flags` as a dependency to `settings_ui`

Release Notes:

- N/A
2026-04-15 01:10:36 -07:00
saberoueslati
1cd3249ca9
editor: Fix stale session path for renamed files (#52539)
## Context

When a file is renamed via the project panel while open in an editor,
Zed would restore the old (no longer existing) path on reload .

On rename, `language::Buffer` emits `BufferEvent::FileHandleChanged`,
which propagates to `multi_buffer::Event::FileHandleChanged` →
`EditorEvent::TitleChanged`. However, `should_serialize()` only matched
`Saved | DirtyChanged | BufferEdited`, so no re-serialization was
triggered and the `editors` DB table retained the stale `abs_path`.

The fix adds a dedicated `EditorEvent::FileHandleChanged` variant, emits
it alongside `TitleChanged` when the buffer's file handle changes, and
adds it to `should_serialize()`. Since `Editor::serialize()` already
reads the current path from the buffer at call time, this naturally
writes the new path to the DB.

Closes #51629

## How to Review

Three files edited:
- `editor.rs`: splits `FileHandleChanged` into its own arm and emits the
new event variant
- `items.rs`: adds `FileHandleChanged` to `should_serialize`
- `items.rs` (test): `test_file_handle_changed_on_rename` does a full
rename via `Project::rename_entry` and asserts the event fires and the
buffer path updates

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] 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 renamed files being reopened with their old path after a restart

**Important remark :**
This pull request is a follow-up on the review of @SomeoneToIgnore on
this pull request, https://github.com/zed-industries/zed/pull/51717,
which was inadvertently closed because I mistakenly deleted my previous
fork of the zed repo, sorry for any inconvenience caused by this

Manual test video below :

[Screencast from 2026-03-16
23-28-46.webm](https://github.com/user-attachments/assets/ff2e3259-ae26-4655-83b8-f693e84306d2)
2026-04-15 00:40:22 -07:00
saberoueslati
e613b2c9d3
tab_switcher: Keep tab switcher open when closing last tab in active pane (#53279)
## Context

Closes #53252

When using `ToggleAll` to open the tab switcher and then closing the
last tab in the currently active pane via `CloseSelectedItem`, the tab
switcher would unexpectedly dismiss. Closing tabs from an inactive pane
worked correctly.

**Root cause:** `force_remove_pane` in `Workspace` unconditionally calls
`window.focus(fallback_pane)` when the active pane is removed. This
focus change causes the tab switcher picker's editor to receive a
`Blurred` event, which
triggers `Picker::cancel` → `delegate.dismissed` → `DismissEvent`,
dismissing the modal.

**Fix:** When a modal is active, skip the `window.focus` call and
instead call `set_active_pane` directly. This keeps the active pane
pointer up to date without stealing focus from the modal.

Video of manual test after fix :

[Screencast from 2026-04-07
00-24-56.webm](https://github.com/user-attachments/assets/eeb74313-1713-48db-8421-db740ef7a7b2)

## How to Review

- `crates/workspace/src/workspace.rs` : In `force_remove_pane`, when the
removed pane was the active pane, the fallback pane now only receives
focus if no modal is currently open. Otherwise, `set_active_pane` is
called directly, which updates `active_pane`, `last_active_center_pane`,
and the status bar without touching window focus.

- `crates/tab_switcher/src/tab_switcher_tests.rs` : New test
`test_toggle_all_stays_open_after_closing_last_tab_in_active_pane`
reproduces the issue: two panes each with one file, the active pane's
tab is closed via `CloseSelectedItem`, and the test asserts the tab
switcher remains open with the other file still listed.

## Self-Review Checklist

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

Release Notes

- Fixed tab switcher dismissing when closing the last tab in the active
pane
2026-04-14 23:26:23 -07:00
Ben Kunkle
d3d8f1500d
ep: Send edit prediction mode in prediction request (#53812)
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 or Added/Fixed/Improved ...
2026-04-15 02:22:14 -04:00
MarekMalevic
1a6c2aeeef
Prefer Ollama configured model context length over model architecture context length (#53543)
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

Fixes calculation of Ollama model context length. Now prefers num_ctx
model configuration over model architecture context length the same way
Ollama does.

Closes #42340

Release Notes:

- Fix calculation of Ollama model context length
2026-04-15 02:21:56 -04:00
Richard Feldman
a30bc615e2
Delete worktree directory before git metadata cleanup during archive (#53959)
When archiving a thread's linked worktree, `git worktree remove` can
fail to delete the working directory while still removing the admin
metadata in `.git/worktrees/<name>`. This leaves an orphaned folder on
disk that no longer appears in `git worktree list`.

## Fix

Delete the directory ourselves first with `std::fs::remove_dir_all`,
then call `git worktree remove --force` to clean up only the admin
entry. Git already handles the case where the working tree is already
gone (since
[git/git@ee6763a](ee6763af0a)).

Also fixes `FakeGitRepository::remove_worktree` to handle a missing
working tree directory (matching real git behavior) by scanning
`.git/worktrees/` entries when the `.git` pointer file can't be read.

Release Notes:

- Fixed archiving an agent thread sometimes leaving the worktree folder
on disk even though the git worktree was removed.
2026-04-15 06:05:56 +00:00
Hamza Paracha
848c3da99e
docs: Fix stale MCP extension links (#53946)
This fixes #53740.

A few MCP docs links were still pointing at old extension slugs, so they
led to dead pages. This updates those links to the current canonical
slugs.

Release Notes:

- N/A
2026-04-14 22:37:50 -07:00
Eric Holk
ad5d015490
cli: Fix -n behavior and refactor open options (#53939)
This fixes a regression where `zed -n .` in a subdirectory of an
already-open
project would redirect to the parent window instead of creating a new
one.
The root cause was that commit 66d2cb20c9 ("Adjust `zed -n` behavior")
made
`-n` run the worktree matching loop with subdirectory matching enabled,
when
previously `-n` skipped matching entirely.

## Changes

### Bug fix
- **Restore `-n` to always create a new window.** No worktree matching,
no
exceptions. This matches the behavior from when `-n` was first
introduced.

### New `--classic` flag
- Adds a hidden `--classic` CLI flag that explicitly selects the
pre-sidebar
default behavior: new window for directories, reuse existing window for
  files already in an open worktree.
- The `cli_default_open_behavior` setting now toggles between `-e` (add
to
sidebar) and `--classic` behavior. When set to `new_window`, the classic
  logic is used instead of unconditionally opening a new window.

### Refactor CLI open options
Replaces the old grab-bag of `open_new_workspace: Option<bool>`,
`force_existing_window: bool`, `classic: bool`, and `reuse: bool` with:

- **`cli::CliOpenBehavior` enum** — a single enum on the IPC boundary
with
variants `Default`, `AlwaysNew`, `Add`, `ExistingWindow`, `Classic`, and
  `Reuse`.
- **`workspace::WorkspaceMatching` enum** — describes how to match paths
against existing worktrees (`None`, `MatchExact`, `MatchSubdirectory`).
- **`workspace::OpenOptions`** — uses `WorkspaceMatching` plus a simple
  `add_dirs_to_sidebar: bool` instead of overlapping boolean flags.

The translation from CLI enum to workspace options happens in
`open_listener.rs`, keeping both layers clean and independent.

Release Notes:

- N/A
2026-04-15 04:58:04 +00:00
Richard Feldman
dc5e2f1c24
sidebar: Show branch name after worktree name (#53900)
<img width="297" height="505" alt="Screenshot 2026-04-14 at 3 20 23 PM"
src="https://github.com/user-attachments/assets/90366ccd-86db-497e-9c81-af94b4144ebe"
/>


Display the git branch name alongside the worktree name in the sidebar's
thread list (or without the worktree name, if it's a main worktree).

Release Notes:

- Added branch name display next to worktree names in the agent sidebar
thread list.
2026-04-15 00:42:28 -04:00
Danilo Leal
6beecae6df
agent_ui: Improve the new thread worktree UX (#53941)
Closes https://github.com/zed-industries/zed/issues/53262

- Remove the ability to pick a branch from the agent panel; delegate
this to the title bar picker
- Make the worktree creation earger, just as you selected whether you
want to create it from main or current branch
- Remove flicker when creating a new worktree and switching to a
previously existing one
- Improve some UI stuff: how we display that a worktree is
creating/loading, the branch and worktree icons, etc.
- Fixed a bug where worktrees in a detached HEAD state wouldn't show up
in the worktree pickers

A big part of the diff of this PR is the removal of everything involved
with the `StartThreadIn` enum/the set up involved in only creating the
worktree by the time of the first prompt send.

Release Notes:

- Agent: Improved and simplified the UX of creating threads in Git
worktrees.
- Git: Fixed a bug where worktrees in a detached HEAD state wouldn't
show up in the worktree picker.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2026-04-15 03:47:19 +00:00
Richard Feldman
6467d4f9af
Improve error handling in worktree restore and archive paths (#53927)
Improves the worktree restore and archive code paths:

- In `restore_worktree_via_git`, the old code blindly attempted
`change_branch` and fell back to `create_branch` on failure, which could
clobber a branch that had moved to a different SHA during archival. Now
resolves the branch ref first and only checks out the branch if it still
points at the original commit; if the branch has moved, the worktree
stays in detached HEAD. If the branch doesn't exist, tries to recreate
it.
- In `change_worktree_paths` and `change_worktree_paths_by_main`,
archived threads are now excluded from path mutations so their folder
paths are preserved for restore.
- In the sidebar, `ProjectGroupKey` construction for archived thread
activation now uses `from_worktree_paths` (which resolves to main
worktree paths) instead of `new` with the linked worktree's folder
paths. This ensures that restoring a linked worktree thread matches the
main repo workspace rather than creating a spurious new one.
- Added `Repository::resolve_ref` for resolving a git ref to its SHA.
- Added tests for `resolve_ref`, branch-moved/not-moved/deleted restore
scenarios, and workspace-matching on restore.

Release Notes:

- N/A
2026-04-14 23:18:40 -04:00
Conrad Irwin
e8f097f8ee
Deprioritize Flathub (#53857)
Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] 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
- [ ] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Kunall Banerjee <hey@kimchiii.space>
2026-04-14 20:42:16 -06:00
Nathan Sobo
f49d9324db
sidebar: Simplify project group menu (#53933)
Remove the ability to add and remove individual folders from project
groups in the sidebar.

## Changes

**Sidebar project group menu:**
- When there are 2+ local project groups, the ellipsis menu shows "Open
Project in New Window" and "Remove Project" (no separators, no folder
listing)
- When there's only one group or it's remote, the ellipsis menu is
replaced with a close X button that removes the project directly

**Project picker labels:**
- "Open Local Project" → "Open Local Folders"
- "Open Remote Project" → "Open Remote Folder"
- "Add Local Project" → "Add Local Folders"
- "Add Remote Project" → "Add Remote Folder"

**Dead code removal:**
- `MultiWorkspace::remove_folder_from_project_group`
- `MultiWorkspace::prompt_to_add_folders_to_project_group`
- `MultiWorkspace::add_folders_to_project_group`
- `MultiWorkspace::update_project_group_key`
- `MultiWorkspaceEvent::ProjectGroupKeyUpdated`
- `Sidebar::move_threads_for_key_change`
- `ThreadMetadataStore::change_worktree_paths_by_main`
- Associated tests for removed functionality

Per-workspace thread regrouping (when a workspace's worktree paths
change) continues to work via the existing `WorktreePathsChanged` →
`move_thread_paths` flow. The existing
`test_worktree_add_only_regroups_threads_for_changed_workspace` test
(renamed and strengthened) verifies that only the changed workspace's
threads are regrouped, while sibling worktree threads remain in their
original group.

Release Notes:

- Improved sidebar project group menu to show a simple close button for
single-project windows and a streamlined two-item menu for multi-project
windows.
2026-04-14 20:12:11 -06:00
Finn Evers
5611cc282d
compliance: Fix casing of GitHub in structs and traits (#53935)
Release Notes:

- N/A
2026-04-15 01:56:27 +02:00
Ben Brandt
a750316275
acp: Initial support for ACP usage (#53894)
Adds initial beta test of ACP usage stats. Behind a flag for now while
we work on standardizing the usage values.

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-14 23:55:08 +02:00
Finn Evers
d367d3fbbc
compliance: Make trait more flexible (#53914)
This will make this easier to use with the GitHub worker.

Release Notes:

- N/A
2026-04-14 23:25:49 +02:00
Cole Miller
652f1fa3b0
git: Fix a race that caused incorrect hunk staging information (#53929)
In `GitStore::open_diff_internal`, when opening a `DiffKind::Unstaged`
diff, we previously always overwrote the `unstaged_diff` field of
`BufferGitState`. This causes a bug in the following situation:

- We call `open_unstaged_diff`, and it hits an await point where it is
loading the index text
- While that task is suspended, we call `open_uncommitted_diff`. It
reaches `open_diff_internal` and sets
`buffer_git_state.uncommitted_diff` and
`buffer_git_state.unstaged_diff`. It also sets the secondary diff for
the uncommitted diff to be the unstaged diff that it just opened.
- The `open_unstaged_diff` task wakes up and enters
`open_diff_internal`. It creates a new entity for the unstaged diff and
overwrites `buffer_git_state.unstaged_diff` with it, but it doesn't
update the secondary diff of the uncommitted diff, which still has the
entity that was produced in the previous step.
- Now the uncommitted diff's secondary diff will never receive updates
from the `GitStore`, causing staging information to be incorrect.

The fix is for `open_diff_internal` to not overwrite an existing
unstaged diff.

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 a bug that could cause diff hunks to have an incorrect staged
status.
2026-04-14 17:08:16 -04:00
Richard Feldman
5d15e010ae
Route open_thread through load_agent_thread to prevent duplicate sessions (#53859)
`AgentPanel::open_thread` (called when clicking `@thread` mention links,
pasting thread links, or opening threads via the CLI) was calling
`external_thread` directly, bypassing the de-duplication guards in
`load_agent_thread`. This meant clicking a thread link to the
currently-active thread would create a redundant `ConversationView`
sharing the same `NativeAgent` session. When the old CV was later
evicted from `background_threads`, its `on_release` called
`close_all_sessions`, removing the session and breaking the surviving CV
with "Session not found".

Fix this by routing `open_thread` through `load_agent_thread`, which
checks the active view, retained threads, and background threads before
creating a new `ConversationView`. This prevents the duplicate from
being created in the first place.

Release Notes:

- Fixed a "Session not found" error that could occur after clicking a
thread mention link.
2026-04-14 15:05:57 -04:00
Richard Feldman
bf0fcfbbac
Preserve archived thread project paths after worktree removal (#53893)
When a thread created in a git worktree is archived, the archive flow
removes the linked worktree from the project. If a subsequent thread
event fires after this (e.g. an async title-generation task completing),
`handle_thread_event` recalculates `worktree_paths` from the project's
current state — which no longer includes the removed worktree — and
overwrites the archived thread's stored paths with empty ones.

This causes restoring the thread to prompt the user to re-associate a
project, instead of restoring it directly.

**Fix:** return early from `handle_thread_event` when the thread is
already archived, so the stored paths are never overwritten.

Release Notes:

- Fixed archived threads in git worktrees losing their project
association.
2026-04-14 15:05:34 -04:00
Mikayla Maki
e8c6f29f44
Defer sidebar sync (#53925)
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-14 18:56:29 +00:00
Anthony Eid
0bbe9bff86
sidebar: Filter thread groups by remote host identity (#53918)
### Summary 

Follow up on: https://github.com/zed-industries/zed/pull/53550

Threads in the sidebar are now filtered by remote connection in addition
to path list. Previously, two different machines with the same absolute
project paths (e.g. both at `/home/user/project`) would have their
threads merged into a single sidebar group. Now each remote host gets
its own group.

To support this, this PR introduces `RemoteConnectionIdentity`, a
normalized subset of `RemoteConnectionOptions` that includes only the
fields relevant for identity matching (e.g. SSH host + username + port,
but not nickname or connection timeout). All remote host comparisons in
the sidebar, thread metadata store, and workspace persistence now go
through `same_remote_connection_identity()` instead of raw `==` on
`RemoteConnectionOptions`.

#### Follow Up on remoting for sidebar

1. Make the neighbor in archive thread fallback to the main git worktree
instead of the next thread
2. Start implementing remote git operations that archive feature depends
on
3. Make remote connection pool equality use `RemoteConnectionIdentity`

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: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
2026-04-14 18:40:36 +00:00
Eric Holk
bb59cac88e
cli: Hide -r/--reuse from --help in favor of -e/--existing (#53924)
Soft-deprecates the `-r`/`--reuse` CLI flag by hiding it from `--help`
output. The flag remains fully functional for backward compatibility,
but new users will discover `-e`/`--existing` instead.

The change is a single `hide = true` addition to the clap arg attribute.

Release Notes:

- N/A
2026-04-14 18:18:09 +00:00
Oleksiy Syvokon
edac6a7b7a
Move edit prediction metrics into shared crate (#53912)
Release Notes:

- N/A

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-04-14 21:04:10 +03:00
Nathan Sobo
a33a1eb904
agent_ui: Reuse visible sessions when reopening threads (#53905)
When reopening a thread that is already visible in the agent panel,
`open_thread` could recreate the session instead of reusing the existing
visible thread. That left the UI holding a thread whose backend session
could be closed out from under it.

This change routes `AgentPanel::open_thread` through
`load_agent_thread`, which already handles the right behavior for
existing sessions:
- reuse the active thread when it already matches
- promote a retained thread when it matches
- only load when the session is not already present

The regression coverage is now a focused behavioral test at the
`AgentPanel::open_thread` boundary that verifies reopening an
already-visible session keeps the thread usable.

cc @bennetbo

Release Notes:

- Fixed reopening an already-visible agent thread so it reuses the
existing session instead of creating a broken duplicate.
2026-04-14 17:26:44 +00:00
Danilo Leal
1bc0e233bb
sidebar: Add adjustments to project header (#53891)
- Change design a bit so that the separation between projects is clearer
- Add ability to cmd-click to focus most recent workspace
- Make hover and collapse/expand interactions unconditional, enabled by
adding a "No threads yet" empty state
- Improved keyboard nav by making cmd-n create a new thread in the
currently focused group


https://github.com/user-attachments/assets/e9cde153-d3f1-4945-9e45-db1597637a44

Release Notes:

- Agent: Improved the threads sidebar header by making the separation
between projects more distinct.
2026-04-14 14:05:25 -03:00
Eric Holk
11edacfd0f
cli: Defer app activation until after open-behavior prompt (#53915)
On macOS, the CLI uses `LSOpenFromURLSpec` to deliver the `zed-cli://`
URL to the running Zed app. With `kLSLaunchDefaults`, Launch Services
activates (brings to foreground) the Zed app as a side effect of URL
delivery. This happens before the IPC handshake completes and before the
user can answer the terminal prompt asking whether to open in a new
window or existing workspace, forcing them to manually switch back to
the terminal.

## Fix

**CLI side** (`crates/cli/src/main.rs`): Add `kLSLaunchDontSwitch` to
the launch flags so macOS delivers the URL without activating the app.

**App side** (`crates/zed/src/zed/open_listener.rs`): Add
`cx.activate(true)` in `handle_cli_connection` after the prompt resolves
(or immediately for the URL-only path), so the app comes to the
foreground at the right time.

Linux and Windows are unaffected — they use Unix sockets and named pipes
respectively, which don't have activation side effects.

Release Notes:

- Fixed the Zed CLI activating the app window before the user answers
the open-behavior prompt in the terminal.
2026-04-14 16:56:03 +00:00
Danilo Leal
c8b3da6ed9
recent_projects: Fix clipping branch and project name (#53906)
Just fixing an issue where the project and branch labels weren't
truncating in the project popover.

<img width="600" height="1054" alt="Screenshot 2026-04-14 at 11  49@2x"
src="https://github.com/user-attachments/assets/eefa5027-34cd-41da-9590-cb12a89cdb51"
/>

Release Notes:

- N/A
2026-04-14 13:44:05 -03:00
Anthony Eid
eed33ab283
sidebar: Fallback to main git worktree path when opening thread in deleted git worktree (#53899)
### Summary

This PR is the first step in improving Zed's error handling when a user
opens an old thread that's associated with a deleted git worktree.
Before, the thread would open in an empty project with a broken state.
This PR instead opens the thread in the workspace associated with the
thread’s main git worktree when available.

### Follow ups

1. Implement remote support for this fallback 
2. Update `ThreadMetadataStore` database to set paths from deleted
worktree to the main worktree
3. If the main git worktree is deleted as well, fallback to the
currently active workspace

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-14 09:17:29 -07:00
Richard Feldman
101083e7f9
gpui_tokio: Use shutdown_background to avoid WASI panic on exit (#53904)
When the Tokio runtime is dropped during Zed shutdown, it drives all
spawned tasks to cancellation by polling them one last time. The
`wasmtime-wasi` crate wraps child task `JoinHandle`s in an
`AbortOnDropJoinHandle` whose `Future::poll` calls `.expect("child task
panicked")` on the join result — but Tokio can also return
`JoinError::Cancelled` (not just panics), causing the expect to panic
with:

```
child task panicked: JoinError::Cancelled(Id(45))
```

This showed up as Sentry issue ZED-69A (106 events, 85 users, 100%
Windows, stable channel).

The fix is to explicitly call `shutdown_background()` on the owned Tokio
runtime during `GlobalTokio::drop`, which immediately drops all spawned
tasks without polling them again, avoiding the wasmtime-wasi panic path
entirely.

Release Notes:

- Fixed a crash on exit caused by the Tokio runtime shutdown triggering
a panic in extension WASI tasks (Windows).
2026-04-14 18:14:31 +02:00
Cameron Mcloughlin
da6ac6c551
workspace: Add separate "format and save" action (#53710)
Release Notes:

- Added `workspace: format and save` action which always formats,
regardless of settings
2026-04-14 16:20:05 +01:00
Marshall Bowers
01fb4765a5
client: Don't override organization plans with personal plan (#53842)
This PR makes it so we don't override organization plans with the user's
personal plan.

If an organization is selected and does not have a plan, we want to
return `None` for the plan.

Closes CLO-655.

Release Notes:

- N/A
2026-04-14 10:55:03 -04:00
kitt
24a304c140
Set window icon on X11 (#40096)
Closes #30644

Many X11 environments expect a window icon to be supplied [as pixel data
on a window property
`_NET_WM_ICON`](https://specifications.freedesktop.org/wm-spec/1.4/ar01s05.html#id-1.6.13).

I confirmed this change fixes the icon in xfce4 for me, I think its
likely it also fixes https://github.com/zed-industries/zed/issues/37961
but I haven't tested it.

## Questions
* [`image::RgbaImage` is exposed to the public API of
gpui](https://github.com/zed-industries/zed/pull/40096/files#diff-318f166d72ad9476bd0a116446f5db3897fc1a4eb1d49aaf8105608bcf49ea53R1136).
I would guess this is undesirable, but I wasn't sure of the best way to
use gpui's native `Image` type..
* Currently [the icon is embedded into the
binary](https://github.com/zed-industries/zed/pull/40096/files#diff-89af0b4072205c53b518aa977d6be48997e1a51fa4dbf06c7ddd1fec99fc510eR101).
If this is undesirable, zed could alternatively implement [icon
lookup](https://specifications.freedesktop.org/icon-theme-spec/latest/#icon_lookup)
and try and find its icon from the system at runtime.

## Future work
* It might be nice to expose a `set_window_icon` method also (it could
be used for example to show dirty state in the icon somehow), but I'm
unfamiliar with what other platforms support and if this could be beyond
X11 (there is a [wayland
protocol](https://wayland.app/protocols/xdg-toplevel-icon-v1) though!).

Release Notes:

- Fixed missing window icon on X11

---------

Co-authored-by: Yara <git@yara.blue>
2026-04-14 16:21:28 +02:00
Marshall Bowers
5c7325ad9a
title_bar: Don't show a badge for organizations without a plan (#53841)
This PR makes it so we don't show a plan badge for organizations that
don't have a plan.

Closes CLO-654.

Release Notes:

- N/A
2026-04-14 09:27:06 -04:00
Cameron Mcloughlin
a49739e2df
sidebar: Consistent thread display time (#53887)
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-04-14 14:26:35 +01:00
Cameron Mcloughlin
c49973d705
sidebar: Always focus agent when selecting thread (#53892) 2026-04-14 14:07:05 +01:00
Ben Brandt
07e9a2d25a
acp: Use npm --prefix for registry npx agents (#53560)
Because we weren't going through the normal npm subcommand route, we
weren't getting a prefix flag applied. Which meant some users were
seeing errors of incorrect package managers when used with a JS project.

We still want the agent to run in the project dir if we can, we just
don't want it resolving packages from that project. (This actually means
I can run it in our claude-agent-acp repo again :D )

I refactored the node_runtime functions a bit to make these subcommand
functions a bit more inline wiht each other and actually fixed an issue
where --prefix might have been added after `--` previously which
wouldn't be correct anyway.

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:

- acp: Fix npm-based agents resolving based on current project.
2026-04-14 11:10:31 +00:00