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>
0969b0dba3Eli Stark committed on 8/25/2026, 2:08:13 PM· committed by GitHubparentb20c469
1 file changedLine totals unavailable