Skip to content

Fix agent panel closing unexpectedly when zoomed#49037

Merged
rtfeldman merged 3 commits intomainfrom
AI-16/agent-panel-unexpected-close
Feb 12, 2026
Merged

Fix agent panel closing unexpectedly when zoomed#49037
rtfeldman merged 3 commits intomainfrom
AI-16/agent-panel-unexpected-close

Conversation

@rtfeldman
Copy link
Contributor

@rtfeldman rtfeldman commented Feb 12, 2026

Closes #33430

Two changes:

  1. Fix observe_global_in to not permanently remove observers when the window is transiently unavailable (e.g. temporarily taken during a nested update). Previously this returned false and silently removed the observer from the subscriber set. Now it checks whether the entity is actually dropped before removing — if the entity is alive but the window is just unavailable, it keeps the observer alive.

  2. Extend dock_to_preserve in handle_pane_focused to also preserve docks whose active panel has focus, not just docks whose panel's inner pane matches the focused pane. Panels like AgentPanel don't implement pane() (only panels like TerminalPanel that contain panes do), so the existing preservation logic never identified the agent panel's dock as needing protection. This meant that when the agent panel was zoomed and a center pane received focus (e.g. during macOS window activation events), dismiss_zoomed_items_to_reveal would close the dock, making the panel disappear unexpectedly.

Closes AI-16

Release Notes:

  • Fixed agent panel unexpectedly closing when zoomed and the window regains focus.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 12, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Feb 12, 2026
Two changes:

1. Fix observe_global_in to not permanently remove observers when the
   window is transiently unavailable (e.g. temporarily taken during a
   nested update). Previously this returned false and silently removed
   the observer from the subscriber set. Now it checks whether the
   entity is actually dropped before removing — if the entity is alive
   but the window is just unavailable, it keeps the observer alive.

2. Extend dock_to_preserve in handle_pane_focused to also preserve
   docks whose active panel has focus, not just docks whose panel's
   inner pane matches the focused pane. Panels like AgentPanel don't
   implement pane() (only panels like TerminalPanel that contain panes
   do), so the existing preservation logic never identified the agent
   panel's dock as needing protection. This meant that when the agent
   panel was zoomed and a center pane received focus (e.g. during
   macOS window activation events), dismiss_zoomed_items_to_reveal
   would close the dock, making the panel disappear unexpectedly.

Closes AI-16
@rtfeldman rtfeldman force-pushed the AI-16/agent-panel-unexpected-close branch from a3cf796 to 74e3966 Compare February 12, 2026 20:31
@rtfeldman rtfeldman marked this pull request as ready for review February 12, 2026 20:31
@mikayla-maki
Copy link
Member

Could we add tests demonstrating this bug and it's resolution?

@rtfeldman rtfeldman merged commit f39e3fb into main Feb 12, 2026
27 checks passed
@rtfeldman rtfeldman deleted the AI-16/agent-panel-unexpected-close branch February 12, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI: The AI chat panel closed unexpectedly in Zoom mode

2 participants