Skip to content

fix(web): repo-root-relative file chips open in subfolder projects - #14510

Open
Gigioxx wants to merge 3 commits into
pingdotgg:mainfrom
Gigioxx:fix/repo-relative-file-chips
Open

Gigioxx wants to merge 3 commits into
pingdotgg:mainfrom
Gigioxx:fix/repo-relative-file-chips

Conversation

@Gigioxx

@Gigioxx Gigioxx commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Note

🤖 Claude Opus 5.5 on behalf of Guille

Fixes #14492 (triaged by Julius). Replaces #14506, which was closed for missing UI evidence.

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 opens physics/physics/notes/outline.md and the files panel fails with Failed to read workspace file 'physics/notes/outline.md'.

When a slashed chip's leading segments repeat the project folder's trailing segments (physics/… inside …/physics), clicking it now asks the workspace index. Bare filenames already use this lookup. The chip opens the stripped path (notes/outline.md) only when that file exists and the literal path does not, so a real physics/physics/... folder still wins. Windows paths compare case-insensitively and with either separator.

This follows the triage note: it checks which candidate exists instead of stripping blindly, and it does not depend on repositoryIdentity.rootPath, which is null for repos without a remote. "Reveal in file manager" shares the lookup, so it is fixed too.

Verification

Reproduced in vp run dev (worktree state) in an isolated Playwright Chromium. Setup: a remote-less git repo at /tmp/t3repro/school with physics/notes/outline.md committed, the project registered at /tmp/t3repro/school/physics, and a seeded assistant message containing physics/notes/outline.md.

Before (main): the chip opens physics > physics > notes > outline.md and the read fails.

After: the same chip opens physics > notes > outline.md with the file contents.

Real nested folder: after creating physics/physics/notes/outline.md in the project, the chip opens that nested file, not the stripped one.

  • vp test run apps/web/src/workspaceBasenameLookup.test.ts: 15 passed, including prefix stripping, nested-folder precedence, and Windows casing
  • vp lint and vp fmt --check on the changed files; typecheck left to CI

Not checked: Windows itself (unit tests only), desktop and remote connections (same web code path). Unchanged: the chip label, tooltip, and copy-path actions still show the joined path. Mobile is also unchanged, because its chips have no workspace lookup to reuse. A literal file that is gitignored, and so missing from the index, could still lose to a tracked stripped twin.

Made with Claude Opus 5.5 in Claude Code (T3 Code).

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Oct 1, 2026
Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 60499a4

Macroscope's review found this PR approvable — This is a narrowly scoped web bug fix that adds indexed resolution for duplicated repo-root-relative paths while preserving existing fallback behavior and covering the new logic with tests. An unresolved High-severity Windows casing finding remains a blocking correctness risk under the repository’s review policy.

Notes:

  • This verdict was updated automatically after the outstanding correctness findings were resolved. Macroscope did not re-review the code.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 0878da61-f756-4659-95e8-770a3add3949

📥 Commits

Reviewing files that changed from the base of the PR and between 2fba743 and 60499a4.

📒 Files selected for processing (3)
  • apps/web/src/components/ChatMarkdown.tsx
  • apps/web/src/workspaceBasenameLookup.test.ts
  • apps/web/src/workspaceBasenameLookup.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Workspace file lookup now handles bare filenames and paths that repeat the workspace directory prefix. File-panel opens use this lookup when needed and open other paths directly.

Changes

Workspace file lookup

Layer / File(s) Summary
Repeated-prefix normalization
apps/web/src/workspaceBasenameLookup.ts, apps/web/src/workspaceBasenameLookup.test.ts
Adds a helper to strip repeated workspace-directory prefixes. Tests cover slash styles, Windows-style case differences, and paths that do not match.
File-panel path lookup
apps/web/src/components/ChatMarkdown.tsx, apps/web/src/workspaceBasenameLookup.ts, apps/web/src/workspaceBasenameLookup.test.ts
Lookup now handles bare basenames and repeated-prefix paths. It preserves literal indexed paths and returns no match when lookup fails. Tests cover path selection and platform-specific casing.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 60499

The change adds lookup for repeated project prefixes while preserving indexed literal paths. No concrete merge-blocking issue is established; merge after normal checks pass.

Architecture Summary

Architecture risk: 🟡 Medium · up to 2fba7

The change affects 1 system.

Changed systems: apps/web

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — apps/web (ui) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/web/src/components/ChatMarkdown.tsx: Adds stripRepeatedWorkspacePrefix to the workspace basename lookup imports.
  • observed — Modified behavior in apps/web/src/components/ChatMarkdown.tsx: findWorkspaceBasenameMatch now searches for both bare basenames and paths with repeated workspace prefixes. It strips repeated prefixes before querying; for basename lookups it selects a matching entry, and for stripped paths it returns the stripped path only when the index contains it and does not contain the original literal path. Search failures or invalid paths return no match. The adjacent comment now also identifies repo-root-relative paths as lookup cases.
  • observed — Modified behavior in apps/web/src/components/ChatMarkdown.tsx: openFileInPanel now performs lookup when the path is a basename or has a repeated workspace prefix. Paths that are neither, and paths without a working directory, continue to open directly.
  • observed — Modified behavior in apps/web/src/workspaceBasenameLookup.test.ts: The test file adds stripRepeatedWorkspacePrefix to its imports.

Reliability and maintainability

  • inferred — Risk-relevant change factors for apps/web: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: repo-root-relative file chips now open correctly in subfolder projects.
Description check ✅ Passed The description explains the problem, change, scope, issue reference, verification steps, screenshots, test results, limitations, and agent usage. It does not use every template heading, but it provid…
Linked Issues check ✅ Passed Issue #14492 requires web file chips to resolve repository-root-relative paths in subfolder projects. ChatMarkdown.tsx uses the new workspace lookup for chat and file-panel opens. `stripRepeatedWork…
Out of Scope Changes check ✅ Passed The changed files implement and test the web behavior required by issue #14492. No unrelated production changes are identified. Mobile remains unchanged, which is within the stated web scope.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 1, 2026 — with ChatGPT Codex Connector

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Repo-root-relative file paths in agent output break when the project is a subfolder of the git repo

2 participants