Commit graph

226 commits

Author SHA1 Message Date
Richard Feldman
e5f5767d2c
Preserve terminal spinners in thread titles (#57983)
Summary:

- Preserve spinner/logo prefixes from live terminal titles when terminal
threads have custom titles.
- Store raw terminal titles and custom user titles separately,
recomposing display titles on demand.
- Keep spinner prefixes out of the title editor while preserving
sidebar/search display behavior.

Tests:

- cargo test -p agent_ui
test_terminal_custom_title_recomposes_with_live_spinner -- --nocapture
- cargo test -p agent_ui
test_terminal_title_editor_excludes_spinner_prefix -- --nocapture
- cargo test -p sidebar
test_agent_panel_terminals_appear_in_sidebar_and_search -- --nocapture

Closes AI-304

Release Notes:

- Fixed terminal thread titles to preserve animated spinner and logo
prefixes after renaming.
2026-05-29 03:47:05 +00:00
Lukas Wirth
6555ac3d04
sidebar: Improve performance of rebuild_contents (#57717)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-27 10:31:57 +00:00
MartinYe1234
c551ec93b0
Rename agent threads from the sidebar (#57656)
Summary:

- Added a rename action for agent threads in the sidebar.
- Persisted renamed thread titles and kept open thread views in sync.

Release Notes:

- Improved agent threads by allowing them to be renamed directly from
the sidebar.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-26 17:55:09 +00:00
MartinYe1234
a8966695ee
Fix flicker of pushed-off sticky project header in threads sidebar (#57529)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / miri_scheduler (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Has been skipped
The threads sidebar rebuilds its `Vec<ListEntry>` from scratch on events
that touch thread/sidebar state (status changes, title generation, new
live info, sending a message, etc.). It previously called
`ListState::reset` after every rebuild, which rewrote every list item to
`Unmeasured`. On the next render frame, the sticky project header had no
measured bounds for the next project header.

The sticky project header uses `ListState::bounds_for_item` for the next
project header to compute how far it should be pushed off screen. When
those measurements were missing, it temporarily fell back to `top_offset
= 0`, snapped fully into view for one frame, then popped back once the
list was remeasured.

Fix: preserve list measurements for entries whose identity and layout
shape did not change. `EntryShape` captures each entry's identity plus
height-affecting project-header flags. `update_entries` snapshots the
old shapes, rebuilds contents, then splices only the changed shape range
into `ListState`. Unchanged items keep their measured bounds, so the
sticky header remains in its pushed-off position across same-shape
updates.

This also adds a regression test that renders a two-project sidebar,
scrolls into the sticky-header push-off state, performs a same-shape
thread metadata update, and verifies the next header's measured bounds
are preserved.

Closes AI-196

Release Notes:

- Fixed the project section header flickering in the agent threads
sidebar when sending a message while the header was partially scrolled
off screen.
2026-05-26 14:41:26 +00:00
MartinYe1234
6a747984d3
Revert "Rename agent threads from the sidebar" (#57654)
Reverts zed-industries/zed#57521
Forgot review approval

Release Notes:
- N/A
2026-05-25 15:45:10 +00:00
MartinYe1234
453b020866
Rename agent threads from the sidebar (#57521)
Summary:
- Added a rename action for agent threads in the sidebar.
- Persisted renamed thread titles and kept open thread views in sync.

Release Notes:

- Improved agent threads by allowing them to be renamed directly from
the sidebar.
2026-05-25 14:25:25 +00:00
Danilo Leal
776b8304b1
sidebar: Remove pending indicator from header when visiting project again (#57454)
Quick follow-up to https://github.com/zed-industries/zed/pull/57322. We
weren't removing the pending notification when re-visiting the project
that contains the pending thread (only while the project is still
collapsed, though).

Release Notes:

- N/A
2026-05-21 23:00:06 +00:00
Danilo Leal
77cbba9b1a
sidebar: Add ability to move projects up and down (#57448)
Closes AI-298

This PR adds the first step towards allowing to reorganize the threads
sidebar. Drag and drop should be supported in the near future, maybe
even replacing this entirely:

<img width="700" alt="Screenshot 2026-05-21 at 6  44@2x"
src="https://github.com/user-attachments/assets/db420466-2323-474b-ba41-17eb4da2cf84"
/>

Release Notes:

- Sidebar: Added the ability to reorder projects by moving them up and
down through the ellipsis menu.
2026-05-21 21:56:35 +00:00
Danilo Leal
7ec36d3661
sidebar: Show pending/unread state in project header when collapsed (#57322)
Closes AI-285

Similar to how we display whether there are running threads or a thread
waiting for permission in the collapsed version of the project's header
in the sidebar, I was missing the "unread" state from being shown. I had
to change the approach here as to how we extract this information
because the previous method was relying on observing the state of the
list entries within the sidebar at every `rebuild_contents` run, and
given there aren't any list entires when the project is collapsed, it
wouldn't work.
Release Notes:

- Agent: Added the notification indicator on collapsed project headers
in the sidebar when a thread completes.
2026-05-21 19:35:43 +00:00
Ben Brandt
e024200c67
agent_ui: Add keybindable action for terminal threads (#57399)
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:

- Add `agent::NewTerminalThread` for defining custom shortcuts to launch
an Agent Panel terminal thread.
2026-05-21 12:37:12 +00:00
Ben Brandt
0535f47291
sidebar: Don't block worktree archival on empty drafts (#57145)
If we have empty drafts, they don't show up in the UI, so you can't get
rid of them. But they currently blocked worktree archival. Which is
particularly troublesome with terminal agents in a few cases.

This should hopefully solve the issue for terminals, but I think I need
to do a follow-up to investigate what happens when the last draft is
closed.

Self-Review Checklist:

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

Release Notes:

- N/A
2026-05-19 21:08:39 +00:00
María Craig
40d3c79f2f
Update workspace mentions in the sidebar (#54833)
Replaces "workspace" labels in the sidebar with more accurate
terminology:

- "Focus Last Workspace" → "Focus Last Project"
- "Focus Workspace" → "Focus Project"
- "Close Workspace" tooltip → "Close Worktree"

Release Notes:

- N/A
2026-05-19 20:05:13 +00:00
Ben Brandt
ad437c93c2
sidebar: Fix stale sidebar thread header state (#57017)
There was a case where if you archived or closed all threads, you
wouldn't see the empty state again.

Self-Review Checklist:

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

Release Notes:

- N/A
2026-05-19 14:43:38 +00:00
Ben Brandt
e1f13a84b7
sidebar: Persist terminal threads in sidebar metadata (#56966)
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:

- Persist Terminal Threads across reloads

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-18 11:18:05 +00:00
Ben Brandt
d4a3e0d5c9
sidebar: Track terminal agent thread telemetry (#56723)
Self-Review Checklist:

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

Release Notes:

- N/A
2026-05-14 14:47:30 +00:00
Ben Brandt
cad7406d52
agent_ui: Require an open project for agent panel (#56577)
A bit brute force, but it works.

<img width="1106" height="988" alt="image"
src="https://github.com/user-attachments/assets/d23f9a80-01c5-4ad3-a280-faf8b8bc9dbe"
/>


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: Danilo Leal <daniloleal09@gmail.com>
2026-05-14 01:24:30 +00:00
Ben Brandt
a7f037d94b
sidebar: Remove agent panel terminal feature flag (#56678)
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:

- Add the ability to create Terminal Threads in the Sidebar and Agent
Panel.
2026-05-13 21:21:52 +00:00
Danilo Leal
a1306744da
Add some refinements to the draft thread UX (#56482)
Here are the overall changes I'm adding in this PR:

- Don't create a new thread when switching to a new external agent while
in parked draft state
- Include parked draft threads in the thread switcher
- Add the draft thread item in the sidebar when navigating away from a
draft, as opposed to only on cmd-n/new thread
- Upon deleting content from a parked draft, remove its entry from the
sidebar. From this point on, we convert that draft back into the
ephemeral state so it behaves the same way as a fresh new draft would.

Release Notes:

- N/A
2026-05-12 13:01:55 +00:00
Bennet Bo Fenner
bf423dfc45
Support renaming ACP threads (#56446)
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 #54689

Release Notes:

- Support editing the thread title for external agent threads
2026-05-11 19:21:10 +00:00
Mikayla Maki
bbe23cc40b
Bring back draft threads (#54292)
Self-Review Checklist:

- [ ] 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

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-05-11 16:23:33 +00:00
Ben Brandt
40d444413f
sidebar: Show worktree labels for agent terminals (#56412)
Self-Review Checklist:

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

Release Notes:

- N/A

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-11 13:18:58 +00:00
Ben Brandt
7d3989602d
sidebar: Add terminals to thread switcher (#56388)
Allow confirming a terminal entry to activate it, track terminal
access for ordering, and close selected terminals via the archive
action.

Self-Review Checklist:

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

Release Notes:

- N/A
2026-05-11 12:21:29 +00:00
Anthony Eid
cc20ae3fb5
workspace: Always add projects to windows (#56187)
Right now the recent project picker has different confirm behavior
depending on if a user had open their sidebar in their current Zed
session. If the sidebar had been open the recent project picker adds the
selected project to the multi workspace and makes it the active
workspace, without removing anything. If the sidebar hadn't been open
the recent project picker would replace the active workspace within the
multi workspace.

This caused confusion because the same UX flow had two different
outcomes depending on Zed's state that wasn't obvious to users. This PR
mitigates this by always adding the project to the window while AI
features are enabled. Future follow ups will include the ability to
disable the sidebar, but that's blocked on the agent panel not having a
way to view active threads currently.

This also caused issues in the parallel agents workflow because
replacing a workspace would drop the workspace, thus causing any
terminal processes or threads to be dropped as well.


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-05-09 01:54:42 +00:00
María Craig
cbcf12f675
sidebar: Make placeholder text clearer (#56081)
Changes the sidebar filter editor placeholder from "Search…" to "Search
threads…" to make it clear what is being searched.

Release Notes:

- Improved sidebar search placeholder text to read "Search threads…"
instead of "Search…"
2026-05-08 19:57:12 +00:00
Cameron Mcloughlin
7940ded92a
sidebar: Better search (#56166)
Makes the sidebar search case insensitive, and also require contiguous
matches. Also removes the duplicate logic for the sidebar and thread
history view

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-08 13:13:14 +00:00
Bennet Bo Fenner
e78ddcac8d
agent: Improve UX when agent tries to edit unsaved buffer (#55655)
Before:

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


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

After:

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


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

Release Notes:

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

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-08 11:26:03 +00:00
Ben Brandt
5fc8a836dd
sidebar: Experimental Terminal Mode (#56063)
Experiment with allowing users to manage terminal sessions along with
threads in the sidebar.

Self-Review Checklist:

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

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-07 15:39:16 +00:00
Conrad Irwin
be705e677b
Merge gpui::Task and scheduler::Task (#53674)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-05 22:41:13 +00:00
Max Brunsfeld
caccc65b1e
Improve bare repo support (#55153)
Fixes https://github.com/zed-industries/zed/issues/54830

This fixes a bugs where
* when there's no main worktree, we treated the first linked worktree as
main
* the titlebar and sidebar showed two different things when opening a
linked wortree directly

When there's no main worktree, our "project group key" will be the bare
repo path. For displaying this to the user, we try to present something
meaningful:
* If the bare repo is `foo.git`, we'll say "foo"
* If the bare repo is "bar/.bare", we'll "bar"

Release Notes:

- Fixed bugs in Zed's sidebar and titlebar when editing in git worktrees
created from bare repositories.
2026-04-29 13:16:37 +00:00
Danilo Leal
c70c5da3ec
sidebar: Don't do anything on cmd-click if project is already active (#55190)
Prevent flashing the currently selected thread upon cmd-clicking the
active project's header.

Release Notes:

- Fixed a bug where a thread within the currently active project would
flash upon cmd-clicking the project header.
2026-04-29 12:31:24 +00:00
Mikayla Maki
562a0e03b5
Query for window instead of capturing (#55059)
This allows us to move entities between windows without breaking all the
callbacks.

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-28 08:04:42 +00:00
Finn Evers
80c4c3ec93
terminal_view: Ensure reported size does not change once content becomes scrollable (#46648)
This fixes an issue where due to the scrollbar appearing, the reported
content size would shift, causing issues in the process. We now actually
always reserve space for the scrollbar appropriately as described in
https://github.com/zed-industries/zed/pull/33636 initially.

Release Notes:

- Fixed an issue where the scrollbar could cause a layout shift in the
terminal.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-27 22:06:01 +00:00
Lukas Wirth
c5a2807492
Remove smol as a dependency from a bunch of crates (#53603)
We aren't making use of it in these crates and it unblocks some
web-related work

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-24 10:29:51 +00:00
Finn Evers
9b40411c6a
Fix bad GitHub merge queue merge (#54721)
No, sadly, the title is not a typo. See
https://www.githubstatus.com/incidents/zsg1lk7w13cf for the context.
I'll read with joy and popcorn through that root cause analysis.

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

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

Thanks, I guess.

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-23 23:47:30 +00:00
Max Brunsfeld
5f4cd80a83
Display open worktrees list more consistently with titlebar (#54432)
* Call it "Open Worktrees" instead of "Open Workspaces"
* Show worktree icon and 'main' for the main worktree

Release Notes:

- N/A
2026-04-23 20:24:00 +00:00
Danilo Leal
0ab64d6414
branch_picker: Add button to filter remote branches (#54632)
This PR brings back the button to filter remote branches when accessing
the title bar's branch picker with the mouse. It was unintentionally
removed when we introduced the new worktree picker.

Release Notes:

- N/A
2026-04-23 18:26:44 +00:00
Bennet Bo Fenner
949458617e
sidebar: Drop conversation view when archiving thread (#54516)
Self-Review Checklist:

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

Closes #ISSUE

Release Notes:

- agent: Fixed an issue where sessions would not immediately be cleaned
up when archiving
2026-04-23 10:40:01 +00:00
Ben Brandt
58e2b7ecdd
acp: Use new Rust SDK (#52997)
Testing out Niko's new SDK design

Self-Review Checklist:

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


Release Notes:

- N/A
2026-04-22 15:02:57 +00:00
Danilo Leal
310e367448
sidebar: Add scrollbar and max-height to the thread switcher (#54471)
Just a little refinement as I experienced the thread switcher modal
overflowing beyond the viewport if there were enough threads on it.
Additionally, took the opportunity to render a scrollbar inside of it,
too.

Release Notes:

- N/A
2026-04-21 23:16:56 -03:00
Danilo Leal
20afb83234
sidebar: Improve scrollbar overlap with thread item icon buttons (#54469)
This PR removes the overlap between the sidebar scrollbar and the thread
item icon buttons. Now, they don't render on top of each other anymore
:)

Release Notes:

- Agent: Improved the scrollbar overlap with the thread item icon
buttons in the threads sidebar.
2026-04-21 23:16:38 -03:00
María Craig
6d73ada462
Fix telemetry source for git and sidebar-triggered agent threads (#54005)
The `ReviewBranchDiff`, `ResolveConflictsWithAgent`, and
`ResolveConflictedFilesWithAgent` actions are dispatched from the git UI
(`git_ui/src/project_diff.rs` and `git_ui/src/conflict_view.rs`), not
the agent panel. Their `source` field in the "Agent Thread Started"
telemetry event was set to `"agent_panel"` — this changes it to
`"git_panel"`.

Also threads the `source` parameter through `activate_draft` and
`ensure_draft` so that drafts created from the sidebar correctly report
`source = "sidebar"` instead of `"agent_panel"`.

Release Notes:

- N/A
2026-04-21 23:32:15 +02:00
Conrad Irwin
b366f8e9d3
Fix vim mode in thread sidebar (#54381)
Release Notes:

- vim: Removed normal mode from the agent sidebar search

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
2026-04-21 11:20:40 -06:00
Eric Holk
a0b49e690d
sidebar: Fix threads disappearing when stored main paths go stale (#54382)
Fixes a user-reported bug where a thread could be missing from the
sidebar even though it was still present in the metadata store and still
visible in Thread History. The thread reappears in the sidebar only
after the user sends a message.

### Scenario

A single multi-root workspace whose roots are `[/cloud,
/worktrees/zed/wt_a/zed]`, where:

- `/cloud` is a standalone git repo (main == folder).
- `/worktrees/zed/wt_a/zed` is a linked worktree of a separate `/zed`
repo.

The project group normalizes to `main_worktree_paths = [/cloud, /zed]`.
A thread created in this workspace is written with `main=[/cloud, /zed],
folder=[/cloud, /worktrees/zed/wt_a/zed]` and the sidebar finds it via
`entries_for_main_worktree_path`.

If the thread's stored `main_worktree_paths` ever drifts from the group
key — e.g. a stale row loaded from the store on startup, a legacy write,
or a row persisted with `main == folder` — all three existing lookups in
`Sidebar::rebuild_contents` miss:

1. `entries_for_main_worktree_path([/cloud, /zed])` — the thread's
stored main doesn't equal the group key.
2. `entries_for_path([/cloud, /zed])` — the thread's folder paths don't
equal the group key either.
3. The linked-worktree fallback iterates the group workspaces'
`linked_worktrees()` snapshots. Those yield *sibling* linked worktrees
of the repo, not the workspace's own roots, so `/worktrees/zed/wt_a/zed`
doesn't match.

The row falls out of the sidebar entirely even though the metadata is
intact and the thread's folder paths exactly equal the open workspace's
roots. The store heals the stored row on the next `RootThreadUpdated`
event, which is why sending a message makes the row reappear — but until
then the sidebar misrepresents the state.

### Fix

Add a fourth lookup to `Sidebar::rebuild_contents`: for each open
workspace in the group, query the store by the workspace's own root
paths. Any thread whose `folder_paths` matches an open workspace's roots
belongs under that group, regardless of what its `main_worktree_paths`
say.

This covers the gap between stale-row load and store self-heal, matches
the principle that the sidebar should reflect state that exists in a
reasonable way, and is symmetric with the existing lookups (same store
API, one more iterator).

### Commits

1. `sidebar: Add failing repro for thread disappearing from sidebar` —
adds `test_sidebar_keeps_multi_root_thread_with_stale_main_paths` which
reproduces the bug. Sets up the multi-root + linked-worktree layout,
persists a thread in the stale shape, and asserts the row is still
visible in the sidebar.
2. `sidebar: Show threads whose folder paths match an open workspace` —
the fourth-lookup fix. 31 lines in `crates/sidebar/src/sidebar.rs`, no
deletions.

### Verification

- `cargo test -p sidebar`: 103 passed, 0 failed (the new test was
failing before commit 2 and is passing after).
- `./script/clippy -p sidebar`: clean.

### Follow-ups

The three existing lookups in `rebuild_contents` are each covering a
different historical shape the store can be in. A real cleanup — do a
one-shot migration on reload that fills in `main_worktree_paths` for any
row missing it, then retire the two legacy-shape lookups — is worth
doing as a separate PR, but out of scope here.

Release Notes:

- Fixed an issue where agent threads could go  missing from the sidebar.
2026-04-21 10:10:50 -07:00
Jason Lee
84dcf38dbe
gpui: Improve Anchored to support center position (#47154)
Release Notes:

- N/A

Ref https://github.com/longbridge/gpui-component/pull/1956 extract my
fork version of `anchored.rs` to let GPUI to support position Anchored
at center.


https://github.com/user-attachments/assets/8d0230ed-4b75-440b-b8c3-9bde3decd141

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 09:01:42 +00:00
Danilo Leal
d7eeb5cca9
sidebar: Adjust display of workspaces in header's ellipsis menu (#54360)
This PR only displays the X icon button to close an workspace when the
number of available ones is bigger than one, and does some light UI
tweaks to how we display the project labels inside the menu item.

Release Notes:

- N/A
2026-04-20 20:31:42 -03:00
Max Brunsfeld
4919ca43ec
Always use ArchiveSelectedThread action for archiving threads (#54348)
This changes the action for archiving threads in the main sidebar view
from `RemoveSelectedThread` to `ArchiveSelectedThread`. It has the same
key binding as before: `shift-backspace`. I also added `ctrl-backspace`
as a binding for deleting archived threads in the history view.

Release Notes:

- N/A
2026-04-20 18:47:40 +00:00
Cameron Mcloughlin
9ba6a32ec6
sidebar: Consistently set interacted_at (#54320)
There were a few places where you could trigger generation without
causing the `interacted_at` field to be set.

Also renames `message_sent_or_queued` to `interacted`, to be consistent
with the field on `ThreadMetadata`

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-20 17:34:23 +01:00
Danilo Leal
4fbac78ff4
sidebar: Open project header ellipsis menu on right-click (#54317)
This is just a refinement given it's pretty common for menus under
ellipsis icon buttons to also open as a context-menu through the mouse's
right-button click. This should make it slightly more convenient to
interact with this menu.

Release Notes:

- N/A
2026-04-20 09:30:41 -03:00
Danilo Leal
9daf886775
Move the worktree picker to the title bar + make it always visible (#54183)
This PR makes Zed only have one worktree picker, as opposed to a flavor
of it in the title bar and another in the agent panel. It then moves it
to the title bar, making it always present, so that its trigger is
separate from the branch picker (which now contains only two views:
branches and stashes). For the worktree picker, I'm mostly favoring the
behavior we've introduced in the agent-panel-flavored version.

It also updates the title bar settings migration to use the JSON
`migrate_settings` helper instead of a shallow Tree-sitter rewrite, so
old `show_branch_icon = true` values are promoted to
`show_branch_status_icon = true` across root, platform, release-channel,
and profile settings scopes.

- [x] Move worktree creation logic to the `git_ui` crate to make this
more generic and less agent-specific
- [x] Double-check the remote use case and ensure nothing broke there
- [x] Improve the UX for the detached HEAD state; better invite people
to create a branch
- [x] Migrate `show_branch_icon = true` to `show_branch_status_icon =
true` across nested settings scopes

Suggested .rules additions

When migrating renamed settings keys that can appear in platform
overrides, release-channel overrides, or profiles, prefer the JSON
`migrations::migrate_settings` helper over shallow Tree-sitter key
rewrites unless tests explicitly cover every nested scope that can
contain the key.

Release Notes:

- Improved migration of the title bar branch status icon setting.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-04-20 09:29:51 +00:00
Mikayla Maki
ec9be5c332
Feature flag overrides (#54206)
This PR revamps our feature flag system, to enable richer iteration. 

Feature flags can now:
- Support enum values, for richer configuration
- Be manually set via the settings file
- Be manually set via the settings UI

This PR also adds a feature flag to demonstrate this behavior, a
`agent-thread-worktree-label`, which controls which how the worktree tag
UI displays.

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-18 06:34:19 +00:00