Commit Graph

37058 Commits

Author SHA1 Message Date
Ben Brandt 5484caa2a8 Remove unused dep 2026-04-17 15:18:08 +02:00
Ben Brandt 4a4a17a605 Remove unused deps 2026-04-17 14:48:29 +02:00
Ben Brandt d2e77820b1 language_models: Remove language model token counting
Drop the `count_tokens` API and related implementations across
providers, and remove the unused `tiktoken-rs` dependency.

I was going to update the dependency becuase they finally released a fix
we needed. But then I realized we only used this api in one place, the
Rules library. And for most models it would have been wildly incorrect
becuase we use tiktoken, i.e. OpenAI tokenizers, for almost every model,
which is going to give incorrect results.

Given that, I just removed these because the difference in how we get
these has caused plenty of confusion in the past.
2026-04-17 14:46:47 +02:00
Yara 🏳️‍⚧️ 73126dcb81 editor: Introduce Bookmarks (#54174)
Adds basic bookmark functionality to the editor, allowing users to mark
lines and later navigate between them. This is an MVP and will later be
expanded with a picker, vim marks integration and syntax tree based
bookmark positions. In this MVP bookmarks shift under external edits.

# UI
## Adding/Removing bookmarks
To add a bookmark:
- run the toggle bookmark action 
- hold secondary and click in the gutter
- open the context menu by right clicking in the gutter and select add
bookmark To remove a bookmark:
- run the toggle bookmark action 
- click on the bookmarks icon in the gutter
- open the context menu by right clicking in the gutter and select
remove bookmark

remove all bookmarks with `workspace: clear bookmarks`


# Implementation
This mirrors the implementation of breakpoints. The rendering of the
gutter was refactored to make place for bookmark icons and buttons:
- Code was extracted to a `Gutter` struct
- Runnables, breakpoints and bookmarks are now collected ahead of
layouting. Just before layouting we remove the items that collide and do
not have priority.
- The `phantom_breakpoint` is replaced by a `gutter_hover_button`

## In depth phantom breakpoint discussion:
This was phantom_breakpoint. It worked as follows:
 - A fake breakpoint was added to the list of breakpoints.
- While rendering the breakpoints it a breakpoint turned out to be fake
it would get a different description and look.
- The breakpoint list was edited run_indicators ("play buttons")
rendering to removes the fake breakpoint if it collided.

This would not scale to more functionality. Now we only render
breakpoints, bookmarks and run indicators. Then we render a button if
there is not breakpoint, bookmark or run indicator already present. We
can do so since the rendering of such "gutter indicators" has been
refactored into two phases:
 - collect the items.
 - render them if no higher priority item collides.

This is far easier and more readable which enabled me to easily take the
phantom_breakpoint system and use it for placing bookmarks as well :)

Note: this was previously merged but it needed a better squashed commit
message. For the actual PR see: 51404. This reverts commit
7e523a2d2b.

Release Notes:

- Added Bookmarks

