From 07a9e238e02e9a2efb439796a927fed52e5c4265 Mon Sep 17 00:00:00 2001 From: Katie Geer Date: Wed, 1 Apr 2026 11:57:56 -0700 Subject: [PATCH] Add source and thread_location properties to New Thread Clicked Enriches the existing event with two new properties: - source: 'agent_panel' when triggered from the toolbar + button in the agent panel, 'sidebar' when triggered from the sidebar thread list. - thread_location: 'current_worktree' or 'new_worktree', read from AgentSettings::new_thread_location at event-fire time in both call sites. This reflects the user's active preference for where new threads land, matching NewThreadLocation::LocalProject and NewThreadLocation::NewWorktree respectively. --- crates/agent_ui/src/agent_panel.rs | 11 ++++++++++- crates/sidebar/src/sidebar.rs | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index 9589d37d8ae2786053bb450a117608df52de73bf..725b7a9cc24321399c464ee51908916c090e8774 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -3777,7 +3777,16 @@ impl AgentPanel { let agent_server_store = agent_server_store; Rc::new(move |window, cx| { - telemetry::event!("New Thread Clicked"); + use settings::{NewThreadLocation, Settings}; + let thread_location = match AgentSettings::get_global(cx).new_thread_location { + NewThreadLocation::LocalProject => "current_worktree", + NewThreadLocation::NewWorktree => "new_worktree", + }; + telemetry::event!( + "New Thread Clicked", + source = "agent_panel", + thread_location = thread_location + ); let active_thread = active_thread.clone(); Some(ContextMenu::build(window, cx, |menu, _window, cx| { diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 807808bb4d566f2faf6616f7491790daa8d46bfc..56e71d4f9818131283b1420cd4e67913cf570f3b 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -30,7 +30,7 @@ use remote::RemoteConnectionOptions; use ui::utils::platform_title_bar_height; use serde::{Deserialize, Serialize}; -use settings::Settings as _; +use settings::{NewThreadLocation, Settings as _}; use std::collections::{HashMap, HashSet}; use std::mem; use std::rc::Rc; @@ -3171,6 +3171,16 @@ impl Sidebar { return; }; + let thread_location = match AgentSettings::get_global(cx).new_thread_location { + NewThreadLocation::LocalProject => "current_worktree", + NewThreadLocation::NewWorktree => "new_worktree", + }; + telemetry::event!( + "New Thread Clicked", + source = "sidebar", + thread_location = thread_location + ); + self.active_entry = Some(ActiveEntry::Draft(workspace.clone())); multi_workspace.update(cx, |multi_workspace, cx| {