The best way to control Claude Code, Codex and more from any computer or phone
Fix CWD override semantics and greedy regex in diff path parsing
- Restore null CWD in sessionOverrides for thread/start and thread/resume so the Codex app server can distinguish 'no override' from an explicit path (e.g., to reuse a resumed thread's original CWD). - Use backreference in diff --git fallback regex to correctly parse paths containing ' b/' (e.g., binary diffs without +++ b/ lines). - Add test exercising the git header fallback for binary diffs with ' b/' in the path. Applied via @cursor push command
Cursor Agent committed
Feb 19, 2026 at 04:19 UTC
bb9371d3c9500bf035b7df5da0969b82aac5a1fc
3 files changed
+15
-3
apps/server/src/codexAppServerManager.ts
+1
-1
@@ -201,7 +201,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
201
const normalizedModel = normalizeCodexModelSlug(input.model);
202
const sessionOverrides = {
203
model: normalizedModel ?? null,
204
- cwd: resolvedCwd,
204
+ cwd: input.cwd ?? null,
205
approvalPolicy: input.approvalPolicy,
206
sandbox: input.sandboxMode,
207
};
apps/web/src/session-logic.test.ts
+12
@@ -614,6 +614,18 @@ describe("deriveTurnDiffFilesFromUnifiedDiff", () => {
614
expect(files).toHaveLength(1);
615
expect(files[0]?.path).toBe("subdir b/example.ts");
616
});
617
+
618
+ it("parses git header fallback for binary diffs with ` b/` in path", () => {
619
+ const files = deriveTurnDiffFilesFromUnifiedDiff(
620
+ [
621
+ "diff --git a/subdir b/image.png b/subdir b/image.png",
622
+ "Binary files a/subdir b/image.png and b/subdir b/image.png differ",
623
+ ].join("\n"),
624
+ );
625
+
626
+ expect(files).toHaveLength(1);
627
+ expect(files[0]?.path).toBe("subdir b/image.png");
628
+ });
629
});
630
631
describe("derivePendingApprovals", () => {
apps/web/src/session-logic.ts
+2
-2
@@ -522,8 +522,8 @@ function parsePathFromDiff(diff: string): string | undefined {
522
const normalized = diff.replace(/\r\n/g, "\n");
523
const bPath = normalized.match(/^\+\+\+ b\/(.+)$/m);
524
if (bPath && bPath[1]) return bPath[1];
525
- const gitHeader = normalized.match(/^diff --git a\/(.+) b\/(.+)$/m);
526
- if (gitHeader && gitHeader[2]) return gitHeader[2];
525
+ const gitHeader = normalized.match(/^diff --git a\/(.+) b\/\1$/m);
526
+ if (gitHeader && gitHeader[1]) return gitHeader[1];
527
const direct = normalized.match(/^\+\+\+ (.+)$/m);
528
if (!direct || !direct[1] || direct[1] === "/dev/null") {
529
return undefined;