Move thread_location onto Agent Thread Started, remove Start Thread In Changed

Katie Geer created

Start Thread In Changed tracked a preference change, which is less
useful than knowing the actual location of each thread when it starts.
thread_location is now a property on Agent Thread Started, captured
synchronously before the spawn so it reflects the setting at the moment
the thread was created.

Change summary

crates/agent_ui/src/agent_panel.rs       | 10 ----------
crates/agent_ui/src/conversation_view.rs |  7 ++++++-
2 files changed, 6 insertions(+), 11 deletions(-)

Detailed changes

crates/agent_ui/src/agent_panel.rs 🔗

@@ -2256,16 +2256,6 @@ impl AgentPanel {
             }
         };
         self.start_thread_in = new_target;
-        let target = match &self.start_thread_in {
-            StartThreadIn::LocalProject => "current_worktree",
-            StartThreadIn::NewWorktree { .. } => "new_worktree",
-            StartThreadIn::LinkedWorktree { .. } => "linked_worktree",
-        };
-        telemetry::event!(
-            "Start Thread In Changed",
-            target = target,
-            side = agent_panel_side_str(cx)
-        );
         if let Some(thread) = self.active_thread_view(cx) {
             thread.update(cx, |thread, cx| thread.focus_handle(cx).focus(window, cx));
         }

crates/agent_ui/src/conversation_view.rs 🔗

@@ -673,6 +673,10 @@ impl ConversationView {
             settings::DockPosition::Left => "left",
             settings::DockPosition::Right | settings::DockPosition::Bottom => "right",
         };
+        let thread_location = match AgentSettings::get_global(cx).new_thread_location {
+            settings::NewThreadLocation::LocalProject => "current_worktree",
+            settings::NewThreadLocation::NewWorktree => "new_worktree",
+        };
         let load_task = cx.spawn_in(window, async move |this, cx| {
             let (connection, history) = match connect_result.await {
                 Ok(AgentConnectedState {
@@ -692,7 +696,8 @@ impl ConversationView {
             telemetry::event!(
                 "Agent Thread Started",
                 agent = connection.telemetry_id(),
-                side = side
+                side = side,
+                thread_location = thread_location
             );
 
             let mut resumed_without_history = false;