Remove zeta example capturing (#48627)

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle 2026-02-06 15:11:40 -06:00 committed by GitHub
parent 30ec2ca370
commit 263d8e58d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 77 deletions

View file

@ -1,5 +1,5 @@
use crate::{
EditPredictionExampleCaptureFeatureFlag, StoredEvent,
StoredEvent,
cursor_excerpt::editable_and_context_ranges_for_cursor_position,
example_spec::{
CapturedEvent, CapturedPromptInput, CapturedRelatedExcerpt, CapturedRelatedFile,
@ -9,15 +9,12 @@ use crate::{
use anyhow::Result;
use buffer_diff::BufferDiffSnapshot;
use collections::HashMap;
use feature_flags::FeatureFlagAppExt as _;
use gpui::{App, Entity, Task};
use language::{Buffer, ToPoint as _};
use project::{Project, WorktreeId};
use std::{collections::hash_map, fmt::Write as _, ops::Range, path::Path, sync::Arc};
use text::{BufferSnapshot as TextBufferSnapshot, Point, ToOffset as _};
pub(crate) const DEFAULT_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS: u16 = 10;
pub(crate) const DEFAULT_STAFF_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS: u16 = 100;
pub(crate) const ZETA2_TESTING_RATE_PER_10K_PREDICTION: u16 = 500;
pub fn capture_example(
@ -307,20 +304,6 @@ fn generate_timestamp_name() -> String {
}
}
pub(crate) fn should_sample_edit_prediction_example_capture(cx: &App) -> bool {
let default_rate = if cx.is_staff() {
DEFAULT_STAFF_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS
} else {
DEFAULT_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS
};
let capture_rate = language::language_settings::all_language_settings(None, cx)
.edit_predictions
.example_capture_rate
.unwrap_or(default_rate);
cx.has_flag::<EditPredictionExampleCaptureFeatureFlag>()
&& rand::random::<u16>() % 10_000 < capture_rate
}
pub(crate) fn should_send_testing_zeta2_request() -> bool {
rand::random::<u16>() % 10_000 < ZETA2_TESTING_RATE_PER_10K_PREDICTION
}

View file

@ -72,9 +72,7 @@ pub mod zeta2;
#[cfg(test)]
mod edit_prediction_tests;
use crate::capture_example::{
should_sample_edit_prediction_example_capture, should_send_testing_zeta2_request,
};
use crate::capture_example::should_send_testing_zeta2_request;
use crate::license_detection::LicenseDetectionWatcher;
use crate::mercury::Mercury;
use crate::ollama::Ollama;
@ -115,16 +113,6 @@ impl FeatureFlag for Zeta2FeatureFlag {
}
}
pub struct EditPredictionExampleCaptureFeatureFlag;
impl FeatureFlag for EditPredictionExampleCaptureFeatureFlag {
const NAME: &'static str = "edit-prediction-example-capture";
fn enabled_for_staff() -> bool {
true
}
}
#[derive(Clone)]
struct EditPredictionStoreGlobal(Entity<EditPredictionStore>);
@ -1782,33 +1770,6 @@ impl EditPredictionStore {
user_actions,
};
let can_collect_example = snapshot
.file()
.is_some_and(|file| self.can_collect_file(&project, file, cx))
&& self.can_collect_events(&inputs.events, cx)
&& self.can_collect_related_files(&project, cx);
if can_collect_example && should_sample_edit_prediction_example_capture(cx) {
let events_for_capture =
self.edit_history_for_project_with_pause_split_last_event(&project, cx);
let related_files_for_capture = inputs.related_files.clone();
if let Some(example_task) = capture_example::capture_example(
project.clone(),
active_buffer.clone(),
position,
events_for_capture,
related_files_for_capture,
false,
cx,
) {
cx.spawn(async move |_this, _cx| {
let example = example_task.await?;
telemetry::event!("Edit Prediction Example Captured", example = example);
anyhow::Ok(())
})
.detach_and_log_err(cx);
}
}
let task = match &self.edit_prediction_model {
EditPredictionModel::Zeta1 => {
if should_send_testing_zeta2_request() {
@ -2190,21 +2151,6 @@ impl EditPredictionStore {
})
}
fn can_collect_related_files(&self, project: &Entity<Project>, cx: &mut App) -> bool {
if !self.data_collection_choice.is_enabled(cx) {
return false;
}
let related_with_buffers = self.context_for_project_with_buffers(project, cx);
related_with_buffers.iter().all(|(_, buffer)| {
buffer
.read(cx)
.file()
.is_some_and(|file| self.is_file_open_source(project, &file, cx))
})
}
fn load_data_collection_choice() -> DataCollectionChoice {
let choice = KEY_VALUE_STORE
.read_kvp(ZED_PREDICT_DATA_COLLECTION_CHOICE)

View file

@ -401,7 +401,6 @@ pub struct EditPredictionSettings {
/// This setting has no effect if globally disabled.
pub enabled_in_text_threads: bool,
pub examples_dir: Option<Arc<Path>>,
pub example_capture_rate: Option<u16>,
}
impl EditPredictionSettings {
@ -745,7 +744,6 @@ impl settings::Settings for AllLanguageSettings {
ollama: ollama_settings,
enabled_in_text_threads,
examples_dir: edit_predictions.examples_dir,
example_capture_rate: edit_predictions.example_capture_rate,
},
defaults: default_language_settings,
languages,

View file

@ -195,8 +195,6 @@ pub struct EditPredictionSettingsContent {
pub enabled_in_text_threads: Option<bool>,
/// The directory where manually captured edit prediction examples are stored.
pub examples_dir: Option<Arc<Path>>,
/// The number of edit prediction examples captured per ten thousand predictions.
pub example_capture_rate: Option<u16>,
}
#[with_fallible_options]