From ebd79231a5ae88daabd722e2ae653b6c52096ef5 Mon Sep 17 00:00:00 2001 From: Akshay Nathan Date: Thu, 30 Apr 2026 14:04:40 -0700 Subject: [PATCH] Avoid duplicate apply_patch progress events --- codex-rs/core/src/tools/handlers/apply_patch.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/codex-rs/core/src/tools/handlers/apply_patch.rs b/codex-rs/core/src/tools/handlers/apply_patch.rs index d71eb7931a..ce869106c3 100644 --- a/codex-rs/core/src/tools/handlers/apply_patch.rs +++ b/codex-rs/core/src/tools/handlers/apply_patch.rs @@ -56,6 +56,7 @@ pub struct ApplyPatchHandler; #[derive(Default)] struct ApplyPatchArgumentDiffConsumer { parser: StreamingPatchParser, + last_progress: Option>, last_sent_at: Option, pending: Option, } @@ -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 {