The best way to control Claude Code, Codex and more from any computer or phone
fix(codex): keep every path of a multi-file patch (#22541)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: GPT-6.1 Sol <noreply@openai.com>
Victor Vogel committed
Oct 21, 2026 at 08:16 UTC
aacd1ee33779c986831c74aee274cb4694dcd900
2 files changed
+35
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+29
@@ -6098,5 +6098,34 @@ describe("CodexAdapterV2 post-settle continuation", () => {
6098
),
6099
),
6100
);
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
+ );
6130
});
6131
});
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+6
@@ -3635,6 +3635,12 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
3635
type: "file_change",
3636
fileName: firstChange.path,
3637
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
+ }),
3644
};
3645
return { node, turnItem };
3646
},