agent: Remove thread-auto-capture
feature (#36474)
We never ended up using this in practice (the feature flag is not enabled for anyone, not even staff) Release Notes: - N/A
This commit is contained in:
parent
790a2a0cfa
commit
e6d5a6a4fd
4 changed files with 0 additions and 65 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -131,7 +131,6 @@ dependencies = [
|
||||||
"component",
|
"component",
|
||||||
"context_server",
|
"context_server",
|
||||||
"convert_case 0.8.0",
|
"convert_case 0.8.0",
|
||||||
"feature_flags",
|
|
||||||
"fs",
|
"fs",
|
||||||
"futures 0.3.31",
|
"futures 0.3.31",
|
||||||
"git",
|
"git",
|
||||||
|
|
|
@ -31,7 +31,6 @@ collections.workspace = true
|
||||||
component.workspace = true
|
component.workspace = true
|
||||||
context_server.workspace = true
|
context_server.workspace = true
|
||||||
convert_case.workspace = true
|
convert_case.workspace = true
|
||||||
feature_flags.workspace = true
|
|
||||||
fs.workspace = true
|
fs.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
git.workspace = true
|
git.workspace = true
|
||||||
|
|
|
@ -16,7 +16,6 @@ use chrono::{DateTime, Utc};
|
||||||
use client::{ModelRequestUsage, RequestUsage};
|
use client::{ModelRequestUsage, RequestUsage};
|
||||||
use cloud_llm_client::{CompletionIntent, CompletionRequestStatus, Plan, UsageLimit};
|
use cloud_llm_client::{CompletionIntent, CompletionRequestStatus, Plan, UsageLimit};
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use feature_flags::{self, FeatureFlagAppExt};
|
|
||||||
use futures::{FutureExt, StreamExt as _, future::Shared};
|
use futures::{FutureExt, StreamExt as _, future::Shared};
|
||||||
use git::repository::DiffType;
|
use git::repository::DiffType;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
|
@ -388,7 +387,6 @@ pub struct Thread {
|
||||||
feedback: Option<ThreadFeedback>,
|
feedback: Option<ThreadFeedback>,
|
||||||
retry_state: Option<RetryState>,
|
retry_state: Option<RetryState>,
|
||||||
message_feedback: HashMap<MessageId, ThreadFeedback>,
|
message_feedback: HashMap<MessageId, ThreadFeedback>,
|
||||||
last_auto_capture_at: Option<Instant>,
|
|
||||||
last_received_chunk_at: Option<Instant>,
|
last_received_chunk_at: Option<Instant>,
|
||||||
request_callback: Option<
|
request_callback: Option<
|
||||||
Box<dyn FnMut(&LanguageModelRequest, &[Result<LanguageModelCompletionEvent, String>])>,
|
Box<dyn FnMut(&LanguageModelRequest, &[Result<LanguageModelCompletionEvent, String>])>,
|
||||||
|
@ -489,7 +487,6 @@ impl Thread {
|
||||||
feedback: None,
|
feedback: None,
|
||||||
retry_state: None,
|
retry_state: None,
|
||||||
message_feedback: HashMap::default(),
|
message_feedback: HashMap::default(),
|
||||||
last_auto_capture_at: None,
|
|
||||||
last_error_context: None,
|
last_error_context: None,
|
||||||
last_received_chunk_at: None,
|
last_received_chunk_at: None,
|
||||||
request_callback: None,
|
request_callback: None,
|
||||||
|
@ -614,7 +611,6 @@ impl Thread {
|
||||||
tool_use_limit_reached: serialized.tool_use_limit_reached,
|
tool_use_limit_reached: serialized.tool_use_limit_reached,
|
||||||
feedback: None,
|
feedback: None,
|
||||||
message_feedback: HashMap::default(),
|
message_feedback: HashMap::default(),
|
||||||
last_auto_capture_at: None,
|
|
||||||
last_error_context: None,
|
last_error_context: None,
|
||||||
last_received_chunk_at: None,
|
last_received_chunk_at: None,
|
||||||
request_callback: None,
|
request_callback: None,
|
||||||
|
@ -1033,8 +1029,6 @@ impl Thread {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.auto_capture_telemetry(cx);
|
|
||||||
|
|
||||||
message_id
|
message_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1906,7 +1900,6 @@ impl Thread {
|
||||||
cx.emit(ThreadEvent::StreamedCompletion);
|
cx.emit(ThreadEvent::StreamedCompletion);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
|
||||||
thread.auto_capture_telemetry(cx);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})??;
|
})??;
|
||||||
|
|
||||||
|
@ -2081,8 +2074,6 @@ impl Thread {
|
||||||
request_callback(request, response_events);
|
request_callback(request, response_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread.auto_capture_telemetry(cx);
|
|
||||||
|
|
||||||
if let Ok(initial_usage) = initial_token_usage {
|
if let Ok(initial_usage) = initial_token_usage {
|
||||||
let usage = thread.cumulative_token_usage - initial_usage;
|
let usage = thread.cumulative_token_usage - initial_usage;
|
||||||
|
|
||||||
|
@ -2536,7 +2527,6 @@ impl Thread {
|
||||||
model: Arc<dyn LanguageModel>,
|
model: Arc<dyn LanguageModel>,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Vec<PendingToolUse> {
|
) -> Vec<PendingToolUse> {
|
||||||
self.auto_capture_telemetry(cx);
|
|
||||||
let request =
|
let request =
|
||||||
Arc::new(self.to_completion_request(model.clone(), CompletionIntent::ToolResults, cx));
|
Arc::new(self.to_completion_request(model.clone(), CompletionIntent::ToolResults, cx));
|
||||||
let pending_tool_uses = self
|
let pending_tool_uses = self
|
||||||
|
@ -2745,7 +2735,6 @@ impl Thread {
|
||||||
if !canceled {
|
if !canceled {
|
||||||
self.send_to_model(model.clone(), CompletionIntent::ToolResults, window, cx);
|
self.send_to_model(model.clone(), CompletionIntent::ToolResults, window, cx);
|
||||||
}
|
}
|
||||||
self.auto_capture_telemetry(cx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3147,50 +3136,6 @@ impl Thread {
|
||||||
&self.project
|
&self.project
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn auto_capture_telemetry(&mut self, cx: &mut Context<Self>) {
|
|
||||||
if !cx.has_flag::<feature_flags::ThreadAutoCaptureFeatureFlag>() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let now = Instant::now();
|
|
||||||
if let Some(last) = self.last_auto_capture_at {
|
|
||||||
if now.duration_since(last).as_secs() < 10 {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.last_auto_capture_at = Some(now);
|
|
||||||
|
|
||||||
let thread_id = self.id().clone();
|
|
||||||
let github_login = self
|
|
||||||
.project
|
|
||||||
.read(cx)
|
|
||||||
.user_store()
|
|
||||||
.read(cx)
|
|
||||||
.current_user()
|
|
||||||
.map(|user| user.github_login.clone());
|
|
||||||
let client = self.project.read(cx).client();
|
|
||||||
let serialize_task = self.serialize(cx);
|
|
||||||
|
|
||||||
cx.background_executor()
|
|
||||||
.spawn(async move {
|
|
||||||
if let Ok(serialized_thread) = serialize_task.await {
|
|
||||||
if let Ok(thread_data) = serde_json::to_value(serialized_thread) {
|
|
||||||
telemetry::event!(
|
|
||||||
"Agent Thread Auto-Captured",
|
|
||||||
thread_id = thread_id.to_string(),
|
|
||||||
thread_data = thread_data,
|
|
||||||
auto_capture_reason = "tracked_user",
|
|
||||||
github_login = github_login
|
|
||||||
);
|
|
||||||
|
|
||||||
client.telemetry().flush_events().await;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cumulative_token_usage(&self) -> TokenUsage {
|
pub fn cumulative_token_usage(&self) -> TokenUsage {
|
||||||
self.cumulative_token_usage
|
self.cumulative_token_usage
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,14 +77,6 @@ impl FeatureFlag for NotebookFeatureFlag {
|
||||||
const NAME: &'static str = "notebooks";
|
const NAME: &'static str = "notebooks";
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ThreadAutoCaptureFeatureFlag {}
|
|
||||||
impl FeatureFlag for ThreadAutoCaptureFeatureFlag {
|
|
||||||
const NAME: &'static str = "thread-auto-capture";
|
|
||||||
|
|
||||||
fn enabled_for_staff() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct PanicFeatureFlag;
|
pub struct PanicFeatureFlag;
|
||||||
|
|
||||||
impl FeatureFlag for PanicFeatureFlag {
|
impl FeatureFlag for PanicFeatureFlag {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue