fix(web): resolve slashed file-chip paths through the workspace index #18358
Closedcbangera2(GitHub profile, opens in a new tab)wants to merge 16 commits into
main fromrefs/pull/18358/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelsmacroscope-review
coderabbitai[bot](GitHub profile, opens in a new tab) requested changes
apps/web/src/components/ChatMarkdown.tsx lines 2672 to 2687OutdatedResolvedby cbangera2(GitHub profile, opens in a new tab)@@ -2641,3 +2669,19 @@26412669 },26422670 [cwd, findWorkspaceBasenameMatch, revealFileInFileManager],26432671 );2672+ const openMarkdownFileInEditor = useCallback(2673+ async (fileLinkMeta: MarkdownFileLinkMeta) => {2674+ const workspaceRelativePath = fileLinkMeta.workspaceRelativePath;2675+ const match = workspaceRelativePath2676+ ? await findWorkspaceBasenameMatch(workspaceRelativePath)2677+ : null;2678+ if (!match || !cwd) {2679+ return openInPreferredEditor(fileLinkMeta.targetPath);2680+ }2681+ const withPosition = fileLinkMeta.line2682+ ? `${match}:${fileLinkMeta.line}${fileLinkMeta.column ? `:${fileLinkMeta.column}` : ""}`2683+ : match;2684+ return openInPreferredEditor(resolvePathLinkTarget(withPosition, cwd));2685+ },2686+ [cwd, findWorkspaceBasenameMatch, openInPreferredEditor],2687+ );coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
- apps/web/src/components/ChatMarkdown.tsx lines 2593 to 2598OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -2570,3 +2582,17 @@25702582 openPreview,25712583 });25722584 };2585+ const literalWorkspaceFileExists = async (workspaceRelativePath: string) => {2586+ if (!cwd || environmentId === null) {2587+ return false;2588+ }2589+ const result = await readWorkspaceFile({2590+ environmentId,2591+ input: { cwd, relativePath: workspaceRelativePath },2592+ });2593+ if (result._tag === "Success") return true;2594+ const cause = squashAtomCommandFailure(result);2595+ return (2596+ isProjectReadFileError(cause) &&2597+ (cause.failure === "binary_file" || cause.failure === "path_not_file")2598+ );
juliusmarminge assignedjuliusmarminge
- apps/web/src/components/ChatMarkdown.tsx line 771Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -748,3 +758,14 @@748758 return null;749759 }750760 const isBasename = needsWorkspaceBasenameLookup(workspaceRelativePath);761+ if (!isBasename) {762+ // Search can be truncated, still scanning, or skip ignored files, so it763+ // cannot rule out the literal path. A literal file always wins.764+ const metadata = await getFilesystemMetadata({765+ environmentId,766+ input: { paths: [resolveWorkspaceFilePath(workspaceRelativePath, cwd)] },767+ });768+ if (769+ metadata._tag !== "Success" ||770+ metadata.value.entries[0]?.kind === "file" ||771+ !readEnvironmentScope(environmentId, AuthFilesystemReadScope)
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
tanstack-source added labelsbug
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.




Approvability#
Verdict: Approved at
08d0f3eMacroscope's review found this PR approvable — This is a focused web file-chip bug fix that resolves unique slashed paths through the workspace index while preserving existing and ambiguous paths. The production changes are localized and covered by targeted action, permission, and cancellation tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).