Avoid duplicate apply_patch progress events

This commit is contained in:
Akshay Nathan
2026-04-30 14:04:40 -07:00
parent 8b9888d60b
commit ebd79231a5

View File

@@ -56,6 +56,7 @@ pub struct ApplyPatchHandler;
#[derive(Default)]
struct ApplyPatchArgumentDiffConsumer {
parser: StreamingPatchParser,
last_progress: Option<Vec<Hunk>>,
last_sent_at: Option<Instant>,
pending: Option<PatchApplyUpdatedEvent>,
}
@@ -87,7 +88,11 @@ impl ApplyPatchArgumentDiffConsumer {
if hunks.is_empty() {
return None;
}
if self.last_progress.as_ref() == Some(&hunks) {
return None;
}
let changes = convert_apply_patch_hunks_to_protocol(&hunks);
self.last_progress = Some(hunks);
let event = PatchApplyUpdatedEvent { call_id, changes };
let now = Instant::now();
match self.last_sent_at {