# agent_ui: Fix restoring uninstalled external agents \(\#62497\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0969b0dba3f3411592fce801d00f8d81b8dcf902

Requested commit: 0969b0dba3f3411592fce801d00f8d81b8dcf902

Commit: 0969b0dba3f3411592fce801d00f8d81b8dcf902

Tree: 6dbaa94fac1c77c193da375ea85eb3d334aa3084

Author: Eli Stark

Committer: GitHub

## Message

```
agent_ui: Fix restoring uninstalled external agents (#62497)

Zed saves the selected external agent per workspace and as an app-wide
last-used agent. Uninstalling the agent leaves those saved values in
place, so the Agent Panel could restore an agent that no longer exists
and fail to start a thread.

For local projects, this changes restoration behavior in these cases:

- A new workspace ignores an uninstalled global last-used agent.
- A reopened workspace ignores its uninstalled agent. It uses an
installed global agent if one exists, otherwise it uses the Zed Agent.
- A project opened in the same window does not copy an uninstalled agent
from the previous project.
- An unsent draft keeps its text and switches to the selected fallback
agent if its original agent was uninstalled.

Two boundaries remain unchanged:

- A thread with a saved session stays bound to its original agent so it
can resume after the agent is reinstalled.
- Remote projects keep their saved external-agent selection because this
change only detects local uninstalls.

Release Notes:

- Fixed the Agent Panel selecting an uninstalled external agent when
opening a project or restoring an unsent draft, which prevented the
thread from starting.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

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

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