# Dismiss Settings overlay when invoking New Thread \(\#56818\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bd725ced65a04873afffda8003c93486b45b0b94)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bd725ced65a04873afffda8003c93486b45b0b94

Requested commit: bd725ced65a04873afffda8003c93486b45b0b94

Commit: bd725ced65a04873afffda8003c93486b45b0b94

Tree: fb56c6506a233e3b939ef22ee1c7620b0e7b43b1

Author: Richard Feldman

Committer: GitHub

## Message

```
Dismiss Settings overlay when invoking New Thread (#56818)

When the Agent Panel had the Settings overlay open on top of the
ephemeral new-draft thread, pressing **Cmd-N** (or clicking *Start New
Thread* in Settings) silently did nothing — the action ran, but the
Settings overlay stayed painted on top.

The bug was in `AgentPanel::activate_draft`. Every other `activate_*`
path goes through `set_base_view`, which clears the overlay. But
`activate_draft` has an early return for the case where the base view
already holds the requested draft, and that early return only refocused
— it never touched `overlay_view`. So when the user was already on the
draft and the Settings overlay was on top, "new thread" had nothing
visible to do.

Fix: in that early-return branch, if an overlay is currently open, clear
it (which also handles focusing and emits `ActiveViewChanged`).

Added a regression test that puts the panel on the draft, sets the
Settings overlay, dispatches `NewThread`, and asserts the overlay is
gone. The test directly toggles `set_overlay(OverlayView::Configuration,
…)` rather than calling `open_configuration`, because the latter builds
provider configuration views and panics on the fake LM provider's
`unimplemented!()` `configuration_view` — and the bug being exercised
lives entirely in the overlay/base-view bookkeeping.

Closes AI-237

Release Notes:

- Fixed pressing "New Thread" (or Cmd-N) doing nothing when the Agent
Panel's Settings view was open
```

## Parents

- [1c16e13a2b56fcfc9e36ec59ca3ee0bb859d07c4](https://git.cafe/gitcafe/zed/commit/1c16e13a2b56fcfc9e36ec59ca3ee0bb859d07c4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bd725ced65a04873afffda8003c93486b45b0b94?format=markdown)
