mirror of
https://github.com/zed-industries/zed.git
synced 2026-04-18 07:47:53 +00:00
55e47138e9
> **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>
57 lines
1.1 KiB
Plaintext
57 lines
1.1 KiB
Plaintext
**/*.db
|
|
**/*.proptest-regressions
|
|
**/cargo-target
|
|
**/target
|
|
**/venv
|
|
**/.direnv
|
|
*.wasm
|
|
*.xcodeproj
|
|
.DS_Store
|
|
.blob_store
|
|
.build
|
|
.claude/settings.local.json
|
|
.envrc
|
|
.flatpak-builder
|
|
.idea
|
|
.netrc
|
|
*.pyc
|
|
.pytest_cache
|
|
.swiftpm
|
|
.swiftpm/config/registries.json
|
|
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
|
.venv
|
|
.vscode
|
|
.wrangler
|
|
.perf-runs
|
|
/assets/*licenses.*
|
|
/crates/collab/seed.json
|
|
/crates/theme/schemas/theme.json
|
|
/crates/zed/resources/flatpak/flatpak-cargo-sources.json
|
|
/crates/project_panel/benches/linux_repo_snapshot.txt
|
|
/dev.zed.Zed*.json
|
|
/node_modules/
|
|
/plugins/bin
|
|
/script/node_modules
|
|
/snap
|
|
/zed.xcworkspace
|
|
DerivedData/
|
|
Packages
|
|
xcuserdata/
|
|
crates/docs_preprocessor/actions.json
|
|
|
|
# Don't commit any secrets to the repo.
|
|
.env
|
|
.env.secret.toml
|
|
|
|
# `nix build` output
|
|
/result
|
|
|
|
# Visual test baseline images (these will be stored outside
|
|
# the repo in the future, but we don't haven't decided exactly
|
|
# where yet, so for now they get generated into a gitignored dir.)
|
|
/crates/zed/test_fixtures/visual_tests/
|
|
|
|
# Local documentation audit files
|
|
/december-2025-releases.md
|
|
/docs/december-2025-documentation-gaps.md
|