From 396c8b542cb3c7027352652d7e81b82cf3ff29d0 Mon Sep 17 00:00:00 2001 From: AgentSeal Date: Fri, 24 Apr 2026 19:59:13 +0200 Subject: [PATCH] Fix Codex provider to detect file edits from patch_apply_end events Codex records file modifications as event_msg entries with type patch_apply_end rather than function_call tool invocations. This fix tracks those events and adds Edit to the tools list, enabling proper calculation of edit turns, one-shot rates, and retry rates. Fixes edit detection showing 0 edit turns despite actual file changes. --- src/providers/codex.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/providers/codex.ts b/src/providers/codex.ts index cd49c1a..2eac408 100644 --- a/src/providers/codex.ts +++ b/src/providers/codex.ts @@ -183,6 +183,11 @@ function createParser(source: SessionSource, seenKeys: Set): SessionPars continue } + if (entry.type === 'event_msg' && entry.payload?.type === 'patch_apply_end') { + pendingTools.push('Edit') + continue + } + if (entry.type === 'response_item' && entry.payload?.type === 'message' && entry.payload?.role === 'user') { const texts = (entry.payload.content ?? []) .filter(c => c.type === 'input_text')