Decouple agent reregistration from settings changes (#39528)

Fixes a `--release`-only bug in feature-flagged agents where the feature
flag isn't picked up in some situations (unless there was a settings
change to go with it - due to an early return when settings didn't
change).

Release Notes:

- N/A
This commit is contained in:
Richard Feldman
2025-10-04 17:19:27 +00:00
committed by GitHub
parent 21e75b8221
commit b32075cdcb
3 changed files with 63 additions and 9 deletions
+24 -5
View File
@@ -146,10 +146,6 @@ impl AgentServerStore {
fn agent_servers_settings_changed(&mut self, cx: &mut Context<Self>) {
let AgentServerStoreState::Local {
node_runtime,
fs,
project_environment,
downstream_client,
settings: old_settings,
..
} = &mut self.state
@@ -168,6 +164,29 @@ impl AgentServerStore {
return;
}
self.reregister_agents(cx);
}
fn reregister_agents(&mut self, cx: &mut Context<Self>) {
let AgentServerStoreState::Local {
node_runtime,
fs,
project_environment,
downstream_client,
settings: old_settings,
..
} = &mut self.state
else {
debug_panic!("Non-local projects should never attempt to reregister. This is a bug!");
return;
};
let new_settings = cx
.global::<SettingsStore>()
.get::<AllAgentServersSettings>(None)
.clone();
self.external_agents.clear();
self.external_agents.insert(
GEMINI_NAME.into(),
@@ -256,7 +275,7 @@ impl AgentServerStore {
let feature_flags_subscription =
cx.observe_flag::<feature_flags::CodexAcpFeatureFlag, _>(move |_enabled, cx| {
let _ = this_handle.update(cx, |this, cx| {
this.agent_servers_settings_changed(cx);
this.reregister_agents(cx);
});
});
let mut this = Self {
+2 -1
View File
@@ -36,10 +36,11 @@ use dap::inline_value::{InlineValueLocation, VariableLookupKind, VariableScope};
use task::Shell;
use crate::{
agent_server_store::{AgentServerStore, AllAgentServersSettings},
agent_server_store::AllAgentServersSettings,
git_store::GitStore,
lsp_store::{SymbolLocation, log_store::LogKind},
};
pub use agent_server_store::{AgentServerStore, AgentServersUpdated};
pub use git_store::{
ConflictRegion, ConflictSet, ConflictSetSnapshot, ConflictSetUpdate,
git_traversal::{ChildEntriesGitIter, GitEntry, GitEntryRef, GitTraversal},