@devries-cameron20 / t3code-1 / commits / b6afe8109c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): home paths like ~/.claude/CLAUDE.md no longer show under the workspace folder (#39146)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Soroush Baraouf committed Nov 19, 2026 at 10:05 UTC b6afe8109cdcbedad7e638e8e5f7343a0f4e7290
5 files changed +140 -3
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+12
@@ -36,6 +36,7 @@ import {
36 resolveAssistantMessageCopyState,
37 type MessagesTimelineRow,
38 workEntryDisplayLabel,
39 + workEntryReadOutput,
40 } from "./MessagesTimeline.logic";
41 import { workEntryIconName } from "./TimelineWorkEntryRow.logic";
42
@@ -5158,3 +5159,14 @@ describe("isTimelineMinimapTurnVisible", () => {
5159 expect(isTimelineMinimapTurnVisible(10, 500, null, null)).toBe(false);
5160 });
5161 });
5162 +
5163 +describe("workEntryReadOutput", () => {
5164 + it("joins relative paths to the workspace root but keeps home paths as written", () => {
5165 + expect(
5166 + workEntryReadOutput(
5167 + { changedFiles: ["src/app.ts", "~/.claude/CLAUDE.md", "~\\.gitconfig"] },
5168 + "/workspace/t3code",
5169 + ),
5170 + ).toBe("/workspace/t3code/src/app.ts\n~/.claude/CLAUDE.md\n~/.gitconfig");
5171 + });
5172 +});
apps/web/src/components/chat/MessagesTimeline.logic.ts
+2 -2
@@ -79,7 +79,7 @@ import {
79 formatReadToolLabel,
80 formatSearchToolLabel,
81 } from "@t3tools/shared/toolActivityCopy";
82 -import { isWindowsAbsolutePath } from "@t3tools/shared/path";
82 +import { isHostPath } from "@t3tools/shared/path";
83
84 export function timelineEntryRunId(entry: TimelineEntry): RunId | null {
85 if (entry.kind === "message") {
@@ -231,7 +231,7 @@ export function workEntryReadOutput(
231 workEntryReadRawPaths(entry as WorkLogEntry)
232 .map((path) => {
233 const trimmed = path.trim().replaceAll("\\", "/");
234 - if (!workspaceRoot || trimmed.startsWith("/") || isWindowsAbsolutePath(trimmed)) {
234 + if (!workspaceRoot || isHostPath(trimmed)) {
235 return trimmed;
236 }
237 const root = workspaceRoot.replaceAll("\\", "/").replace(/\/+$/, "");
apps/web/src/filePathDisplay.test.ts
+9
@@ -13,4 +13,13 @@ describe("formatWorkspaceRelativePath", () => {
13 );
14 expect(formatWorkspaceRelativePath("src/app.ts", workspaceRoot)).toBe("t3code/src/app.ts");
15 });
16 +
17 + it("keeps home paths as written instead of labelling them as workspace paths", () => {
18 + expect(formatWorkspaceRelativePath("~/.claude/CLAUDE.md", "/workspace/t3code")).toBe(
19 + "~/.claude/CLAUDE.md",
20 + );
21 + expect(formatWorkspaceRelativePath("~\\.claude\\CLAUDE.md:3", "C:\\dev\\t3code")).toBe(
22 + "~/.claude/CLAUDE.md:3",
23 + );
24 + });
25 });
apps/web/src/filePathDisplay.ts
+2 -1
@@ -2,6 +2,7 @@ import { pipe } from "effect/Function";
2 import {
3 fileBasename,
4 stripSlashPrefixedWindowsDrive,
5 + isHostPath,
6 isWindowsAbsolutePath,
7 } from "@t3tools/shared/path";
8 import { formatFilePathPosition, splitFilePathPosition } from "@t3tools/shared/fileLinks";
@@ -46,7 +47,7 @@ export function formatWorkspaceRelativePath(
47 } else if (pathForCompare.startsWith(workspaceWithSeparator)) {
48 const relativeSuffix = normalizedPath.slice(normalizedWorkspaceRoot.length + 1);
49 displayPath = `${workspaceLabel}/${relativeSuffix}`;
49 - } else if (!normalizedPath.startsWith("/") && !isWindowsAbsolutePath(normalizedPath)) {
50 + } else if (!isHostPath(normalizedPath)) {
51 const relativePath = stripRelativePrefixes(normalizedPath);
52 displayPath = pathForCompare.startsWith(workspaceLabelWithSeparator)
53 ? normalizedPath
scripts/scenarios/home-path-tool-rows-show-as-written.e2e.ts new
+115
@@ -0,0 +1,115 @@
1 +// @effect-diagnostics nodeBuiltinImport:off -- The scenario stages a local ACP executable.
2 +import * as NodeFSP from "node:fs/promises";
3 +import * as NodePath from "node:path";
4 +
5 +import { expect } from "e2e";
6 +
7 +import { T3_HOME } from "../e2e.config.ts";
8 +import { makeState, runPromise, test, WEB } from "./t3.ts";
9 +
10 +const HOME_PATH = "~/.claude/CLAUDE.md";
11 +const REPLY = "Updated your global instructions.";
12 +const ACP = `
13 +import { createInterface } from "node:readline";
14 +
15 +const sessionId = "home-path-scenario";
16 +const path = ${JSON.stringify(HOME_PATH)};
17 +const send = (message) => process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...message }) + "\\n");
18 +const update = (value) => send({ method: "session/update", params: { sessionId, update: value } });
19 +for await (const line of createInterface({ input: process.stdin })) {
20 + const { id, method } = JSON.parse(line);
21 + if (id === undefined) continue;
22 + if (method === "initialize") {
23 + send({ id, result: { protocolVersion: 1, agentCapabilities: {}, authMethods: [] } });
24 + } else if (method === "session/new") {
25 + send({ id, result: { sessionId } });
26 + } else if (method === "session/prompt") {
27 + update({ sessionUpdate: "tool_call", toolCallId: "read", kind: "read", title: "Read", status: "pending", rawInput: { path } });
28 + update({
29 + sessionUpdate: "tool_call_update",
30 + toolCallId: "read",
31 + status: "completed",
32 + content: [{ type: "content", content: { type: "text", text: "# Global instructions" } }],
33 + });
34 + update({
35 + sessionUpdate: "tool_call",
36 + toolCallId: "edit",
37 + kind: "edit",
38 + title: "Edit global instructions",
39 + status: "completed",
40 + content: [{
41 + type: "diff",
42 + path,
43 + oldText: "# Global instructions\\n",
44 + newText: "# Global instructions\\nPrefer small diffs.\\n",
45 + changes: [{ operation: "update", path }],
46 + }],
47 + });
48 + update({ sessionUpdate: "agent_message_chunk", content: { type: "text", text: ${JSON.stringify(REPLY)} } });
49 + send({ id, result: { stopReason: "end_turn" } });
50 + } else {
51 + send({ id, error: { code: -32601, message: "Method not found" } });
52 + }
53 +}
54 +`;
55 +
56 +test(
57 + "Files an agent read and edited in the home folder show their ~/ paths, not paths under the project",
58 + WEB,
59 + async ({ t3, app, screen }) => {
60 + const project = await t3.project("demo");
61 + const script = NodePath.join(project, "home-path-acp.mjs");
62 + const settingsPath = NodePath.join(T3_HOME, "userdata/settings.json");
63 + const originalSettings = await NodeFSP.readFile(settingsPath, "utf8");
64 + const settings = JSON.parse(originalSettings);
65 + await NodeFSP.writeFile(script, ACP);
66 + settings.providerInstances["home-path-agent"] = {
67 + driver: "acpRegistry",
68 + displayName: "Home path agent",
69 + enabled: true,
70 + config: { source: "local", commandPath: process.execPath, commandArgs: [script] },
71 + };
72 + try {
73 + await NodeFSP.writeFile(settingsPath, JSON.stringify(settings));
74 + const { cli } = makeState(T3_HOME);
75 + // The watcher reloads settings asynchronously. Retry only before a thread was created.
76 + let threadId: string | undefined;
77 + for (let attempt = 0; attempt < 8 && threadId === undefined; attempt++) {
78 + const started = await runPromise(
79 + cli(
80 + [
81 + "thread",
82 + "start",
83 + project,
84 + "Tidy up my global instructions",
85 + "--title",
86 + "Home path tools",
87 + "--provider",
88 + "home-path-agent",
89 + "--model",
90 + "default",
91 + "--wait",
92 + "--json",
93 + ],
94 + [0, 1],
95 + ),
96 + );
97 + if (!started.stdout.includes("threadId")) continue;
98 + threadId = (JSON.parse(started.stdout) as { threadId: string }).threadId;
99 + }
100 + if (threadId === undefined) throw new Error("Could not start the home path turn.");
101 +
102 + await t3.open({ threadId });
103 + await screen.getByText(REPLY, { exact: true }).waitFor({ timeout: 60_000 });
104 + await screen.getByRole("button", "Worked for", { exact: false }).tap();
105 + await screen.getByRole("button", "Read 1 file and changed 1 file").tap();
106 + await screen.getByRole("button", /^Read .*CLAUDE\.md/).tap();
107 + await screen.getByText('"# Global instructions"', { exact: true }).waitFor();
108 + await app.screenshot("read-and-edit-rows");
109 + await expect(screen.getByText("/~/", { exact: false })).toHaveCount(0);
110 + await expect(screen.getByText(HOME_PATH, { exact: true })).toHaveCount(2);
111 + } finally {
112 + await NodeFSP.writeFile(settingsPath, originalSettings);
113 + }
114 + },
115 +);