From 8e5356c9d66016938369aeed9909770164a3dba7 Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Thu, 5 Mar 2026 20:17:45 +0200 Subject: [PATCH] ep: Fix infinite loop of EP requests in some cases (#50833) When a diagnostic-triggered prediction returns no edits, don't fall back to requesting another diagnostic prediction. This was causing an infinite loop that burned through the API rate limit until hitting 429 errors. Release Notes: - N/A --- crates/edit_prediction/src/edit_prediction.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/edit_prediction/src/edit_prediction.rs b/crates/edit_prediction/src/edit_prediction.rs index 8a61a4a8fe0cd7a3dd7cc081c051839faa43112f..4e5ef2c9134618d1cc67780dc24611fa5d459a71 100644 --- a/crates/edit_prediction/src/edit_prediction.rs +++ b/crates/edit_prediction/src/edit_prediction.rs @@ -1801,6 +1801,9 @@ impl EditPredictionStore { // Prefer predictions from buffer if project_state.current_prediction.is_some() { + log::debug!( + "edit_prediction: diagnostic refresh skipped, current prediction already exists" + ); return; } @@ -2262,7 +2265,13 @@ impl EditPredictionStore { cx.spawn(async move |this, cx| { let prediction = task.await?; - if prediction.is_none() && allow_jump && has_events { + // Only fall back to diagnostics-based prediction if we got a + // the model had nothing to suggest for the buffer + if prediction.is_none() + && allow_jump + && has_events + && !matches!(trigger, PredictEditsRequestTrigger::Diagnostics) + { this.update(cx, |this, cx| { this.refresh_prediction_from_diagnostics( project,