From ad49f71e6eb637c31a6ff6f4d700d8d276f4bed7 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 27 Jan 2025 11:27:59 -0500 Subject: [PATCH] assistant2: Add debug logging for initialization issues (#23722) This PR adds some logging so we can debug the issues some folks have been having with Assistant2 not getting initialized properly. All the logs are prefixed with `[assistant2-debug]` so they're easier to pick out of the logs, as well as find them later to clean up once we've diagnosed the issue. Release Notes: - N/A --- crates/assistant2/src/assistant_panel.rs | 5 +++++ crates/assistant2/src/thread_store.rs | 2 ++ crates/zed/src/zed.rs | 3 +++ 3 files changed, 10 insertions(+) diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index 032e40e13ad7c5c59119cb5116a575bce71297ab..8f42e53842609aaf3d2ae8cd82ec8eadb47e717d 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -118,14 +118,17 @@ impl AssistantPanel { ) -> Task>> { cx.spawn(|mut cx| async move { let tools = Arc::new(ToolWorkingSet::default()); + log::info!("[assistant2-debug] initializing ThreadStore"); let thread_store = workspace .update(&mut cx, |workspace, cx| { let project = workspace.project().clone(); ThreadStore::new(project, tools.clone(), cx) })? .await?; + log::info!("[assistant2-debug] finished initializing ThreadStore"); let slash_commands = Arc::new(SlashCommandWorkingSet::default()); + log::info!("[assistant2-debug] initializing ContextStore"); let context_store = workspace .update(&mut cx, |workspace, cx| { let project = workspace.project().clone(); @@ -138,6 +141,7 @@ impl AssistantPanel { ) })? .await?; + log::info!("[assistant2-debug] finished initializing ContextStore"); workspace.update_in(&mut cx, |workspace, window, cx| { cx.new(|cx| Self::new(workspace, thread_store, context_store, tools, window, cx)) @@ -153,6 +157,7 @@ impl AssistantPanel { window: &mut Window, cx: &mut Context, ) -> Self { + log::info!("[assistant2-debug] AssistantPanel::new"); let thread = thread_store.update(cx, |this, cx| this.create_thread(cx)); let fs = workspace.app_state().fs.clone(); let project = workspace.project().clone(); diff --git a/crates/assistant2/src/thread_store.rs b/crates/assistant2/src/thread_store.rs index 1d055d788ceac417139af48393ad7355aec9d394..386adb33d0c707553c7848a14e3bd204573ff5e2 100644 --- a/crates/assistant2/src/thread_store.rs +++ b/crates/assistant2/src/thread_store.rs @@ -67,7 +67,9 @@ impl ThreadStore { this })?; + log::info!("[assistant2-debug] reloading threads"); this.update(&mut cx, |this, cx| this.reload(cx))?.await?; + log::info!("[assistant2-debug] finished reloading threads"); Ok(this) }) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index fddbb2406bb4f499c077b999200b79ec31acd709..80a9306d19d9ce0048bd658f17c53bc3c9d4fbd3 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -440,12 +440,14 @@ fn initialize_panels( }; let (assistant_panel, assistant2_panel) = if is_assistant2_enabled { + log::info!("[assistant2-debug] initializing Assistant2"); let assistant2_panel = assistant2::AssistantPanel::load( workspace_handle.clone(), prompt_builder, cx.clone(), ) .await?; + log::info!("[assistant2-debug] finished initializing Assistant2"); (None, Some(assistant2_panel)) } else { @@ -461,6 +463,7 @@ fn initialize_panels( workspace_handle.update_in(&mut cx, |workspace, window, cx| { if let Some(assistant2_panel) = assistant2_panel { + log::info!("[assistant2-debug] adding Assistant2 panel"); workspace.add_panel(assistant2_panel, window, cx); }