Skip to content

Commit 821239a

Browse files
fix: explicit file links skip the workspace lookup
Mobile checked lookup eligibility on the resolved relative path, which drops an authored ./ or absolute form, so ./src/config.ts could open another package's src/config.ts. The eval grader also kept #L4 on the lookup path and counted working links as broken. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 75a2f2a commit 821239a

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2894,7 +2894,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
28942894
props.workspaceRoot &&
28952895
relativePath &&
28962896
!/[\\/]$/.test(presentation.path) &&
2897-
workspaceLinkLookupQuery(relativePath, props.workspaceRoot) !== null &&
2897+
workspaceLinkLookupQuery(presentation.path, props.workspaceRoot) !== null &&
28982898
readEnvironmentScope(props.environmentId, AuthFilesystemReadScope)
28992899
) {
29002900
const workspaceRoot = props.workspaceRoot;

‎evals/mcp-tool-use/file-link-grading.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ it("grades pills the way chat resolves them against the thread cwd", () => {
1818
"`packages/server/src/cloud/http.ts:6` and `cloud/http.ts:6`",
1919
"`ws.ts:3`, `index.ts:5`, `src/index.ts`, `src/worker.ts`",
2020
"[worker.ts](/home/user/work/worker/src/worker.ts)",
21+
"[http](cloud/http.ts#L4), [ws](./ws.ts)",
2122
"`/usr/bin/node`, `git rebase --onto`",
2223
].join("\n");
2324
const pills = Object.fromEntries(
@@ -29,6 +30,8 @@ it("grades pills the way chat resolves them against the thread cwd", () => {
2930
"packages/server/src/cloud/http.ts:6": true,
3031
"cloud/http.ts:6": true,
3132
"ws.ts:3": true,
33+
"cloud/http.ts#L4": true,
34+
"./ws.ts": false,
3235
"index.ts:5": false,
3336
"src/index.ts": false,
3437
"src/worker.ts": false,

‎evals/mcp-tool-use/file-link-grading.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
extractInlineCodeSpans,
55
extractMarkdownLinkHrefs,
66
inlineCodeFilePathCandidate,
7+
parseMarkdownFileLink,
78
resolveMarkdownFileLinkTarget,
89
} from "@t3tools/shared/markdownLinks";
910
import {
@@ -37,7 +38,7 @@ export const fileLinkPills = (
3738
const path = splitFilePathPosition(target).path.replace(/\/+$/, "");
3839
// System paths such as /usr/bin/node are not what these cases test.
3940
if (!/^\/(?:home|Users)\//.test(path)) return [];
40-
const relative = splitFilePathPosition(source).path;
41+
const relative = parseMarkdownFileLink(source)?.path ?? path;
4142
const entries = files.flatMap((file) =>
4243
file.startsWith(`${cwd}/`)
4344
? [{ path: file.slice(cwd.length + 1), kind: "file" as const }]

0 commit comments

Comments
 (0)