[AGE-4116] fix(frontend): stop bare filename mentions in chat from linking to the wrong file - #6008
Conversation
…cords Regression tests for AGE-4116 / #6004.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change exports ChangesFile Reference Verification
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The change makes bare filename mentions verify the exact path before linking and includes coverage for nested, root-level, and unmatched files; no actionable merge-blocking risk remains beyond normal checks. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d678972dd9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Railway Preview Environment
Updated at 2026-08-13T11:38:52.769Z |
Summary
A chat mention like
`README.md`was treated as a known, linkable file whenever ANY file with that basename existed anywhere in the session, even if the real file lived in a subfolder (e.g.notes/README.md). Clicking the mention opened the wrong path and showed "Couldn't load this file's content" (#6004).The root cause is in
knownFromRecords(chatFileRefs.tsx): it tail-matched the raw mention text against every file the agent had written, so a bare basename always matched the first written file sharing that name, regardless of where it actually lived. The fix stops bare (no/) mentions from taking that unverified shortcut. They now always go through the existing on-demand path, which reads the real file at that exact location and only renders a link when it actually resolves.Testing
Verified locally
localhost:3000: creatednotes/README.md, got the agent to reference it by bare filename, confirmed the mention now renders as plain text instead of a broken link.Added or updated tests
chatFileRefs.test.ts: unit tests onknownFromRecordscovering the false-positive case (nested file, bare mention), a still-working qualified mention, a mount-root file correctly deferring to on-demand verification, and an unmatched mention.QA follow-up
Demo
Checklist