Commit graph

37876 commits

Author SHA1 Message Date
Bennet Bo Fenner
0a0da3f31e
agent_ui: Only allow editing when agent supports truncation (#53886)
Follow up to #53850. #53850 fixed the panic, but had the side effect
that we would allow editing messages in the UI, even if the agent did
not support it.

Related #53735

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 10:49:16 +00:00
Bennet Bo Fenner
7240593335
agent_ui: Do not show notifications when sidebar is open (#53883)
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: Gaauwe Rombouts <mail@grombouts.nl>
2026-04-14 12:44:17 +02:00
saberoueslati
5688167d22
recent_projects: Fix worktree path resolving to bare repo in recent projects modal (#52996)
## Context

When using a bare-repo-based git worktree layout (e.g. `foo/.bare` as
the bare repository and `foo/my-feature` as a linked worktree), the
"recent projects" modal was showing `foo/.bare` instead of
`foo/my-feature`.

The root cause was in `original_repo_path_from_common_dir` — when
resolving a linked worktree back to its "main" repo, the function reads
the `commondir` file which, for bare repos, points to the bare directory
itself (e.g. `foo/.bare`). Since that path doesn't end in `.git`, the
old code fell back to returning it as-is. This bare repo path was then
substituted into the workspace's stored paths, causing the modal to show
the bare directory instead of the actual worktree the user had opened.

The fix makes `original_repo_path_from_common_dir` return
`Option<PathBuf>`, returning `None` when `common_dir` doesn't end with
`.git`. `resolve_git_worktree_to_main_repo` propagates this `None`,
meaning the original worktree path is preserved in recent projects
rather than being replaced with the bare repo path.

Closes #52931

Video of the manual test after the fix is below :

[Screencast from 2026-04-02
16-05-48.webm](https://github.com/user-attachments/assets/9659c7a7-c095-4c23-af59-17715f84ce3e)

## How to Review

- **`crates/git/src/repository.rs`** :
`original_repo_path_from_common_dir` changed to return
`Option<PathBuf>`. Returns `None` for bare repos (no `.git` suffix). The
existing `original_repo_path` call site falls back to `work_directory`
when `None` is returned, preserving its prior behaviour. Unit test
expectations updated accordingly, with the bare-repo case now asserting
`None`.

- **`crates/project/src/git_store.rs`** :
`resolve_git_worktree_to_main_repo` now simply forwards the
`Option<PathBuf>` returned by `original_repo_path_from_common_dir`
directly, propagating `None` for bare repos so the caller keeps the
original worktree path.

- **`crates/workspace/src/persistence.rs`** : New test
`test_resolve_worktree_workspaces_bare_repo` exercises the exact
scenario from the issue: a workspace entry pointing to a linked worktree
whose `commondir` resolves to a bare repo. Asserts the path is left
unchanged.

## 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 recent projects modal showing `.bare` folder instead of the
worktree directory for bare-repo-based git worktree setups
2026-04-14 12:27:37 +03:00
Enoch
8420716bd4
anthropic: Preserve custom model thinking mode after thinking-toggle refactor (#52975)
PR #51946 broke `Model::Custom` thinking behavior: `mode()`,
`supports_thinking()`, and `supports_adaptive_thinking()` all inferred
capabilities from hardcoded built-in model lists, so any `Custom`
variant always fell back to `Default` regardless of its configured
`mode` field.

### Fixes

- **`Model::mode()`** — `Custom` now short-circuits to `mode.clone()`
before the built-in inference logic
- **`Model::supports_thinking()`** — `Custom` returns `true` when `mode`
is `Thinking { .. }` or `AdaptiveThinking`
- **`Model::supports_adaptive_thinking()`** — `Custom` returns `true`
when `mode` is `AdaptiveThinking`

Built-in model behavior is unchanged.

### Tests

Three regression tests added covering the three `Custom` mode cases:
explicit `Thinking`, `AdaptiveThinking`, and `Default` (which must
disable both flags).

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 custom Anthropic models losing their configured
thinking/adaptive-thinking mode after the thinking-toggle refactor
(#51946)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-14 12:06:17 +03:00
Finn Evers
7443615c7e
Remove handoff markdown file (#53878)
Release Notes:

- N/A
2026-04-14 09:02:21 +00:00
saberoueslati
1ac669d108
editor: Fix selection occurrence highlights during regex buffer search (#52611)
## Context

When using regex buffer search (e.g. `^something`), Zed correctly
navigates only to actual matches. However, navigating to a match selects
the matched text, which triggers the **selection occurrence highlight**
feature. That feature performs a *plain literal* search for the selected
word and highlights all occurrences, including ones that don't satisfy
the regex. The user would see a 4th mid-line occurrence highlighted,
even though `^something` never matched it, this behavior is quite
confusing.

The fix tracks whether the current selection was set by search
navigation via a new `from_search: bool` on `SelectionEffects`. When
`last_selection_from_search` is set and `BufferSearchHighlights` are
active, selection occurrence highlights are suppressed. Making a manual
text selection during an active search clears the flag, restoring normal
occurrence-highlight behavior.

The behavior now matches how VSCode handles this case.

The video below demonstrates the behavior after the fix and shows that
it matches the VSCode behavior now

[Screencast from 2026-03-28
01-33-46.webm](https://github.com/user-attachments/assets/07a005b8-53b1-4abf-93d2-96406f0b6a11)

Closes #52589

## How to Review

Three files changed — read in this order:

1. **`crates/editor/src/editor.rs`** Adds `from_search: bool` to
`SelectionEffects` (with a builder method) and
`last_selection_from_search: bool` to `Editor`.
`selections_did_change()` records the flag from effects.
`prepare_highlight_query_from_selection()` returns `None` early when
both `last_selection_from_search` and active `BufferSearchHighlights`
are set.

2. **`crates/editor/src/items.rs`** `activate_match()` now calls
`.from_search(true)` on its `SelectionEffects` so search-driven
selections are marked at the source.

3. **`crates/search/src/buffer_search.rs`** Regression test
`test_regex_search_does_not_highlight_non_matching_occurrences`:
verifies that after search navigation, `SelectedTextHighlight` is
suppressed and exactly 3 `BufferSearchHighlights` exist; and that after
a manual selection, `SelectedTextHighlight` is restored.

## 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 regex buffer search highlighting non-matching word occurrences
via the selection occurrence highlight feature
2026-04-13 23:25:28 -07:00
renovate[bot]
bf185f7402
Update Rust crate rand to v0.9.3 [SECURITY] (#53855)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [rand](https://rust-random.github.io/book)
([source](https://redirect.github.com/rust-random/rand)) |
workspace.dependencies | patch | `0.9.2` → `0.9.3` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the [Dependency
Dashboard](../issues/15138) for more information.

### GitHub Vulnerability Alerts

####
[GHSA-cq8v-f236-94qc](https://redirect.github.com/rust-random/rand/pull/1763)

It has been reported (by @&#8203;lopopolo) that the `rand` library is
[unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library)
(i.e. that safe code using the public API can cause Undefined Behaviour)
when all the following conditions are met:

- The `log` and `thread_rng` features are enabled
- A [custom
logger](https://docs.rs/log/latest/log/#implementing-a-logger) is
defined
- The custom logger accesses `rand::rng()` (previously
`rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`)
methods on `ThreadRng`
- The `ThreadRng` (attempts to) reseed while called from the custom
logger (this happens every 64 kB of generated data)
- Trace-level logging is enabled or warn-level logging is enabled and
the random source (the `getrandom` crate) is unable to provide a new
seed

`TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe`
code to cast `*mut BlockRng<ReseedingCore>` to `&mut
BlockRng<ReseedingCore>`. When all the above conditions are met this
results in an aliased mutable reference, violating the Stacked Borrows
rules. Miri is able to detect this violation in sample code. Since
construction of [aliased mutable references is Undefined
Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html),
the behaviour of optimized builds is hard to predict.

Affected versions of `rand` are `>= 0.7, < 0.9.3` and `0.10.0`.

---

### Release Notes

<details>
<summary>rust-random/rand (rand)</summary>

###
[`v0.9.3`](https://redirect.github.com/rust-random/rand/compare/0.9.2...0.9.3)

[Compare
Source](https://redirect.github.com/rust-random/rand/compare/0.9.2...0.9.3)

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - ""
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMTAuMiIsInVwZGF0ZWRJblZlciI6IjQzLjExMC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-14 05:31:47 +00:00
Nathan Sobo
6d2944b001
Stop automatically deleting agent drafts (#53862)
This was leftover from trying to hold the invariant of one empty draft,
which was dropped in #53852.

Removes all automatic draft deletion:

- `retain_running_thread` discarded empty drafts when navigating away
- `remove_empty_draft` cleaned up all retained drafts when loading from
history
- `open_external_thread_with_server` removed empty drafts when opening
external threads

Release Notes:

- Fixed agent drafts being silently discarded when navigating between
threads
2026-04-14 05:15:53 +00:00
Nathan Sobo
fb9415eca5
sidebar: Click project header row to toggle fold instead of switching worktrees (#53861)
Previously, clicking a project header in the agent sidebar would
activate/switch to that worktree's workspace, resuming whatever thread
was most recently active. This felt jarring — activating a random thread
based on recency isn't that useful when the user can just click the
specific thread they want. There's also no clear semantic for clicking
the overall group header since each thread maps to a specific workspace
and there's no single workspace to activate for the group.

This changes the click target for folding from just the chevron to the
entire header row. The worktree-switching behavior is removed — clicking
anywhere on the row now toggles the fold, which is a more predictable
and useful interaction.

The hover-only buttons on the right side (ellipsis menu, collapse
threads, new thread) continue to work as before, with their own click
handlers that stop propagation.

Release Notes:

- Improved sidebar project headers to toggle fold on click instead of
switching worktrees.
2026-04-13 23:07:07 -06:00
Eric Holk
acf5da9172
Guard CLI first-run prompt with agents-v2 flag (#53839)
Gates the CLI first-run prompt (from #53663) on the `agent-v2` feature
flag, giving us an escape hatch if something goes wrong.

## What this does

**Commit 1: Gate on agent-v2 flag**
- Adds an `AgentV2FeatureFlag` check at the top of the open behavior
resolution. When the flag is off, the prompt is skipped.
- Refactors `maybe_prompt_open_behavior` → `resolve_open_behavior`:
moves the explicit-flags guard (`-n`, `-e`, `--reuse`) to the caller and
drops three parameters from the function signature, since the function
was only inspecting those values to decide whether to bail early.

**Commit 2: Default to new-window when flag is disabled**
- When the flag is off, falls back to the pre-#53254 behavior of opening
projects in a new window, rather than silently adding to the sidebar.

Release Notes:

- N/A
2026-04-14 02:42:33 +00:00
Nathan Sobo
b310904bd9
Allow empty project groups in sidebar (#53852)
Previously, the sidebar would automatically create an empty draft thread
for any project group that had no threads (via `reconcile_groups`). This
added complexity and felt janky — the user would see a phantom "Draft"
entry appear for every workspace they opened, even before they intended
to start a conversation.

Now, project groups can simply be empty. When a group has no threads:

- The fold indicator renders as closed and grayed out (disabled — no
click handler or tooltip)
- The plus button is always visible on the right side of the header (not
hidden behind hover)
- Keyboard fold toggling is disabled for the group
- Clicking the plus button creates the first thread and expands the
group

Draft threads are no longer auto-created anywhere:

- `AgentPanel::load` no longer creates a draft when there is no
previously active conversation
- Archiving the last thread in a group clears the panel instead of
creating a replacement draft
- `show_or_create_empty_draft` and `clear_active_thread` are removed

This removes a significant amount of supporting infrastructure that only
existed to maintain the "no group may be empty" invariant:

- `WorkspaceSidebarDelegate` trait and `AgentPanelSidebarDelegate`
struct
- `reconcile_groups` method and its 12 call sites
- `clear_empty_group_drafts` method and its 3 call sites
- `show_or_create_empty_draft` and `clear_active_thread` methods
- `reconciling` field on `Sidebar`
- `sidebar_delegate` field, setter, and getter on `Workspace`

Release Notes:

- Improved the sidebar to show empty project groups with a visible plus
button instead of auto-creating placeholder draft threads.

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-04-13 19:31:34 -06:00
Richard Feldman
66ac781e65
Start new git worktrees in detached HEAD state (#53840)
Create worktrees in detached HEAD state, then attempt to check out the
requested branch. If the checkout fails (e.g. the branch is already in
use by another worktree), log a warning and stay in detached HEAD state
instead of showing an error to the user.

This simplifies the worktree creation flow by:
- Removing the occupied-branch fallback logic that would generate random
branch names
- Always using `CreateWorktreeTarget::Detached` for worktree creation
- Attempting branch checkout as a best-effort post-creation step
- Updating the branch picker UI to reflect the new behavior

Release Notes:

- Threads now start git worktrees in detached HEAD state if branch is in
use or unspecified, instead of generating a random branch name.

---------

Co-authored-by: Eric Holk <eric@zed.dev>
2026-04-14 00:35:28 +00:00
Eric Holk
549db9fbb3
acp_thread: Make UserMessageId required in AgentConnection::prompt (#53850)
The `user_message_id` parameter on `AgentConnection::prompt` was
`Option<UserMessageId>`, but `NativeAgentConnection::prompt` immediately
called `.expect()` on it, crashing when the value was `None`.

Because the `expect` message said `UserMessageId` was required, this PR
makes the parameter not optional which makes the panic impossible.

This means we also need to unconditionally generate an ID in `send`,
where before we gated this on whether `truncate` returned `Some`.
Generating IDs unconditionally should be find, especially because the
prompt requires them.

Release Notes:

- N/A
2026-04-13 16:59:17 -07:00
Anthony Eid
2065099bc8
agent: Block agent v2 feature on stable release channel (#53849)
Based on a partial revert of: 7bcdb12b4c

The main difference is instead of a feature flag we now check
`ReleaseChannel::Stable` != current_release_channel when the UI checks
if agent v2 (sidebar) features should be enabled.

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 or Added/Fixed/Improved ...

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-04-13 16:50:13 -07:00
Max Brunsfeld
092fedc42c
Fix the opening of the agent panel when clicking Try Now in new onboarding notification (#53845)
This fixes an issue reported by @Veykril where the "Try Now" button
would open a different panel than the agent panel. The bug was caused by
us attempting to focus the agent panel before layout settings updates
had been applied.

This should also make all programmatic settings updates more responsive,
because they won't have to wait for FS watchers to take effect.

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2026-04-13 22:51:38 +00:00
Finn Evers
909dfd0a5c
compliance: Expose some more methods (#53831)
They will again come in handy for the GitHub worker.

Release Notes:

- N/A
2026-04-14 00:22:16 +02:00
Richard Feldman
15dce9de1c
Always remove linked worktree workspaces before archive cleanup (#53672)
When archiving a thread's last reference to a linked worktree, the
worktree workspace must be removed from the MultiWorkspace before the
background cleanup task runs `git worktree remove`. Previously, only the
workspace found via exact PathList match on the thread's `folder_paths`
was removed. This missed cases where the workspace's root paths diverged
from the thread's `folder_paths` (e.g. after folders were added/removed
from the workspace).

Now we also scan `roots_to_archive` for any linked worktree workspaces
that contain the worktree being archived and include them in the removal
set. This ensures all editors are dropped, releasing their
`Entity<Worktree>` references (held through `File` structs in buffers),
so `wait_for_worktree_release` completes and `git worktree remove` can
proceed.

Release Notes:

- Fixed some linked worktree directories not always being cleaned up
from disk when archiving a thread.
2026-04-13 14:02:32 -07:00
Dino
25e02cb0b0
project_panel: Always open panel on pane's reveal in project panel (#53539)
Update the way `pane::RevealInProjectPanel` is handled to ensure that,
regardless of whether the file belongs to any open project, the project
panel is always activated and focused.

This refactor is a result of some internal feedback after changing its
handling so as to show a notification stating that the item that the
user was trying to reveal didn't belong to an open project
– https://github.com/zed-industries/zed/pull/51246 .

We feel users are probably already used to relying on `cmd-shift-e` (on
macOS), in pretty much every context, in order to open the project
panel, and so having situations where it doesn't actually happen seems
like a bad user experience.

Relates to #23967 

Release Notes:

- Improved `pane: reveal in project panel` to open the project panel,
even if working with an unsaved buffer.
2026-04-13 21:47:33 +01:00
Richard Feldman
5f2373b7b1
Skip git worktree removal when archiving threads on main worktrees (#53629)
When archiving a thread that lives on a main worktree (not a linked
worktree), `build_root_plan` was still returning a `RootPlan`, which
caused the archive flow to call `git worktree remove` on the main
working tree. Git rightfully refuses this with:

```
fatal: '/Users/rtfeldman/code/zed' is a main working tree
```

This fix makes `build_root_plan` return `None` for non-linked worktrees,
so the archive-to-disk machinery is simply skipped. The thread is marked
archived in the metadata store and can be unarchived later — no git
operations needed.

Since `build_root_plan` now guarantees a linked worktree when it returns
`Some`, `RootPlan::worktree_repo` is tightened from
`Option<Entity<Repository>>` to `Entity<Repository>`, removing the
fallback codepath and the `is_some()` guard in `archive_worktree_roots`.

Release Notes:

- Fixed a crash when archiving an agent thread that was opened on the
main project (not a linked git worktree).
2026-04-13 20:34:36 +00:00
Richard Feldman
1150c9d664
Fix crash when fallback workspace is in the removal set (#53549)
When removing a project group, the fallback closure calls
`find_or_create_local_workspace` which searches `self.workspaces` for an
existing match. Because the workspaces to be removed haven't been
removed yet at that point, `workspace_for_paths` can return a doomed
workspace, hitting the `assert!` in `MultiWorkspace::remove` and
crashing the app.

Fix by adding an `excluding` parameter to
`find_or_create_local_workspace` so callers inside removal fallbacks can
skip workspaces that are about to be removed. Both
`remove_project_group` and `sidebar::archive_thread` now pass the
appropriate exclusion set.

Adds a regression test that deterministically reproduces the crash (the
assert fires without the exclusion, passes with it).

Release Notes:

- Fixed a crash when closing a project group whose fallback workspace
matched one being removed.
2026-04-13 16:30:38 -04:00
Richard Feldman
1c1f2d6f4c
agent_ui: Fix worktree naming regression when using existing branches (#53669)
When creating a new git worktree from an existing branch (e.g. `main`),
the worktree directory was incorrectly named after the branch instead of
getting a random adjective-noun name. Additionally, if a directory with
that name already existed, the rollback logic could destructively delete
the pre-existing worktree.

Changes:
- Generate a random adjective-noun name for worktree directories when no
explicit name is provided
- Collect existing worktree directory names to avoid collisions
- Check generated paths against known worktree paths before creating
- Reduce random name retry count from 100 to 10
- Add regression test

Release Notes:

- Fixed a regression where creating a git worktree from an existing
branch would name the worktree directory after the branch (instead of
generating a random name)
2026-04-13 16:12:36 -04:00
Kirill Bulatov
d0c8109536
Add more harness to the CI scripts (#53816)
Fixes 
<img width="1238" height="520" alt="image"
src="https://github.com/user-attachments/assets/5e6c0d93-660f-4d1a-ab8c-c9c269292eaa"
/>


If a parent script with `-euo pipefail` invokes a script, that does not
inherit the `-euo pipefail` option. Fix that by adding the flags to the
scripts needed and adjust the curl command to fail too.

Release Notes:

- N/A
2026-04-13 22:28:20 +03:00
Marshall Bowers
850c94c683
title_bar: Hide plan badge next to username when there are organizations (#53826)
This PR makes it so we hide the plan badge next to the username in the
user menu when there are organizations.

We instead show the plans next to each organization:

<img width="257" height="317" alt="Screenshot 2026-04-13 at 1 29 26 PM"
src="https://github.com/user-attachments/assets/0111e7ff-af09-48ba-a043-9e25c2dd24bd"
/>

Closes CLO-649.

Release Notes:

- N/A
2026-04-13 13:39:22 -04:00
Bennet Bo Fenner
cf69756ddb
agent_ui: Fix empty agent panel state after startup (#53823)
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-13 19:34:17 +02:00
Tom Houlé
4d025b45c1
edit_prediction_ui: Enforce org configuration to disable Zed provider (#53655)
The Zed provider is now disabled in the selection dropdown when the
current organization has disabled edit predictions. It is also
unselected when you switch organizations to one such organization.

This is also already enforced server side.

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: Marshall Bowers <git@maxdeviant.com>
2026-04-13 13:30:48 -04:00
Finn Evers
2e8dac64cd
compliance: Deserialize GraphQL responses better (#53817)
This will help a lot when dealing with this in the context of the Zed
Zippy bot.

Release Notes:

- N/A
2026-04-13 19:25:30 +02:00
Jonas
b1f8bd6c2b
Add automatic syntax highlighting for TopoJSON files (#53546)
TopoJSON is an extension of the geospatial data interchange format,
GeoJSON. Although it is not as widely popular, it is frequently used in
web maps, where its smaller file size is advantageous.

More information about TopoJSON can be found here:
https://github.com/topojson/topojson-specification

This change adds `topojson` as a recognised path suffix, so TopoJSON
files automatically open as JSON and get the standard JSON syntax
highlighting.

This PR is similar to @flother’s PR for GeoJSON:
https://github.com/zed-industries/zed/pull/49261

Closes (my own) discussion:
https://github.com/zed-industries/zed/discussions/32963

PS: This is my first PR. I'd appreciate any feedback or suggestions for
improvement

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

Release notes:

- Added automatic syntax highlighting for TopoJSON files
2026-04-13 17:23:37 +00:00
Cole Miller
9264f7f883
git: Add missing language_changed notification for branch diffs (#53757)
We need to reparse the base text using the same language as the main
buffer, whenever the main buffer's language changed. We already do this
for the uncommitted diff, but it was missing for the branch (OID-based)
diffs. (We don't need it for the unstaged diff because we don't
currently show you that base text anywhere in the UI, so its language is
immaterial.)

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-04-13 13:09:56 -04:00
Cameron Mcloughlin
9adff860f7
sidebar: Move to new window, going through sqlite (#53513)
Re-adds the `multi_workspace::MoveProjectToNewWindow` action

It serializes, then closes, then re-opens the project to avoid issues
with pending tasks

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-13 10:02:14 -07:00
Anthony Eid
bd78089e36
git: Use repo snapshot to fetch picker branch list instead of spawning a job (#53661)
This should fix a delay where the thread_branch_picker and git_picker
would take a while to load the branch list while other git jobs are
being processed before hand.

I also added a subscription in both pickers to repository so they
refresh their matches when the repo snapshot branch list changes.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content 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-13 12:39:13 -04:00
Kirill Bulatov
0272aab3d6
Do not open the sidebar when opening a directory in a new window (#53815)
Follow-up to https://github.com/zed-industries/zed/pull/53778

Covers another case when opening a directory via the file picker _from a
blank project_

<img width="865" height="539" alt="image"
src="https://github.com/user-attachments/assets/43eb035b-4f0f-4e8c-bfa3-fbcd7b4beb13"
/>

resulted in 

<img width="1072" height="1162" alt="image"
src="https://github.com/user-attachments/assets/59c588b9-8925-41bb-b9fb-e4906c43c723"
/>


Release Notes:

- Fixed the sidebar opening when a new directory in a new window was
opened
2026-04-13 16:21:13 +00:00
Danilo Leal
ea42a19531
git_ui: Improve design in branch, stash, and worktree pickers (#53798)
Mainly improving label truncation as well as making date/time display
consistent between the branch and stash pickers. In the list item, we
display relative timestamps, while in the tooltip, we display it in
absolute for more details.

Release Notes:

- N/A
2026-04-13 13:15:00 -03:00
Danilo Leal
51dffe4974
git_graph: Add some design adjustments (#53803)
Closes https://github.com/zed-industries/zed/issues/53524

- Improve overall colors
- Fix chip truncation
- Better highlight which branch is currently checked out

| Truncation | Checked out branch |
|--------|--------|
| <img width="2774" height="2158" alt="Screenshot 2026-04-13 at 9 
40@2x"
src="https://github.com/user-attachments/assets/176cbe72-a757-4b83-b8c1-9fcbda16a5a8"
/> | <img width="2774" height="2158" alt="Screenshot 2026-04-13 at 9 
41@2x"
src="https://github.com/user-attachments/assets/cf4a3863-9dae-4891-b93a-443e4d7ca5a2"
/> |

Release Notes:

- Git Graph: Improved visibility of the currently checked out branch and
fixed branch name truncation.
2026-04-13 13:14:48 -03:00
Conrad Irwin
cbd856ff3e
Revert "Fix duplicate window when opening from CLI on macOS (#48146)" (#53814)
This reverts commit 5be9dc1781.

This change breaks dragging directories onto the App icon (or using the
directories listed in the menu on the app icon in the doc)

Release Notes:

- N/A
2026-04-13 16:02:00 +00:00
Oleksiy Syvokon
dc3b25a4f4
gpui_wgpu: Fix WGPU panic from unsupported atlas texture formats (#53808)
We were assuming that `Bgra8Unorm` always works, which was causing the
panic on configurations that don't support it ("wgpu-hal invariant was
violated: Requested feature is not available on this device")

This change makes a proper fallback to `Rgba8Unorm`. In the worst case,
if a device doesn't support that as well (highly unlikely), we return a
proper error instead of a panic.


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 ZED-69S

Release Notes:

- Fixed panic on devices that don't support BGRA8
2026-04-13 18:17:55 +03:00
Danilo Leal
2ab33bbb0f
Remove ACP onboarding content (#53806)
This is eight months old at this point and we can clean it up!

Release Notes:

- N/A
2026-04-13 10:54:38 -03:00
Fuad Hasan
d5d6029a66
agent_ui: Clarify disabled profile selector copy (#53797)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [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

After fix:


https://github.com/user-attachments/assets/7a9b7947-e222-4839-a46d-078b6aec8f18

Closes #53749

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-13 08:51:05 -03:00
XiaoYan Li
beb0b028f1
agent_ui: Show full branch name in thread branch picker aside (#53791)
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

## Summary

- Display the full branch name in the DocumentationAside panel for
thread branch picker entries, so users can see truncated branch names in
full
- Add a separator between the branch name and descriptive text, matching
the pattern used by the model selector's DocumentationAside

Release Notes:

- Agent: Improved branch picker by displaying the full branch name in
the documentation aside.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-13 08:14:55 -03:00
Kirill Bulatov
3450c48aa5
Unify dirs dependency (#53775)
Corresponding font-kit commit:
94b0f28166

Before, Zed has 3 different versions of `dirs` crate to compile, this PR
bumps the related dependencies to have one, latest, version of `dirs`
instead.

Release Notes:

- N/A
2026-04-13 13:55:29 +03:00
morgankrey
4b3a0486e4
Fix docs preprocessor not running on CI (#53755)
## Summary

The docs preprocessor was configured with `renderer = ["html"]`, but the
actual output renderer is `zed-html`. This mismatch caused mdbook to
skip the preprocessing step, leaving YAML frontmatter unprocessed in the
rendered HTML.

**Symptoms:**
- YAML frontmatter (`---\ntitle: ...\n---`) leaked into rendered HTML
- `---` rendered as `<hr />`
- Frontmatter fields appeared as `<h2>` headings (setext heading
interpretation)
- Meta description tags showed default values instead of page-specific
descriptions

## Root Cause

The `renderer = ["html"]` config was introduced in August 2024 (#16883)
when the preprocessor was first added. At that time, the output was the
standard `html` renderer.

In July 2025 (#35112), the `[output.zed-html]` custom renderer was added
for frontmatter/postprocessing support, but the preprocessor's
`renderer` filter wasn't updated to match.

**Why it broke now (April 12, 2026):**

The mismatch was latent - it worked inconsistently depending on CI
environment conditions. Comparing two deploys from the same day:

| Deploy | Network Errors | Preprocessing |
|--------|---------------|---------------|
| 19:00 UTC | 0 | ✓ Runs correctly |
| 21:54 UTC | Many (`static.crates.io` connection failures) | ✗ Skipped
|

The 21:54 deploy had network errors during `cargo run -p
docs_preprocessor`. mdbook appears to have silently skipped the
preprocessor and proceeded directly to the renderer. The postprocessor
still ran (via the renderer's separate cargo command), but without
preprocessing, frontmatter wasn't converted to metadata.

**The fix:** Change `renderer = ["html"]` to `renderer = ["html",
"zed-html"]` to support both the custom renderer and any fallback to the
standard html renderer (e.g., during local development or if mdbook
commands internally use html).

## Test plan

- [x] Local build produces correct HTML without frontmatter leaking
- [x] Meta descriptions correctly populated from frontmatter  
- [x] CI `check_docs` shows all 3 preprocessor steps running:
  - `docs_preprocessor supports zed-html`
  - `docs_preprocessor` (preprocessing)
  - `docs_preprocessor postprocess`

Release Notes:

- N/A
2026-04-13 05:43:26 -05:00
Bennet Bo Fenner
70a66c6486
sidebar: Fix ordering issue (#53787)
Follow up to #53737, that introduced an ordering issue where we would
override the existing thread metadata in the case of loading a session

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-13 10:07:30 +00:00
Mikayla Maki
4035186cc2
Fix a reachability bug in the sidebar (#53785)
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-13 09:31:23 +00:00
Oleksiy Syvokon
38e1d19e06
agent_ui: Simplify thread scrolling with keyboard (#53547)
This change allows using simple navigation keys (PageDown / PageUp /
Ctrl-Home / Ctrl-End) when the message editor is focused, but only if
the cursor is at the beginning/end of the message, where pressing these
keys would normally result in no-op.

One important corollary is that when the cursor is in an empty message,
navigation keys scroll the thread.

We already have this behavior for Up/Down and this change just expands
it for other navigation keys.

Demo:


[Demo](https://github.com/user-attachments/assets/ff540c8c-a223-417b-b16a-b0d08599b1ae)



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-04-13 12:27:54 +03:00
Nathan Sobo
55e47138e9
agent_ui: Unify draft and background threads into retained threads (#53737)
> **Foundation PRs:** #53732, #53733, #53734 — These three draft PRs
contain the base refactors (retained workspaces, agent panel overlay
split, ThreadId introduction) that this PR builds on.

## Goal

Remove `DraftId` and merge `draft_threads` + `background_threads` into a
single `retained_threads: HashMap<ThreadId, Entity<ConversationView>>`
in `AgentPanel`. A draft is just a thread that hasn't sent its first
message — no separate identity or storage needed.

## Changes

### agent_panel.rs
- Remove `DraftId` / `DraftIdCounter` / the `Global` impl
- Merge the two maps into `retained_threads`
- Add `thread_id: ThreadId` field to `BaseView::AgentThread`
- Rename methods: `create_draft` → `create_thread`, `activate_draft` →
`activate_retained_thread`, `remove_draft` → `remove_thread`, etc.
- Replace `clear_active_thread` with `show_or_create_empty_draft`
- Update `update_thread_work_dirs` to sync `ThreadMetadataStore` paths
when worktrees change
- Keep `load_agent_thread(...)` cleanup so activating a real thread
removes empty retained drafts

### sidebar.rs
- Remove `active_entry` derivation from `rebuild_contents` (was racing
with deferred effects)
- Add `sync_active_entry_from_panel` called from event handlers instead
- Simplify `ActiveEntry` — remove `ThreadActivation` struct, make
`session_id` optional
- Move `seen_thread_ids` to global scope (was per-group, causing
duplicate thread entries)
- Remove dead code: `clear_draft`, `render_draft_thread`
- Generalize `pending_remote_thread_activation` into
`pending_thread_activation` so all persisted-thread activations suppress
fallback draft reconciliation
- Set the activation guard before local persisted-thread activation
switches workspaces
- Make `reconcile_groups(...)` bail while a persisted-thread activation
is in flight
- On `ActiveViewChanged`, clear empty group drafts as soon as a pending
persisted-thread activation resolves

### thread_metadata_store.rs
- Make `ThreadMetadata.title` an `Option<SharedString>` with
`display_title()` fallback
- Add `update_worktree_paths` for batched path updates when project
worktrees change

### Other crates
- Update all `ThreadMetadata` construction sites and title display sites
across `agent_ui` and `sidebar`

## Fallback draft invariant

This PR now tightens the retained-thread invariant around fallback
drafts vs real thread activation/restoration:

- Fallback drafts are always empty
- User-created drafts worth preserving are non-empty
- While a persisted thread is being activated/restored/loaded, sidebar
reconciliation must not create an empty fallback draft for that target
group/workspace
- Once the real thread becomes active, empty fallback drafts in that
target group are removed

This is enforced by the sidebar-side activation guard plus existing
`AgentPanel` empty-draft cleanup after real-thread load.

## Tests

Added and/or kept focused sidebar regression coverage for:

-
`test_confirm_on_historical_thread_in_new_project_group_opens_real_thread`
-
`test_unarchive_into_inactive_existing_workspace_does_not_leave_active_draft`
-
`test_unarchive_after_removing_parent_project_group_restores_real_thread`
- `test_pending_thread_activation_suppresses_reconcile_draft_creation`

Focused test runs:

- `cargo test -p sidebar activate_archived_thread -- --nocapture`
- `cargo test -p sidebar unarchive -- --nocapture`
- `cargo test -p sidebar archive_last_thread_on_linked_worktree --
--nocapture`
- `cargo test -p sidebar
test_confirm_on_historical_thread_in_new_project_group_opens_real_thread
-- --nocapture`
- `cargo test -p sidebar
test_unarchive_into_inactive_existing_workspace_does_not_leave_active_draft
-- --nocapture`
- `cargo test -p sidebar
test_unarchive_after_removing_parent_project_group_restores_real_thread
-- --nocapture`
- `cargo test -p sidebar
test_pending_thread_activation_suppresses_reconcile_draft_creation --
--nocapture`

## Test fix

Fixed flaky `test_backfill_sets_kvp_flag` — added per-App `AppDatabase`
isolation in `setup_backfill_test` so backfill tests no longer share a
static in-memory DB.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2026-04-13 09:07:09 +00:00
Kirill Bulatov
c771663c8f
Do not open the sidebar when opening a new project in a new window (#53776)
Closes https://github.com/zed-industries/zed/issues/53466

Release Notes:

- Fixed the sidebar opening when a new project in a new window was
opened
2026-04-13 08:21:57 +00:00
daydalek
497b6de85f
editor: Add configurable hover delay (#53504)
follow up #47471 

As described in #47471, we introduced a direction-aware strategy to
improve user experience when interacting with hover popovers. In this
follow-up, we are adding `hover_popover_sticky` and
`hover_popover_hiding_delay` to control whether the feature introduced
in 47471 enabled, and to let users configure the delay to balance
responsiveness . Also `hover_popover_sticky` can now be imported from
`editor.hover.sticky`, as well as `hover_popover_hiding_delay` from
`editor.hover.hidingDelay` in VSCode.


Also this PR adds several tests:
- `test_hover_popover_cancel_hide_on_rehover`: when the cursor returns
to the hover after leaving once within the hiding delay, the hover
should persist while canceling the existing hiding timer.
- `test_hover_popover_enabled_false_ignores_sticky` : when
`hover_popover_enabled` is false, the `hover_popover_sticky` and
`hover_popover_hiding_delay` have no effect(since no hover is shown).
- `test_hover_popover_sticky_delay_restarts_when_mouse_gets_closer`:
when mouse gets closer to hover popover, we expect the timer to reset
and the hover remains visible.
- `test_hover_popover_hiding_delay`: check if the delay(in test, that's
500ms) works.
- `test_hover_popover_sticky_disabled`: when hover_popover_sticky is
false, the hover popover disappears immediately after the cursor leaving
the codes.
- VSCode import test in `settings_store.rs`

Release Notes:

- Added `hover_popover_sticky` and `hover_popover_hiding_delay` settings
to balance responsiveness of hover popovers.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-13 09:46:19 +03:00
Mikayla Maki
8e0005c0cd
Fix a bug where worktree creation would apply to nested git repos (#53771)
Saw this while manually testing other stuff.

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-13 06:04:46 +00:00
Erin van der Veen
c512c72b63
git_ui: Toggle directory expansion with Enter key in tree view (#52965)
Semantics and code was mostly taken from the existing behaviour of the
Left/Right arrow keys.

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

Release Notes:

- Added ability to toggle tree collapse in git panel
2026-04-13 01:44:23 +00:00
Finn Evers
60a8b6f003
ci: Use GitHub context for artifact name (#53559)
Missed this yesterday in
https://github.com/zed-industries/zed/pull/53433, because in the `with`
level, we need to use the proper context syntax.

Release Notes:

- N/A
2026-04-12 23:54:22 +02:00
João Soares
a86de48c70
editor: Fix semantic tokens missing when opening buffer from multibuffer (#53712)
Summary

Semantic token highlighting was missing when opening a file from
multibuffer search results (Ctrl+Shift+F). Which file got hit depended
on window size and scroll offset.

## Root cause

Two async tasks race to write `post_scroll_update`:

1. `set_visible_line_count` (scroll.rs:682) fires on first render and
spawns a task that calls `register_visible_buffers` + `update_lsp_data`
(requests semantic tokens).

2. `open_buffers_in_workspace` (editor.rs:25049) calls
`change_selections` with autoscroll right after creating the editor.
This emits `ScrollPositionChanged`, whose handler (editor.rs:2655)
replaces `post_scroll_update` with a task calling
`update_data_on_scroll`.

3. `update_data_on_scroll` (editor.rs:26099) has a singleton guard: `if
!self.buffer().read(cx).is_singleton()` that skips `update_lsp_data` for
single-file buffers. This is a scroll optimization, singleton buffers
don't change their visible buffer set on scroll.

4. The initial task gets dropped, the replacement skips
`update_lsp_data`, semantic tokens are never requested.

## Fix

Added a `needs_initial_lsp_data` flag to the Editor struct, set to
`true` on creation. `update_data_on_scroll` checks this flag alongside
the singleton guard, so `update_lsp_data` runs at least once even for
singletons. The flag flips to `false` right after, so subsequent scrolls
behave exactly as before. No perf impact after the first render.

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

Closes #53051

## Demo

Before:

https://github.com/user-attachments/assets/77d07d95-cb4a-44ff-842d-1f7a46653ca9
After:


https://github.com/user-attachments/assets/2c942f52-4ec3-459f-a97b-93919e4bfb3d



## Release notes

- Fixed semantic token highlighting missing when opening a buffer from
multibuffer search results
2026-04-12 22:00:40 +03:00