The best way to control Claude Code, Codex and more from any computer or phone
fix(web): open files from Claude and ACP tool-call diffs (#29309)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Johan Vaz committed
Nov 4, 2026 at 07:12 UTC
300101f7e511a9a8e5ed71f69b776903b3aa9981
2 files changed
+51
-17
apps/web/src/diffFileActions.test.ts
+38
-16
@@ -69,23 +69,45 @@ describe("openDiffFilePrimaryAction", () => {
69
).toBe("index.ts");
70
});
71
72
- it.each(["backend/server.ts", "frontend2/app.ts", "frontend/../secret.ts", "C:secret.ts"])(
73
- "does not open an out-of-project diff path: %s",
74
- (filePath) => {
75
- const openInEditor = vi.fn();
76
-
77
- openDiffFilePrimaryAction({
78
- threadRef: THREAD_REF,
79
- filePath,
80
- activeCwd: "/repo/frontend",
81
- repositoryRoot: "/repo",
82
- openInEditor,
83
- });
84
-
72
+ it.each([
73
+ {
74
+ filePath: "/repo/frontend/src/index.ts",
75
+ workspaceRoot: "/repo/frontend",
76
+ expected: "src/index.ts",
77
+ },
78
+ { filePath: "c:\\Repo\\src\\index.ts", workspaceRoot: "C:\\repo", expected: "src/index.ts" },
79
+ ])(
80
+ "opens absolute diff paths inside the workspace: $filePath",
81
+ ({ filePath, workspaceRoot, expected }) => {
82
expect(
86
- selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, THREAD_REF),
87
- ).toMatchObject({ isOpen: false });
88
- expect(openInEditor).not.toHaveBeenCalled();
83
+ resolveDiffPathForWorkspace({ filePath, workspaceRoot, repositoryRoot: workspaceRoot }),
84
+ ).toBe(expected);
85
},
86
);
87
+
88
+ it.each([
89
+ "backend/server.ts",
90
+ "frontend2/app.ts",
91
+ "frontend/../secret.ts",
92
+ "C:secret.ts",
93
+ "/repo/backend/server.ts",
94
+ "/repo/frontend/../backend/server.ts",
95
+ "/repo/frontend",
96
+ "/etc/passwd",
97
+ ])("does not open an out-of-project diff path: %s", (filePath) => {
98
+ const openInEditor = vi.fn();
99
+
100
+ openDiffFilePrimaryAction({
101
+ threadRef: THREAD_REF,
102
+ filePath,
103
+ activeCwd: "/repo/frontend",
104
+ repositoryRoot: "/repo",
105
+ openInEditor,
106
+ });
107
+
108
+ expect(
109
+ selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, THREAD_REF),
110
+ ).toMatchObject({ isOpen: false });
111
+ expect(openInEditor).not.toHaveBeenCalled();
112
+ });
113
});
apps/web/src/diffFileActions.ts
+13
-1
@@ -1,5 +1,10 @@
1
import type { ScopedThreadRef } from "@t3tools/contracts";
2
-import { isWindowsAbsolutePath, normalizeProjectPathForComparison } from "@t3tools/shared/path";
2
+import {
3
+ isAbsolutePath,
4
+ isWindowsAbsolutePath,
5
+ normalizeProjectPathForComparison,
6
+ workspaceRelativeFilePath,
7
+} from "@t3tools/shared/path";
8
9
import { useRightPanelStore } from "./rightPanelStore";
10
import { resolvePathLinkTarget } from "@t3tools/shared/fileLinks";
@@ -52,6 +57,13 @@ export function resolveDiffPathForWorkspace(input: {
57
readonly workspaceRoot: string | undefined;
58
readonly repositoryRoot: string | undefined;
59
}): string | null {
60
+ // Claude and ACP tool-call diffs name files by absolute path.
61
+ if (isAbsolutePath(input.filePath)) {
62
+ const relativePath = workspaceRelativeFilePath(input.filePath, input.workspaceRoot);
63
+ const segments = relativePath === null ? null : normalizedRelativePathSegments(relativePath);
64
+ return segments ? segments.join("/") : null;
65
+ }
66
+
67
const fileSegments = normalizedRelativePathSegments(input.filePath);
68
if (!fileSegments) return null;
69