acp: Fix agent servers sometimes not being registered when Zed starts (#38330)

In local projects, initialize the list of agents in the agent server
store immediately. Previously we were initializing the list only after a
delay, in an attempt to avoid sending the `ExternalAgentsUpdated`
message to the downstream client (if any) before its handlers were
initialized. But we already have a separate codepath for that situation,
in the `AgentServerStore::shared`, and we can insert the delay in that
place instead.

Release Notes:

- acp: Fixed a bug where starting an external agent thread soon after
Zed starts up would show a "not registered" error.

---------

Co-authored-by: Michael <michael@zed.dev>
Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
Cole Miller
2025-09-17 16:45:47 -04:00
committed by GitHub
co-authored by Michael Agus
parent 4912096599
commit ea473eea87
4 changed files with 26 additions and 39 deletions
+3 -3
View File
@@ -257,7 +257,7 @@ impl EventEmitter<ConflictSetUpdate> for ConflictSet {}
mod tests {
use std::{path::Path, sync::mpsc};
use crate::{Project, project_settings::ProjectSettings};
use crate::Project;
use super::*;
use fs::FakeFs;
@@ -484,7 +484,7 @@ mod tests {
cx.update(|cx| {
settings::init(cx);
WorktreeSettings::register(cx);
ProjectSettings::register(cx);
Project::init_settings(cx);
AllLanguageSettings::register(cx);
});
let initial_text = "
@@ -585,7 +585,7 @@ mod tests {
cx.update(|cx| {
settings::init(cx);
WorktreeSettings::register(cx);
ProjectSettings::register(cx);
Project::init_settings(cx);
AllLanguageSettings::register(cx);
});