fix(frontend): drive latest-edited symlink + open nested file links in Files - #5523
Conversation
…n Files Two drive UX bugs on the chat/config file surfaces: - The summary "latest edited files" fallback listed the cwd top level, which includes the `agent-files` fold SYMLINK — so it surfaced the bare symlink row instead of real files. The full drive already drops it; the summary didn't. Added one shared `isAgentFilesFold(path)` predicate, applied in the full drive and both summary lists so the fold marker is dropped consistently. - File mentions in a reply only opened in Files when written as inline code; a markdown link `[x](path)` went straight to a new tab, so nested / `NN-name/` paths (which the model tends to emit as links) never reached the resolver. `Anchor` now routes a RELATIVE href through the same file resolver: a real drive file becomes the in-Files chip, and a real URL / fragment / non-file falls back to the plain external link. Fixes #5480 Fixes #5481
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughMarkdown relative links can resolve through the active conversation drive, while external targets remain plain safe anchors. Session-drive listings and summaries now exclude the ChangesDrive-aware file navigation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ebef9fa5-550f-4ac4-baca-3f1fd2dd84b0
📒 Files selected for processing (2)
web/oss/src/components/AgentChatSlice/assets/markdown.tsxweb/oss/src/components/Drives/useSessionDrive.ts
Railway Preview Environment
Updated at 2026-07-29T13:16:46.860Z |
The summary's recents fallback listed only the cwd mount root, so the `agent-files` symlink surfaced as a row (#5480) with nothing behind it. Filtering that marker out of the record-log list alone missed the list that actually showed it, and would have left the agent's files absent entirely. Replace the fold-only predicate with one `isListableDrivePath` — runner plumbing plus the fold marker — used by every drive list AND by the `hasVisibleRecords` gate, so the gate can no longer withhold the fallback over a row the list then drops. List the agent mount's root alongside the cwd root, presented under `agent-files/` exactly as the full drive folds it, so dropping the marker surfaces the files it stood for instead of hiding them. Keep the markdown `components` map a module constant: adding the anchor inline rebuilt it every render, which the map is hoisted specifically to avoid on a renderer that re-renders per streamed token. Split the anchor so only a relative href subscribes to the drive resolver.
Context
Two drive file-surface bugs reported after 105.8.
The "latest edited files" list showed an
agent-filesrow instead of real files (#5480). The agent's durable mount is a separate mount, symlinked into the session cwd underagent-files. The summary surfaces list the cwd mount's top-level entries when the session record log holds no edits, and that listing includes the bare symlink, so the fold marker showed up as a row with nothing behind it.Clicking a file the agent mentioned only opened it in Files when the path was written as inline code (#5481). A markdown link opened a new tab instead. Nested and
NN-name/paths, which the model tends to render as links, always bypassed the file resolver.Changes
One predicate for "is this path listable".
isListableDrivePathanswers a single question for every drive surface: does this path belong in a user-facing list? It excludes runner plumbing (agents/,.agenta-*) and the bareagent-filesfold marker. Every list uses it, and so doeshasVisibleRecords, the gate that decides whether the fallback list runs at all. Previously the gate and the list it gates used different rules, so a record log holding only a hidden path could suppress the fallback and leave the surface reading "No files yet" over a drive full of files.The summary fallback now models the whole drive, not half of it. The full drive reads two mounts: the session cwd, plus the agent mount folded in under
agent-files/. The summary's fallback read only the cwd mount, which is why the symlink surfaced there and nowhere else. Dropping the marker on its own would have made things worse, since the agent's files would then be absent entirely. So the fallback lists the agent mount root alongside the cwd root, presented under the sameagent-files/prefix the full drive uses.resolveMountalready maps that prefix back to the agent mount, so the rows open normally.Before: fallback = the cwd top level, which contains the
agent-filessymlink and no agent files.After: fallback = the cwd top level without the marker, plus the agent mount's own top-level entries under
agent-files/.Cost stays constant. The extra call is one
depth=1delimiter listing, and it is gated off (disabled query) whenever the record log already carries listable changes, which is the common case on an active conversation.Markdown links route through the file resolver.
Anchorsends a relative href to the same resolver the inline-code path uses, so`03-gtm/plan.md`and[plan](03-gtm/plan.md)now behave identically. Ascheme:URL, a protocol-relative//host, a#fragment, or a relative path the resolver cannot confirm as a file all render as the plain external link, with the label preserved.The anchor is split in two so an ordinary URL costs nothing: only a relative href subscribes to the drive resolver atom. The
aentry lives in the hoistedMD_COMPONENTSconstant rather than being spread in at the call site, because this renderer re-renders on every throttled streaming token and the map is hoisted precisely to keep XMarkdown's prop identity stable.Where the "latest edited" list gets its data
Unchanged and worth restating, since it drives what you will see during QA. The primary source is the session record log, the agent's own write and edit tool events. The two-mount listing described above is the FALLBACK, used only when that log holds no listable change. So a session where the agent wrote files shows those files. A session with no recorded writes now shows the drive's real top-level contents from both mounts, where before it showed a bare
agent-filesrow.Tests
pnpm --filter @agenta/oss exec eslintclean on both touched files.tsc --noEmitreports no error referencing either touched file. The repo's existing error baseline is unchanged.What to QA
agent-filesrow. You see real files.agent-files/. Click one. It opens in Quick Look rather than erroring.03-gtm/plan.mdas a markdown link, click it. It opens in Files, not a new tab, when that file exists in the drive.https://...) in a reply still opens in a new tab. A made-up relative path stays a plain link with its original label.Fixes #5480
Fixes #5481