From a1bc6ee75e9371121caac1b115518cc1396085a3 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Fri, 8 Aug 2025 16:16:13 -0600 Subject: [PATCH] zeta: Only send outline and diagnostics when data collection is enabled (#35896) This data is not currently used by edit predictions - it is only useful when `can_collect_data == true`. Release Notes: - N/A --- crates/zeta/src/zeta.rs | 8 ++++++-- crates/zeta_cli/src/main.rs | 38 +++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index b1bd737dbf..828310a3bd 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -1211,7 +1211,7 @@ pub fn gather_context( let local_lsp_store = project.and_then(|project| project.read(cx).lsp_store().read(cx).as_local()); let diagnostic_groups: Vec<(String, serde_json::Value)> = - if let Some(local_lsp_store) = local_lsp_store { + if can_collect_data && let Some(local_lsp_store) = local_lsp_store { snapshot .diagnostic_groups(None) .into_iter() @@ -1245,7 +1245,11 @@ pub fn gather_context( MAX_CONTEXT_TOKENS, ); let input_events = make_events_prompt(); - let input_outline = prompt_for_outline(&snapshot); + let input_outline = if can_collect_data { + prompt_for_outline(&snapshot) + } else { + String::new() + }; let editable_range = input_excerpt.editable_range.to_offset(&snapshot); let body = PredictEditsBody { diff --git a/crates/zeta_cli/src/main.rs b/crates/zeta_cli/src/main.rs index adf7683152..d78035bc9d 100644 --- a/crates/zeta_cli/src/main.rs +++ b/crates/zeta_cli/src/main.rs @@ -171,21 +171,31 @@ async fn get_context( Some(events) => events.read_to_string().await?, None => String::new(), }; - let can_collect_data = false; + // Enable gathering extra data not currently needed for edit predictions + let can_collect_data = true; let git_info = None; - cx.update(|cx| { - gather_context( - project.as_ref(), - full_path_str, - &snapshot, - clipped_cursor, - move || events, - can_collect_data, - git_info, - cx, - ) - })? - .await + let mut gather_context_output = cx + .update(|cx| { + gather_context( + project.as_ref(), + full_path_str, + &snapshot, + clipped_cursor, + move || events, + can_collect_data, + git_info, + cx, + ) + })? + .await; + + // Disable data collection for these requests, as this is currently just used for evals + match gather_context_output.as_mut() { + Ok(gather_context_output) => gather_context_output.body.can_collect_data = false, + Err(_) => {} + } + + gather_context_output } pub async fn open_buffer_with_language_server(