From fe6fa1bbdce5ff89d5b9942f9a17a87d72557078 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 3 Dec 2025 12:11:23 +0100 Subject: [PATCH] Revert "acp: Add a timeout when initializing an ACP agent so the user isn't waiting forever" (#44066) Reverts zed-industries/zed#43663 --- crates/agent_ui/src/acp/thread_view.rs | 62 +------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index a9b4127ea97f62dde3cb2af299050bc0e06a06bc..9c4717c5189eb3397ec153560156d9c77e5125ba 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -498,17 +498,7 @@ impl AcpThreadView { Some(new_version_available_tx), ); - let agent_name = agent.name(); - let timeout = cx.background_executor().timer(Duration::from_secs(30)); - let connect_task = smol::future::or( - agent.connect(root_dir.as_deref(), delegate, cx), - async move { - timeout.await; - Err(anyhow::Error::new(LoadError::Other( - format!("{agent_name} is unable to initialize after 30 seconds.").into(), - ))) - }, - ); + let connect_task = agent.connect(root_dir.as_deref(), delegate, cx); let load_task = cx.spawn_in(window, async move |this, cx| { let connection = match connect_task.await { Ok((connection, login)) => { @@ -7399,54 +7389,4 @@ pub(crate) mod tests { assert_eq!(text, expected_txt); }) } - - #[gpui::test] - async fn test_initialize_timeout(cx: &mut TestAppContext) { - init_test(cx); - - struct InfiniteInitialize; - - impl AgentServer for InfiniteInitialize { - fn telemetry_id(&self) -> &'static str { - "test" - } - - fn logo(&self) -> ui::IconName { - ui::IconName::Ai - } - - fn name(&self) -> SharedString { - "Test".into() - } - - fn connect( - &self, - _root_dir: Option<&Path>, - _delegate: AgentServerDelegate, - cx: &mut App, - ) -> Task, Option)>> - { - cx.spawn(async |_| futures::future::pending().await) - } - - fn into_any(self: Rc) -> Rc { - self - } - } - - let (thread_view, cx) = setup_thread_view(InfiniteInitialize, cx).await; - - cx.executor().advance_clock(Duration::from_secs(31)); - cx.run_until_parked(); - - let error = thread_view.read_with(cx, |thread_view, _| match &thread_view.thread_state { - ThreadState::LoadError(err) => err.clone(), - _ => panic!("Incorrect thread state"), - }); - - match error { - LoadError::Other(str) => assert!(str.contains("initialize")), - _ => panic!("Unexpected load error"), - } - } }