From cee3c5307a3069d025cb1916a02a377668a3ad56 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 3eb171054a2c4d529bbc4b89063bf58f69ce5c45..ff795b98c7015b580dd6fc71fd07118a8e06bc87 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -1888,13 +1888,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,