Repository navigation
Conversation
| for (let count = Math.min(cwdSegments.length, pathSegments.length - 1); count > 0; count--) { | ||
| const prefix = cwdSegments.slice(-count); | ||
| if (prefix.every((segment, index) => segment === pathSegments[index])) { | ||
| return pathSegments.slice(count).join("/"); |
There was a problem hiding this comment.
🟠 High src/workspaceBasenameLookup.ts:67
A Windows path such as physics\notes\a.md is not matched against the workspace index's physics/notes/a.md, so paths.has(workspaceRelativePath) incorrectly reports the literal file as absent and may open notes/a.md instead. The slash normalization here only affects the stripped return value; normalize workspaceRelativePath before the lookup or use the normalized value consistently.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/workspaceBasenameLookup.ts around line 67:
A Windows path such as `physics\notes\a.md` is not matched against the workspace index's `physics/notes/a.md`, so `paths.has(workspaceRelativePath)` incorrectly reports the literal file as absent and may open `notes/a.md` instead. The slash normalization here only affects the stripped return value; normalize `workspaceRelativePath` before the lookup or use the normalized value consistently.
| const isBasename = needsWorkspaceBasenameLookup(workspaceRelativePath); | ||
| const strippedPath = isBasename | ||
| ? null | ||
| : stripRepeatedWorkspacePrefix(workspaceRelativePath, cwd); |
There was a problem hiding this comment.
🟠 High components/ChatMarkdown.tsx:2567
On case-insensitive Windows workspaces, stripRepeatedWorkspacePrefix fails to match a repo-relative path such as physics\notes\outline.md against C:\school\Physics, so the lookup is skipped and the panel opens the duplicated Physics\physics\notes\outline.md path. Make the prefix comparison case-insensitive for Windows paths so normal casing variations are stripped.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/ChatMarkdown.tsx around line 2567:
On case-insensitive Windows workspaces, `stripRepeatedWorkspacePrefix` fails to match a repo-relative path such as `physics\notes\outline.md` against `C:\school\Physics`, so the lookup is skipped and the panel opens the duplicated `Physics\physics\notes\outline.md` path. Make the prefix comparison case-insensitive for Windows paths so normal casing variations are stripped.
|
Note This comment is posted by Julius' dot Closing for missing UI verification. The reproduction notes and 12 focused tests help, but this changes file-chip click and reveal behavior without before/after screenshots or an interaction recording. Please attach those captures showing the repeated-prefix path opening the intended file and a real nested folder still taking precedence, then request reconsideration. |
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a small, self-contained web bug fix that adds a bounded workspace-index lookup for duplicated repo-relative file paths while preserving existing fallback behavior. Separate high-severity findings identify Windows path-handling risks that must be resolved by the correctness review process. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
[claude-opus-5-5] Responding on behalf of GuilleReplaced by #14510, which adds before/after screenshots and the nested-folder case. It also fixes the two Windows findings from Macroscope. |
Note
🤖 Claude Opus 5.5 on behalf of Guille
Fixes #14492.
When a project is a subfolder of its git repo (repo at
~/school, project at~/school/physics), agents often print paths the way git does, relative to the repo root:physics/notes/outline.md. The chip joins that onto the project root, so clicking it opensphysics/physics/notes/outline.mdand the files panel fails withFailed to read workspace file 'physics/notes/outline.md'.Clicking a slashed chip now checks whether its leading segments repeat the project folder's own trailing segments (
physics/…inside…/physics). If so, it asks the workspace index, the same lookup bare filenames already use, and opens the stripped path (notes/outline.md) only when that file exists and the literal path does not. A realphysics/physics/...folder still opens as written.This does not use
repositoryIdentity.rootPath, which is missing for repos without a remote. It also covers "Reveal in file manager", which shares the lookup. The chip label, tooltip, and copy actions still show the joined path; mobile is unchanged since its chips have no workspace lookup yet.Verification
/tmp/schooland the project at/tmp/school/physics: onmainthe chip openedphysics > physics > notes > outline.mdwith the read error. With this change it opensphysics > notes > outline.mdand shows the file.physics/physics/notes/outline.mdpresent, the chip still opens that nested file.vp test run apps/web/src/workspaceBasenameLookup.test.ts(12 passed)vp lint,vp fmt --checkon the changed files, webtsc --noEmitMade with Claude Opus 5.5 in Claude Code (T3 Code).