From ac8c653ae6d784bc2395f8ec3a0674fba5d770a8 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 2 Sep 2025 12:28:07 -0400 Subject: [PATCH] Fix race condition between feature flag and deserialization (#37381) Right now if you open Zed, and we deserialize an agent that's behind a feature flag (e.g. CC), we don't restore it because the feature flag check hasn't happened yet at the time we're deserializing (due to auth not having finished yet). This is a simple fix: assume that if you had serialized it in the first place, you must have had the feature flag enabled, so go ahead and reopen it for you. Release Notes: - N/A --- crates/agent_ui/src/agent_panel.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index fac880b783271ffd8c9524464a8f0a178f276895..c80ddb5c92ef4b670123433effe297da4cbbda23 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -1911,13 +1911,17 @@ impl AgentPanel { AgentType::Gemini => { self.external_thread(Some(crate::ExternalAgent::Gemini), None, None, window, cx) } - AgentType::ClaudeCode => self.external_thread( - Some(crate::ExternalAgent::ClaudeCode), - None, - None, - window, - cx, - ), + AgentType::ClaudeCode => { + self.selected_agent = AgentType::ClaudeCode; + self.serialize(cx); + self.external_thread( + Some(crate::ExternalAgent::ClaudeCode), + None, + None, + window, + cx, + ) + } AgentType::Custom { name, command } => self.external_thread( Some(crate::ExternalAgent::Custom { name, command }), None,