Skip to content

Commit 8df616e

Browse files
authored
Suppress the 'Agent Thread Started' event when initializing the panel (#38535)
Release Notes: - N/A
1 parent 89520ea commit 8df616e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

crates/agent_ui/src/agent_panel.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ impl ActiveView {
408408

409409
pub struct AgentPanel {
410410
workspace: WeakEntity<Workspace>,
411+
loading: bool,
411412
user_store: Entity<UserStore>,
412413
project: Entity<Project>,
413414
fs: Arc<dyn Fs>,
@@ -513,6 +514,7 @@ impl AgentPanel {
513514
cx,
514515
)
515516
});
517+
panel.as_mut(cx).loading = true;
516518
if let Some(serialized_panel) = serialized_panel {
517519
panel.update(cx, |panel, cx| {
518520
panel.width = serialized_panel.width.map(|w| w.round());
@@ -527,6 +529,7 @@ impl AgentPanel {
527529
panel.new_agent_thread(AgentType::NativeAgent, window, cx);
528530
});
529531
}
532+
panel.as_mut(cx).loading = false;
530533
panel
531534
})?;
532535

@@ -726,6 +729,7 @@ impl AgentPanel {
726729
acp_history,
727730
acp_history_store,
728731
selected_agent: AgentType::default(),
732+
loading: false,
729733
}
730734
}
731735

@@ -857,6 +861,7 @@ impl AgentPanel {
857861
agent: crate::ExternalAgent,
858862
}
859863

864+
let loading = self.loading;
860865
let history = self.acp_history_store.clone();
861866

862867
cx.spawn_in(window, async move |this, cx| {
@@ -898,7 +903,9 @@ impl AgentPanel {
898903
}
899904
};
900905

901-
telemetry::event!("Agent Thread Started", agent = ext_agent.name());
906+
if !loading {
907+
telemetry::event!("Agent Thread Started", agent = ext_agent.name());
908+
}
902909

903910
let server = ext_agent.server(fs, history);
904911

crates/gpui/src/app.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,20 @@ impl<'a, T: 'static> std::borrow::BorrowMut<T> for GpuiBorrow<'a, T> {
24012401
}
24022402
}
24032403

2404+
impl<'a, T: 'static> std::ops::Deref for GpuiBorrow<'a, T> {
2405+
type Target = T;
2406+
2407+
fn deref(&self) -> &Self::Target {
2408+
self.inner.as_ref().unwrap()
2409+
}
2410+
}
2411+
2412+
impl<'a, T: 'static> std::ops::DerefMut for GpuiBorrow<'a, T> {
2413+
fn deref_mut(&mut self) -> &mut T {
2414+
self.inner.as_mut().unwrap()
2415+
}
2416+
}
2417+
24042418
impl<'a, T> Drop for GpuiBorrow<'a, T> {
24052419
fn drop(&mut self) {
24062420
let lease = self.inner.take().unwrap();

0 commit comments

Comments
 (0)