Co-authored-by: Austin Cummings <me@austincummings.com>
2026-04-17 13:54:43 +02:00
Ben Kunkle 7b01267b4b Improve edit prediction button sign in copy (#54063)
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-17 07:36:32 -04:00
Ben Kunkle e3718e51ac ep: Send preferred experiment in a header (#54154)
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-17 07:25:01 -04:00
Yara 🏳️‍⚧️ 7e523a2d2b Revert "editor: Bookmarks MVP" to update its description (#54163)
Reverts zed-industries/zed#51404 because I forgot to updated the
squashed commits description ....
2026-04-17 10:55:05 +00:00
Austin Cummings 79473da756 editor: Bookmarks MVP (#51404)
Closes #4526

Adds basic bookmark functionality to the editor, allowing users to mark
lines and later navigate between them.

### What's new

**Toggling bookmarks**
Users can toggle a bookmark on the current line(s) via the `editor:
toggle bookmark` action. A bookmark icon appears in the gutter for each
bookmarked line.

**Navigation**
Two new actions, `editor: go to next bookmark` and `editor: go to
previous bookmark`, navigate between bookmarks in the current buffer,
wrapping around at the ends of the buffer.

**Viewing all bookmarks**
`editor: view bookmarks` opens all bookmarks across the project in a
multibuffer, similar to how references and diagnostics are surfaced.

**Clearing bookmarks**
`workspace: clear bookmarks` removes all bookmarks in the current
project.

**Persistence**
Bookmarks are persisted to the workspace database and restored when the
workspace is reopened. They are stored as `(path, row)` pairs and
resolved back to text anchors. Out of range or unresolvable bookmarks
are skipped with a logged warning.

**Gutter rendering**
Bookmark icons are rendered in the gutter using the existing gutter
button layout system, consistent with breakpoints. They are suppressed
on lines that already show a breakpoint or phantom breakpoint indicator.
A new `gutter.bookmarks` setting (defaulting to `true`) controls their
visibility.

### What's left

- [x] Lazily load buffers that have bookmarks
- [x] Clean up test boilerplate
- [ ] Assign default keybindings
- [ ] Compare line of saved bookmarks with current buffer (gray out the
"stale" bookmarks)

### What's next (and nice to haves)
- [ ] Resilience against external edits
- [ ] Save column position with the bookmark
- [ ] Bookmarks attached to syntactic structures?
- [ ] Labeled bookmarks?

---

Release Notes:

- Added bookmarks: toggle bookmarks on lines with `editor: toggle
bookmark`, navigate with `editor: go to next bookmark` / `editor: go to
previous bookmark`, view all bookmarks with `editor: view bookmarks`,
and clear with `workspace: clear bookmarks`. Bookmarks are shown in the
gutter and persisted across sessions.

---------

Co-authored-by: Yara <git@yara.blue>
2026-04-17 12:39:07 +02:00
Xin Zhao adfcb45abe vim: Fix incorrect bracket matching for symmetric quotes in cs operator (#52321)
## Context

Closes #46698

This PR fixes a bug where the `cs` (change surrounds) operator fails on
symmetric delimiters like quotes.

In a sequence like `c s ' "`, Zed previously performed two independent
searches. For a line like `I'm 'goˇod'`, the first step (`cs'`)
correctly moves the cursor to the second quote: `I'm ˇ'good'`. However,
when the replacement character `"` is pressed, `change_surrounds` would
perform another scan from the new cursor position. Because quotes are
symmetric, this second search would incorrectly match `'m '` as the
target pair, leading to a broken result like `I"m "good'`.

I've refactored the workflow to ensure the search happens only once.
`prepare_and_move_to_valid_bracket_pair` now computes and stores the
`Anchor` positions of the detected pair directly into the operator
state. `change_surrounds` then simply reuses these anchors instead of
re-executing the search. This ensures correctness for quotes while
remaining consistent with Vim/Neovim cursor behavior. While this
slightly increases coupling between these two functions, it is an
intentional trade-off since they exclusively serve the `cs` operation.

## How to Review

The main changes are in `crates/vim/src/surrounds.rs`. I renamed
`check_and_move_to_valid_bracket_pair` to
`prepare_and_move_to_valid_bracket_pair` and updated it to return the
detected bracket anchors. In `change_surrounds`, I removed the redundant
search logic and updated it to perform the replacement using the
provided anchors. You can also see the updated
`Operator::ChangeSurrounds` enum variant in `crates/vim/src/state.rs`
which now carries the anchor data.


## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed an issue where the `cs` Vim operator incorrectly identified
symmetric quotes in certain contexts.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-04-16 22:10:25 -06:00
Max Brunsfeld a5e78b02de Fix double borrow panic when ACP process dies (#54135)
Release Notes:

- Fixed a crash that would occur when an ACP server process exited
unexpectedly.
2026-04-17 00:36:15 +00:00
Anthony Eid 302e591e3d agent: Fix find_or_create repository to support remote (#54074)
### Summary

Follow up to: https://github.com/zed-industries/zed/pull/54001

This PR makes
`agent_ui::thread_worktree_archive::find_or_create_repository` whether
or not the repository it's searching for is on a remote machine. In the
case where it's on a remote machine that has an active connection in
Zed's connection pool, we return the repository; otherwise, we error
out.

I implemented it this way so archiving a thread on a remote machine that
isn't connected deletes the metadata without showing a remote connection
modal to a user. In the future, we can work around this by having better
git worktree garbage collection, where remote machines remove git
worktree's that were created by Zed and have no thread metadata on
connection too.

Finally, this PR gets archive threads working on remotes!


#### Follow Ups 

1. Replace instances of `std::fs` with Zed's Fs trait in the archive
thread codepaths
2. Make archive thread work properly for workspace's that are not open
(local and remote)

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: Smit Barmase <heysmitbarmase@gmail.com>
2026-04-16 16:36:09 -07:00
KyleBarton 44c6ed117f Use proper pathing for windows & nix in test (#54129)
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 N/A

Release Notes:

- N/A
2026-04-16 16:33:55 -07:00
Danilo Leal 9fbe317588 sidebar: Fix cmd-click in the header not taking to the last workspace (#54128)
Fixes a bug where we weren't properly recording the last active
workspace to power the cmd-click interaction in the sidebar's header.
This PR introduces a field in the sidebar struct for that, allowing to
store that value and to come back to it when clicking on the header,
which is the single caller of the function introduced here.

Release Notes:

- Agent: Fixed a bug where cmd-clicking on the project header wouldn't
actually take you to the last active workspace.
2026-04-16 19:38:01 -03:00
Anthony Eid e92a40a9d8 agent: Auto-select user model when there's no default (#54125)
Reimplements #36722 while fixing the race that required the revert in
#36932.

When no default model is configured, this picks an environment fallback
by authenticating all providers. It always prefers the Zed cloud
provider when it's authenticated, and waits for its models to load
before picking another provider as the fallback, so we don't flicker
from Zed models to Anthropic while sign-in is in flight.

The fallback is recomputed whenever provider state changes (via
`ProviderStateChanged`/`AddedProvider`/`RemovedProvider` events), so the
selection becomes correct as soon as cloud models arrive.

### What changed vs. the original PR

- `language_models::init` now owns `authenticate_all_providers`
(previously done in `LanguageModelPickerDelegate` and `agent`'s
`LanguageModels`).
- After all authentications settle, and on any subsequent provider state
change, `update_environment_fallback_model` recomputes the fallback.
- The fallback logic prefers Zed cloud: if the cloud provider is
authenticated, only use it (waiting for its models to load). Otherwise,
fall through to the first authenticated provider with a default or
recommended model.
- `LanguageModelRegistry::default_model()` falls back to
`environment_fallback_model` when no explicit default is set.
- Existing `Thread`s that are empty are updated to the new default when
`DefaultModelChanged` fires, so a blank thread started before sign-in
switches to Zed models once the user signs in.

Release Notes:

- agent: Automatically select a model when there's no selected model or configured default
2026-04-16 18:35:47 -04:00
Max Brunsfeld f9ca74e68d When thread title generation fails, display error and (#54130)
Release Notes:

- Fixed an issue where thread titles remained in the generating state if
the generation failed.
2026-04-16 15:32:16 -07:00
Nathan Sobo 3dfbfc8fff Rename Archive view to Thread History (#54075)
This renames the Archive view to Thread History in all user-facing
surfaces. The concept of archiving a thread (the verb/state) remains
unchanged — only the view that lists all threads is renamed, since it
shows both active and archived entries.

## Changes

- Rename `ViewAllThreads` action → `ToggleThreadHistory`
- Context-sensitive tooltip: "Show Thread History" / "Hide Thread
History"
- Update action doc comment to reference "history" instead of "archive
view"
- Telemetry event: `Thread History Viewed`
- `SerializedSidebarView::Archive` → `History` (with `#[serde(alias =
"Archive")]` for backward compat)
- Add a Lucide-based clock icon adapted to 16×16 / 1.2px stroke
- Switch the history toggle button to use the new clock icon
- Update all three platform keymaps

cc @danilo-leal

Release Notes:

- Renamed the threads Archive view to Thread History and updated its
icon to a clock.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-16 19:24:42 -03:00
Danilo Leal edb0211d1d agent_ui: Adjust thread item component and fix thread switcher (#54126)
This PR adds some adjustments to the thread item component so metadata
labels (project, worktree, and branch names) properly show up and
truncate in different places, as well as fixes the thread switcher by
making hover auto-select the item, making it more consistent with the
regular tab switcher. We still have to figure out how to make the modal
dismiss on click, though; that's pending.

Ended up also cleaning up the thread item's tooltip a bit, and tweaking
the preview examples we have for it.

Release Notes:

- Agent: Fixed worktree and branch labels not showing up in the thread
switcher.
- Agent: Fixed the thread switcher not selecting on hover.
2026-04-16 18:13:14 -03:00
Lukas Wirth 626963b5ae Run wasm builds in CI against pinned stable (#54081)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-16 22:39:31 +02:00
Danilo Leal 56370bb5f8 branch_picker: Ensure create buttons have unique IDs (#54117)
Little bug I noticed that was preventing the buttons in the branch
picker's footer from working correctly.

Release Notes:

- Fixed a bug in the branch picker where the buttons wouldn't properly
get activated.
2026-04-16 17:33:59 -03:00
Bennet Bo Fenner dbb057b192 agent_ui: Do not save thread metadata for collab projects (#54094)
Make sure that we never write thread metadata to the DB for a thread
running on a collab project.

When joining a collab project and starting a native thread we would set
all your threads that had no paths associated with to the path of the
collab project (in `move_thread_paths`).

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-16 20:05:57 +00:00
Bennet Bo Fenner 31e51613bd Remove test_dockerfile_location_with_compose_context_parent test (#54119)
Removing it as it seems to constantly fail on CI on Windows. cc
@KyleBarton

```
FAIL [   0.693s] (1511/5475) dev_container devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent
  stdout ───

    running 1 test
    test devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent ... FAILED

    failures:

    failures:
        devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 62 filtered out; finished in 0.64s
    
  stderr ───

    thread 'devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent' (1992) panicked at crates\dev_container\src\devcontainer_manifest.rs:3817:9:
    assertion `left == right` failed
      left: None
     right: Some("C:\\\\path\\to\\local\\project\\.devcontainer/Dockerfile")
    stack backtrace:
       0: std::panicking::panic_handler
                 at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library\std\src\panicking.rs:689
       1: core::panicking::panic_fmt
                 at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library\core\src\panicking.rs:80
       2: core::panicking::assert_failed_inner
                 at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library\core\src\panicking.rs:439
       3: core::panicking::assert_failed<enum2$<core::option::Option<std::path::PathBuf> >,enum2$<core::option::Option<std::path::PathBuf> > >
                 at C:\Rust\.rustup\toolchains\1.94.1-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panicking.rs:394
       4: dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent::__test_dockerfile_location_with_compose_context_parent::async_fn$0
                 at .\src\devcontainer_manifest.rs:3817
       5: gpui::executor::impl$4::block_test::async_block$0<tuple$<>,enum2$<dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent::__test_dockerfile_location_with_compose_context_parent::async_fn_env$0> >
                 at C:\actions-runner\_work\zed\zed\crates\gpui\src\executor.rs:440
       6: scheduler::test_scheduler::impl$1::block
                 at C:\actions-runner\_work\zed\zed\crates\scheduler\src\test_scheduler.rs:538
       7: gpui::executor::ForegroundExecutor::block_test<tuple$<>,enum2$<dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent::__test_dockerfile_location_with_compose_context_parent::async_fn_env$0> >
                 at C:\actions-runner\_work\zed\zed\crates\gpui\src\executor.rs:447
       8: dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent::closure$0
                 at .\src\devcontainer_manifest.rs:3796
       9: gpui::test::run_test::closure$0
                 at C:\actions-runner\_work\zed\zed\crates\gpui\src\test.rs:109
      10: std::panicking::catch_unwind::do_call<gpui::test::run_test::closure_env$0,tuple$<> >
                 at C:\Rust\.rustup\toolchains\1.94.1-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:581
      11: alloc::vec::spec_from_iter::impl$0::from_iter<tuple$<gpui::app::entity_map::EntityId,alloc::boxed::Box<dyn$<core::any::Any>,alloc::alloc::Global> >,core::iter::adapters::filter_map::FilterMap<alloc::vec::drain::Drain<gpui::app::entity_map::EntityId,alloc::
      12: std::panicking::catch_unwind
                 at C:\Rust\.rustup\toolchains\1.94.1-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:544
      13: std::panic::catch_unwind<gpui::test::run_test::closure_env$0,tuple$<> >
                 at C:\Rust\.rustup\toolchains\1.94.1-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:359
      14: gpui::test::run_test
                 at C:\actions-runner\_work\zed\zed\crates\gpui\src\test.rs:106
      15: dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent
                 at .\src\devcontainer_manifest.rs:3796
      16: dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent::closure$0
                 at .\src\devcontainer_manifest.rs:3796
      17: core::ops::function::FnOnce::call_once<dev_container::devcontainer_manifest::test::test_dockerfile_location_with_compose_context_parent::closure_env$0,tuple$<> >
                 at C:\Rust\.rustup\toolchains\1.94.1-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:250
      18: core::ops::function::FnOnce::call_once
                 at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library\core\src\ops\function.rs:250
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```

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
2026-04-16 19:49:32 +00:00
morgankrey 809a511089 Add Claude Opus 4.7 to documentation (#54113)
## Summary

- Add Claude Opus 4.7 to the pricing table with same rates as Opus 4.6
- Add Claude Opus 4.7 to context windows table (1M context)
- Update model retirements to include Opus 4.7 as upgrade path from Opus
4.1
- Add Opus 4.7 to Bedrock extended context section

Release Notes:

- N/A
2026-04-16 14:31:03 -05:00
Max Brunsfeld 496a78e01b Preserve focused tool calls in agent panel when scrolling them out of view (#54115)
Release Notes:

- Fixed a bug where the agent panel would sometimes close if you
scrolled up or down while it was zoomed.

Co-authored-by: Lukas <lukas@zed.dev>
2026-04-16 12:27:29 -07:00
Bing Wang 54f544430d dev_container: Fix environment variables without an equals sign were treated as fatal parsing errors. (#53864)
in vscode the environment variables without an equals sign are ignored
https://github.com/devcontainers/cli/blob/main/src/spec-node/utils.ts#L488-L498
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 #53470

Release Notes:

- Fix environment variables without an equals sign were treated as fatal
parsing errors.
2026-04-16 19:12:32 +00:00
KyleBarton 5e6e41155e Simplify remote workspace folder calculation for Dev Containers (#53829)
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 #53635 

Release Notes:

- Fixed issues with Windows pathing when calculating target workspace
directory for dev containers
2026-04-16 11:50:08 -07:00
Richard Feldman bb660d25ed Use Fs abstraction for worktree directory removal (#54088)
Replace `std::fs::remove_dir_all` with the `Fs` trait's `remove_dir`
method in `remove_root_after_worktree_removal`. This makes the code
testable with `FakeFs` and consistent with the rest of the codebase.

- Add `Arc<dyn Fs>` parameter to `remove_root` and its internal helper
- Use `RemoveOptions { recursive, ignore_if_not_exists }` which handles
both the recursive deletion and NotFound cases cleanly
- Pass `fs` from workspace `AppState` through the sidebar call chain
- Add test verifying error propagation and rollback when `remove_dir`
fails
- Remove tests that were testing raw `std::fs::remove_dir_all` patterns

Release Notes:

- N/A
2026-04-16 14:31:56 -04:00
Xiaobo Liu fdd81d015f git_ui: Add section checkbox and align header (#41565)
Release Notes:

- Added git panel support select all and deselect all check box

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-04-16 10:54:09 -07:00
Ben Brandt 223e4ae0e9 copilot_chat: Set Copilot output config only when effort exists (#54103)
It seems their verification got stricter, at least stricter than
Anthropics. Only set the output config if we have an effort.

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

Release Notes:

- copilot_chat: Fix invalid reasoning effort for some models.

Co-authored-by: John Tur <john-tur@outlook.com>
2026-04-16 17:47:05 +00:00
Eric Holk a9e7b77672 gpui: Record input-to-frame latency histogram (#53822)
Adds instrumentation to track input-to-frame latency in GPUI windows,
helping diagnose input responsiveness issues.

## What this does

- Records the time between when an input event is dispatched and when
the resulting frame is presented, capturing worst-case latency when
multiple events are coalesced into a single frame.
- Tracks how many input events get coalesced per rendered frame.
- Both metrics are stored in
[HdrHistogram](https://docs.rs/hdrhistogram) instances with 3
significant digits of precision.
- Latency is only recorded when the input event actually causes a redraw
(i.e. marks the window dirty), so idle mouse moves and other no-op
events don't skew the data.
- Adds a `Dump Input Latency Histogram` command that opens a buffer with
a formatted report including percentile breakdowns and visual
distribution bars.

## Example output

The report shows percentile latencies, a bucketed distribution with bar
charts, and a per-frame event coalescing breakdown.

Release Notes:

- N/A

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Cole Miller <cole@zed.dev>
2026-04-16 17:38:58 +00:00
Tom Houlé 7306ffc12c client: Make account_too_young() gating not apply to business orgs (#54059)
Organizations manage their own trust (they invite their own members), so
we shouldn't apply any heuristics to restrain these users.

Release Notes:

- N/A
2026-04-16 19:30:27 +02:00
Jack Jen 8fefbb1339 git_panel: Load template commit message (#42827)
Closes #41371

Release Notes:

- Adds loading commit message from template file set in `git config
commit.template`

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2026-04-16 10:14:52 -07:00
Toni Alatalo bc88fe4931 dev_container: Resolve compose dockerfile path relative to build context (#53860)
## Context

When a Docker Compose service specifies `context: ..` and `dockerfile:
.devcontainer/Dockerfile`, Zed resolves the dockerfile path relative to
the compose file's directory instead of the build context. This produces
a doubled path like `.devcontainer/.devcontainer/Dockerfile` which
doesn't exist.

Per the [Docker Compose
spec](https://docs.docker.com/reference/compose-file/build/#dockerfile),
the `dockerfile` field is relative to the build context directory.

The fix resolves the context directory first (relative to the compose
file), then joins the dockerfile path to that.

Closes #53473

## Prior art

This fix is extracted from #53170 by @zdeneklapes, which addresses this
bug among several other dev container startup issues. This PR isolates
the dockerfile path resolution fix into a focused change to make it
easier to review and merge independently.

Differences from #53170:
- **Scope**: Only the dockerfile-relative-to-context fix, not the other
fixes (compose build args preservation, remote user fallback, Docker
inspect labels, etc.)
- **Implementation**: Inline resolution in `dockerfile_location()`
rather than separate helper methods
- **Absolute path handling**: Handles absolute dockerfile and context
paths
- **Tests**: Two test cases — compose file inside `.devcontainer/` with
`context: ..`, and compose file at project root with `context: .`

## How to Review

Single file change in
`crates/dev_container/src/devcontainer_manifest.rs`:
- **Fix** (line 234-252): Resolve build context relative to compose file
directory, then join dockerfile to that, instead of joining dockerfile
to `config_directory` directly. Uses `normalize_path` to resolve `..`
components.
- **Tests**: Two new `FakeDocker` compose config entries and
corresponding tests asserting correct resolved paths.

## 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 docker-compose `dockerfile` path being resolved relative to the
compose file instead of the build `context` directory.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 09:56:32 -07:00
Bennet Bo Fenner e585523c8d agent_ui: Do not show token limit callout for external agents (#54090)
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-16 18:35:39 +02:00
Peter Schilling 72a9dcd916 Add 'git: view commit' command palette action (#39009)
adds a 'git: view commit' – accepting a ref (e.g. HEAD, an sha, etc) to
more easily navigate to the git commit view.

<img width="3024" height="1888" alt="Screenshot 2025-09-26 at 21 43
09@2x"
src="https://github.com/user-attachments/assets/c001baec-66c2-46e5-b4a7-f691631f4166"
/>


if a bad ref is entered, the user is shown a generic error

<img width="2734" height="1442" alt="Screenshot 2025-09-27 at 21 04
52@2x"
src="https://github.com/user-attachments/assets/abdbd92d-ef0b-4de9-afb9-e9e52607dfdd"
/>

happy to adjust any of that. also worth noting is the `git: branch`
command UI is a bit nicer, can e.g. show you some metadata on the commit
before you select it, so happy to take it further in that direction if
desired, but thought i'd keep it simple to start.

Release Notes:

- Added view commit command palette action

---------

Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2026-04-16 12:29:58 -04:00
João Soares 11cfb9e330 Ensure language servers from extension properly start on workspace restoration (#51308)
Closes #49877

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
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed extension language servers not starting when Zed launches with
files already open from a restored session.
2026-04-16 18:26:37 +02:00
KyleBarton 7c45d93e5e Use remote_user to execute on_create_command and update_content_command (#54020)
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 #53995

Release Notes:

- Improved dev container remote script execution to more closely align
with the reference implementation
2026-04-16 09:00:41 -07:00
Ben Brandt 4c611e297e agent_ui: Use root thread helpers consistently (#54070)
Replace call sites that treated the active thread as the root thread
with the dedicated `root_thread_view` and `root_thread` helpers, and
simplify `ConversationView` lookups to avoid passing `cx` when it is
not needed.

Also emit token limit telemetry when usage crosses warning or exceeded
thresholds, while avoiding duplicate events for the same session state.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-04-16 17:51:30 +02:00
Richard Feldman 4f6055e015 Hide branch name for main worktree threads in sidebar (#54067)
<img width="337" height="752" alt="Screenshot 2026-04-16 at 9 31 04 AM"
src="https://github.com/user-attachments/assets/174b1eb2-6a3a-46f1-abdf-006e13b80c7a"
/>

Release Notes:

- Agent sidebar now shows worktree and branch names only for linked
worktrees.
2026-04-16 15:48:35 +00:00
Richard Feldman eb254be084 vim: Don't steal focus from non-pane panels for search commands (#54012)
When the Agent panel (or any dock panel without its own pane) is focused
and a file is open in the center editor, pressing `/` in vim mode would
steal focus to the buffer's search bar instead of staying on the panel.

## Root cause

`Vim::pane()` calls `workspace.focused_pane()`, which falls back to the
center pane when a dock panel without its own `pane()` method is
focused. Vim search commands then open the `BufferSearchBar` on the
center pane and focus it, stealing focus from the panel.

## Fix

Add a guard in `Vim::pane()` that returns `None` when the resolved pane
doesn't actually contain focus. This prevents all vim search/match
commands (`/`, `?`, `n`, `N`, `*`, `#`, etc.) from stealing focus from
non-pane panels.

All 497 vim tests and 253 agent_ui tests pass.

Release Notes:

- Fixed vim search (`/`) stealing focus from the Agent panel when a file
is open in the editor.
2026-04-16 11:47:59 -04:00
krisswee 75fa566511 dev_container: Detect actual buildx availability instead of assuming Docker has it (#53910)
`supports_compose_buildkit()` returned `!self.is_podman()`, assuming
every Docker install has buildx. On setups like Colima where the buildx
CLI plugin isn't installed, this causes builds to fail with "classic
builder doesn't support additional contexts" since `DOCKER_BUILDKIT=1`
alone isn't enough without the plugin.

Now probes for `docker buildx version` at construction time and caches
the result. When buildx isn't found, the existing scratch-image fallback
path (same one Podman uses) kicks in instead.

Closes #53890

Release Notes:

- Fixed dev container builds failing on Docker installations without the
buildx plugin.

---------

Co-authored-by: krisswee <krisswee@users.noreply.github.com>
Co-authored-by: KyleBarton <kjb@initialcapacity.io>
2026-04-16 08:44:48 -07:00
Cameron Mcloughlin 5af494d455 Revert "sidebar: Refactor thread time storage (#53982)" (#54078) 2026-04-16 15:16:50 +00:00
Bennet Bo Fenner d0fc14c2f6 agent_ui: Remove unused pending_thread_loads from agent panel (#54066)
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
2026-04-16 17:16:48 +02:00
Anthony Eid ebf2f56a25 gpui: Make property tests deterministic by default (#54004)
### Summary

`#[gpui::property_test]` was non-deterministic because it always used a
random seed with proptest. So it generated different test cases and
scheduler seeds on every run, causing flaky failures. `#[gpui::test]`
doesn't have this problem because it defaults to fixed seeds.

This changes `#[gpui::property_test]` to match: proptest's RNG seed now
defaults to `0` instead of random, so the same cases run every time.
The`$SEED` env var overrides both the scheduler seed and case generation
seed.

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: cameron <cameron.studdstreet@gmail.com>
2026-04-16 10:37:05 -04:00
Tim Vermeulen 7d365ef26c editor: Defer rendering the git blame popover until after the markdown is parsed (#52231)
Fixes this single-frame glitch that sometimes occurs when the git blame
popover is rendered before the markdown has been parsed.


https://github.com/user-attachments/assets/d5a322c3-e46f-4597-a10f-a676da57daa7

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a visual glitch where the git blame popover could briefly appear
empty while its markdown content was being parsed
2026-04-16 14:17:39 +00:00
Nathan Sobo 3bb0b494d8 agent_ui: Fix session equality check for reloading retained threads (#53992)
## Summary

Adds three tests that exercise session disassociation ("Session not
found" after reopening a thread). The third test **fails**, reproducing
the bug.

### Root cause

A retained `ConversationView` with a `thread_error` receives
`AgentServersUpdated`, which triggers `reset()` → `close_all_sessions` →
state transitions to `Loading`. When the user then reopens the same
session via `open_thread`, `load_agent_thread`'s `has_session` check
returns `false` (because the retained view is in `Loading` state, not
`Connected`), so a **second** `ConversationView` is created for the same
session. Both views' async load tasks complete and both transition to
`Connected` with the same session ID. When the retained view is later
cleaned up, its `on_release` → `close_all_sessions` removes the session
from the connection, leaving the active view stranded with a dead
session.

### Tests

| Test | Status | What it verifies |
|------|--------|-----------------|
| `test_open_thread_on_visible_session_does_not_disassociate_it` | 
Pass | `load_agent_thread` short-circuits when session is already active
|
| `test_retained_thread_cleanup_does_not_disassociate_reopened_session`
|  Pass | Eviction + reopen cycle works (close-then-reload) |
| `test_retained_thread_reset_race_disassociates_session` |  **Fail** |
Reproduces the race described above |

cc @bennetbo @ConradIrwin

Release Notes:

- N/A

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-04-16 13:26:48 +00:00
Cole Miller 81072ebe1d Remove flakytest_dev_container_modal_not_dismissed_on_background_click (#54062)
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-16 12:57:29 +00:00
Bennet Bo Fenner dae1b20289 action_log: Fix race condition when committing changes (#53884)
Sometimes the action log would not auto-accept agent edits when
commiting.

Gpt-5.4 identified this race condition:

This fixes a race where `keep_committed_edits` could run after
`head_commit` changed but before the new git base text had been applied,
leaving committed agent edits marked as unreviewed; `ActionLog` now
waits for an explicit `BufferDiffEvent::BaseTextChanged` instead of
inferring readiness from generic `DiffChanged` activity, so it only
accepts edits after the diff base itself is actually updated.

- `ReloadGitState` updates `head_commit` before `ReloadBufferDiffBases`
finishes loading and applying the new HEAD text.
- In that gap, an unrelated `DiffChanged` can fire from a normal diff
recalculation.
- The old logic treated that event as the commit signal and ran
`keep_committed_edits` too early.
- `keep_committed_edits` then read stale diff base text, so it failed to
match the committed agent edits.
- When the real base-text update arrived later, the HEAD had already
been overwritten (`old_head`), and the edits stayed unreviewed.

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:

- Fixed an issue where committing agent written code would sometimes not
mark edits as accepted
2026-04-16 12:54:17 +00:00
Smit Barmase bbf087756c language_models: Fix Mistral tool use erroring out (#54058)
Closes #52717

Mistral's streaming API sometimes sends `"id": "null"` (the literal
string, not JSON null) in continuation chunks for tool calls. Our stream
handler treated this as a valid ID, overwriting the real tool call ID
from the first chunk. When the corrupted ID was sent back in the next
request, Mistral's API rejected it with "Tool call id has to be defined
in serving mode."

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 issue where Mistral models erroring out with "Tool call id has
to be defined" when using tools.
2026-04-16 18:21:02 +05:30
Kirill Bulatov 053803099b Show better tab tooltip for multi buffers (#54060)
Before, no tooltip was shown at all, now we show the full, not trimmed
text:

<img width="437" height="80" alt="image"
src="https://github.com/user-attachments/assets/f8220e04-e036-4175-b048-697e22504a6a"
/>


Release Notes:

- Show better tab tooltip for multi buffers
2026-04-16 15:46:33 +03:00
Bennet Bo Fenner ff108c89d7 acp: Fix close session not found error (#54009)
Follow up to #53999

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-16 14:11:06 +02:00