Skip to content

Commit aacd1ee

Browse files
only21milclaudecodex
authored
fix(codex): keep every path of a multi-file patch (pingdotgg#22541)
Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: GPT-6.1 Sol <[email protected]>
1 parent 370b9ae commit aacd1ee

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6098,5 +6098,34 @@ describe("CodexAdapterV2 post-settle continuation", () => {
60986098
),
60996099
),
61006100
);
6101+
6102+
it.effect("keeps every path of a completed multi-file patch", () =>
6103+
Effect.gen(function* () {
6104+
const { harness } = yield* startApprovalTurn("file-change-multi-path", [
6105+
fileChange("started", nativeTurnId, "patch-a", [renameC, deleteE, addA]),
6106+
fileChange("completed", nativeTurnId, "patch-a", [renameC, deleteE, addA]),
6107+
turnCompleted(nativeTurnId),
6108+
]);
6109+
yield* harness.firstTerminal;
6110+
6111+
const fileChanges = harness.events.flatMap((event) =>
6112+
event.type === "turn_item.updated" && event.turnItem.type === "file_change"
6113+
? [event.turnItem]
6114+
: [],
6115+
);
6116+
assert.lengthOf(fileChanges, 1);
6117+
assert.equal(fileChanges[0]?.fileName, "/w/c.ts");
6118+
assert.deepEqual(fileChanges[0]?.changes, [
6119+
{ operation: "update", path: "/w/d.ts", oldPath: "/w/c.ts" },
6120+
{ operation: "delete", path: "/w/e.ts" },
6121+
{ operation: "add", path: "/w/a.ts" },
6122+
]);
6123+
}).pipe(
6124+
Effect.scoped,
6125+
Effect.provide(
6126+
Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),
6127+
),
6128+
),
6129+
);
61016130
});
61026131
});

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,6 +3635,12 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
36353635
type: "file_change",
36363636
fileName: firstChange.path,
36373637
diffStr: firstChange.diff,
3638+
changes: item.changes.map((change) => {
3639+
const movePath = change.kind.type === "update" ? change.kind.move_path : undefined;
3640+
return movePath
3641+
? { operation: change.kind.type, path: movePath, oldPath: change.path }
3642+
: { operation: change.kind.type, path: change.path };
3643+
}),
36383644
};
36393645
return { node, turnItem };
36403646
},

0 commit comments

Comments
 (0)