You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Show accurate Git context for agent threads in the sidebar. Base checkouts display their current branch, linked worktrees display their worktree and branch, and branchless linked worktrees display Detached HEAD.
This follows up on #53900 and keeps detached state accurate for remote clients, reconnects, and late joins.
Solution
Render base-worktree branches and explicit detached-HEAD state in ThreadItem, using a dot separator and branch icon for linked worktree branches.
Carry is_detached_head through repository snapshots, protobuf updates, and collab persistence instead of encoding it as a synthetic branch name.
Extend FakeFs and focused sidebar, project, collab, and visual fixtures to distinguish detached state from missing Git metadata.
Manually verified the base, linked-branch, and detached-HEAD labels in a local Zed build.
Self-Review Checklist:
I've reviewed my own diff for quality, security, and reliability
Unsafe blocks (if any) have justifying comments
The content adheres to Zed's UI standards (UX/UI and icon guidelines)
Tests cover the new/changed behavior
Performance impact has been considered and is acceptable
Before
After
Release Notes:
Branch name and icon is now shown for each thread in the thread sidebar including when the base branch is checked out, and it is now clear when a thread is in detached HEAD state.
This PR modifies database schema files (crates/collab/migrations.sqlite/20221109000000_test_schema.sql, crates/collab/migrations/20251208000000_test_schema.sql), which requires creating a schema migration in the Cloud repository.
Once the schema migration has been created and applied, please add the following attestation to your PR description:
"The corresponding database schema migration has been created in the Cloud repo and applied to the production database."
Hey! This change needs a corresponding schema migration in the Cloud repo, but I don’t have access to that repo. Could someone from the Zed team help create and apply the migration for me please? The new column is project_repositories.is_detached_head, a non-null boolean with a default of false. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Show accurate Git context for agent threads in the sidebar. Base checkouts display their current branch, linked worktrees display their worktree and branch, and branchless linked worktrees display
Detached HEAD.This follows up on #53900 and keeps detached state accurate for remote clients, reconnects, and late joins.
Solution
ThreadItem, using a dot separator and branch icon for linked worktree branches.is_detached_headthrough repository snapshots, protobuf updates, and collab persistence instead of encoding it as a synthetic branch name.Testing
cargo fmt --all -- --checkcargo test -p sidebar -p gpui_platform --features gpui_platform/runtime_shaders test_apply_worktree_label_mode_for_detached_worktree -- --nocapturecargo test -p sidebar -p gpui_platform --features gpui_platform/runtime_shaders test_sidebar_worktree_info_for_base_and_detached_linked_checkout -- --nocapturecargo test -p sidebar -p gpui_platform --features gpui_platform/runtime_shaders test_sidebar_worktree_info_for_current_detached_linked_checkout -- --nocapturecargo test -p sidebar -p gpui_platform --features gpui_platform/runtime_shaders test_multi_main_worktree_branch_labels_are_disambiguated -- --nocapturecargo test -p sidebar -p gpui_platform --features gpui_platform/runtime_shaders test_worktree_info_missing_branch_returns_none -- --nocapturecargo test -p fs test_detached_worktree_admin_names_are_uniquecargo test -p fs test_fake_worktree_lifecyclecargo test -p project test_branch_list_synccargo test -p collab -p gpui_platform --features gpui_platform/runtime_shaders test_detached_head_synccargo test -p collab -p gpui_platform --features gpui_platform/runtime_shaders test_linked_worktrees_synccargo build -p zed -p gpui_platform --bin zed_visual_test_runner --features visual-tests,gpui_platform/runtime_shaders./script/clippygit diff --checkSelf-Review Checklist:
Before
After
Release Notes: