agent_ui: Restore last active agent panel entry - #57150
Merged
Merged
Conversation
Makes sure we can reload the last terminal, and also keeps track more globally what your last agent type was so we can carry that over to new workspaces
bennetbo
approved these changes
May 19, 2026
benbrandt
enabled auto-merge
May 19, 2026 14:00
Member
Author
|
/cherry-pick preview |
5 tasks
zed-zippy Bot
added a commit
that referenced
this pull request
May 19, 2026
… to preview) (#57154) Cherry-pick of #57150 to preview ---- Makes sure we can reload the last terminal, and also keeps track more globally what your last agent type was so we can carry that over to new workspaces 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: Ben Brandt <benjamin.j.brandt@gmail.com>
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
May 20, 2026
Makes sure we can reload the last terminal, and also keeps track more globally what your last agent type was so we can carry that over to new workspaces 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
This was referenced May 27, 2026
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
Jun 2, 2026
Makes sure we can reload the last terminal, and also keeps track more globally what your last agent type was so we can carry that over to new workspaces 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
5 tasks
pull Bot
pushed a commit
to TheTechOddBug/zed
that referenced
this pull request
Jul 10, 2026
…d-industries#59586) # Objective - Fixes zed-industries#58097. - Opening a new project and clicking `+` in the agent panel to start a terminal thread creates two terminals instead of one. I am able to replicate the issue on version 1.8.0 on macOS 27 ## Solution The new-thread action creates the terminal and then focuses the agent panel. Focusing re-activates the panel (`Panel::set_active` then `ensure_thread_initialized`) before the terminal, which is spawned asynchronously, has registered. The panel still looks uninitialized at that moment, so it spawns its own "initial" terminal too, and that is the duplicate. `spawn_terminal` now marks the spawn as in-flight (`pending_terminal_spawn`) the moment it starts, the same way the restore and initial-terminal paths already do, so the existing guard in `ensure_thread_initialized` skips the redundant terminal. This only affected new (unrestored) projects, since existing ones restore their previous entry instead of auto-creating one. The auto-init behavior was introduced in zed-industries#57150. ## Testing - Verified in a local dev build on macOS: opening a fresh project and clicking `+` now creates one terminal, and clicking `+` again creates a second, as expected. Reopening an existing project still restores a single terminal. - Added `test_explicit_terminal_blocks_redundant_auto_init`, which fails without the fix. - The change is platform-agnostic (no platform-specific code); I wasn't able to test on Linux/Windows. ## 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 adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed a duplicate terminal being created when starting an agent terminal thread in a new project
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
Makes sure we can reload the last terminal, and also keeps track more globally what your last agent type was so we can carry that over to new workspaces 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
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
Makes sure we can reload the last terminal, and also keeps track more globally what your last agent type was so we can carry that over to new workspaces 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
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
…d-industries#59586) # Objective - Fixes zed-industries#58097. - Opening a new project and clicking `+` in the agent panel to start a terminal thread creates two terminals instead of one. I am able to replicate the issue on version 1.8.0 on macOS 27 ## Solution The new-thread action creates the terminal and then focuses the agent panel. Focusing re-activates the panel (`Panel::set_active` then `ensure_thread_initialized`) before the terminal, which is spawned asynchronously, has registered. The panel still looks uninitialized at that moment, so it spawns its own "initial" terminal too, and that is the duplicate. `spawn_terminal` now marks the spawn as in-flight (`pending_terminal_spawn`) the moment it starts, the same way the restore and initial-terminal paths already do, so the existing guard in `ensure_thread_initialized` skips the redundant terminal. This only affected new (unrestored) projects, since existing ones restore their previous entry instead of auto-creating one. The auto-init behavior was introduced in zed-industries#57150. ## Testing - Verified in a local dev build on macOS: opening a fresh project and clicking `+` now creates one terminal, and clicking `+` again creates a second, as expected. Reopening an existing project still restores a single terminal. - Added `test_explicit_terminal_blocks_redundant_auto_init`, which fails without the fix. - The change is platform-agnostic (no platform-specific code); I wasn't able to test on Linux/Windows. ## 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 adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed a duplicate terminal being created when starting an agent terminal thread in a new project
playdohface
pushed a commit
to playdohface/zed
that referenced
this pull request
Aug 29, 2026
…d-industries#59586) # Objective - Fixes zed-industries#58097. - Opening a new project and clicking `+` in the agent panel to start a terminal thread creates two terminals instead of one. I am able to replicate the issue on version 1.8.0 on macOS 27 ## Solution The new-thread action creates the terminal and then focuses the agent panel. Focusing re-activates the panel (`Panel::set_active` then `ensure_thread_initialized`) before the terminal, which is spawned asynchronously, has registered. The panel still looks uninitialized at that moment, so it spawns its own "initial" terminal too, and that is the duplicate. `spawn_terminal` now marks the spawn as in-flight (`pending_terminal_spawn`) the moment it starts, the same way the restore and initial-terminal paths already do, so the existing guard in `ensure_thread_initialized` skips the redundant terminal. This only affected new (unrestored) projects, since existing ones restore their previous entry instead of auto-creating one. The auto-init behavior was introduced in zed-industries#57150. ## Testing - Verified in a local dev build on macOS: opening a fresh project and clicking `+` now creates one terminal, and clicking `+` again creates a second, as expected. Reopening an existing project still restores a single terminal. - Added `test_explicit_terminal_blocks_redundant_auto_init`, which fails without the fix. - The change is platform-agnostic (no platform-specific code); I wasn't able to test on Linux/Windows. ## 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 adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed a duplicate terminal being created when starting an agent terminal thread in a new project
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Makes sure we can reload the last terminal, and also keeps track more
globally what your last agent type was so we can carry that over to new
workspaces
Self-Review Checklist:
Release Notes: