Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Fix CWD override semantics and greedy regex in diff path parsing

Cursor Agentbb9371d3c950
diff --git a/apps/server/src/codexAppServerManager.ts b/apps/server/src/codexAppServerManager.ts
index 406a41a08..6122ec601 100644
--- a/apps/server/src/codexAppServerManager.ts
+++ b/apps/server/src/codexAppServerManager.ts
@@ -201,7 +201,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
const normalizedModel = normalizeCodexModelSlug(input.model);
const sessionOverrides = {
model: normalizedModel ?? null,
- cwd: resolvedCwd,
+ cwd: input.cwd ?? null,
approvalPolicy: input.approvalPolicy,
sandbox: input.sandboxMode,
};
diff --git a/apps/web/src/session-logic.test.ts b/apps/web/src/session-logic.test.ts
index 28768cc79..56ecd6afd 100644
--- a/apps/web/src/session-logic.test.ts
+++ b/apps/web/src/session-logic.test.ts
@@ -614,6 +614,18 @@ describe("deriveTurnDiffFilesFromUnifiedDiff", () => {
expect(files).toHaveLength(1);
expect(files[0]?.path).toBe("subdir b/example.ts");
});
+
+ it("parses git header fallback for binary diffs with ` b/` in path", () => {
+ const files = deriveTurnDiffFilesFromUnifiedDiff(
+ [
+ "diff --git a/subdir b/image.png b/subdir b/image.png",
+ "Binary files a/subdir b/image.png and b/subdir b/image.png differ",
+ ].join("\n"),
+ );
+
+ expect(files).toHaveLength(1);
+ expect(files[0]?.path).toBe("subdir b/image.png");
+ });
});
describe("derivePendingApprovals", () => {
diff --git a/apps/web/src/session-logic.ts b/apps/web/src/session-logic.ts
index 224d5f129..c3fb15558 100644
--- a/apps/web/src/session-logic.ts
+++ b/apps/web/src/session-logic.ts
@@ -522,8 +522,8 @@ function parsePathFromDiff(diff: string): string | undefined {
const normalized = diff.replace(/\r\n/g, "\n");
const bPath = normalized.match(/^\+\+\+ b\/(.+)$/m);
if (bPath && bPath[1]) return bPath[1];
- const gitHeader = normalized.match(/^diff --git a\/(.+) b\/(.+)$/m);
- if (gitHeader && gitHeader[2]) return gitHeader[2];
+ const gitHeader = normalized.match(/^diff --git a\/(.+) b\/\1$/m);
+ if (gitHeader && gitHeader[1]) return gitHeader[1];
const direct = normalized.match(/^\+\+\+ (.+)$/m);
if (!direct || !direct[1] || direct[1] === "/dev/null") {
return undefined;