fix(server): exclude between-turn edits from V2 turn diffs #10197
Closedemmsixx(GitHub profile, opens in a new tab)wants to merge 1 commit into
t3code/codex-turn-mapping fromrefs/pull/10197/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/orchestration-v2/CheckpointService.ts lines 323 to 326OutdatedResolvedby emmsixx(GitHub profile, opens in a new tab)@@ -299,6 +299,19 @@299+ yield* checkpointStore.captureCheckpoint({ cwd: input.scope.cwd, checkpointRef });299300 }300-301+ const startRef = checkpointStartRef(302+ checkpointRefForScopeOrdinal({303+ scopeId: input.scope.id,304+ ordinalWithinScope: input.ordinalWithinScope + 1,305+ }),306+ );307+ if (308+ yield* checkpointStore.hasCheckpointRef({309+ cwd: input.scope.cwd,310+ checkpointRef: startRef,311+ })312+ )313+ return;301314 yield* checkpointStore.captureCheckpoint({302315 cwd: input.scope.cwd,303- checkpointRef,316+ checkpointRef: startRef,304317 });
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/orchestration-v2/CheckpointCaptureService.ts line 270OutdatedResolvedby emmsixx(GitHub profile, opens in a new tab)@@ -227,3 +246,21 @@227246 });228247229248 return CheckpointCaptureServiceV2.of({249+ cleanupBaseline: Effect.fn("checkpoint.cleanupBaseline")(250+ function* (input) {251+ const projection = yield* projections.getThreadProjection(input.threadId);252+ const run = projection.runs.find((candidate) => candidate.id === input.runId);253+ const scope = projection.checkpointScopes.find(254+ (candidate) => candidate.id === input.scopeId,255+ );256+ if (run === undefined || scope === undefined) return;257+ // Never discard a baseline still needed by capture or a historical diff.258+ if (259+ !["completed", "interrupted", "failed", "cancelled", "rolled_back"].includes(run.status)260+ )261+ return;262+ const checkpoint = projection.checkpoints.find(263+ (candidate) =>264+ candidate.scopeId === scope.id && candidate.ordinalWithinScope === run.ordinal,265+ );266+ if (checkpoint?.status === "ready") return;
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XXL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
emmsixx(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Before — unpatched nightly#
An external commit adds two lines to README.md between turns. The next reply edits nothing, but incorrectly shows README.md +2.
After — patched V2#
The same external-commit scenario produces no changed-files card on the next no-edit reply.
Real edits still appear#
A subsequent agent edit correctly shows only notes.txt +1. The external README change is excluded.