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 {