Skip to content

fix(frontend): drive latest-edited symlink + open nested file links in Files - #5523

Merged
bekossy merged 4 commits into
release/v0.106.1from
fe-fix/drive-bugs
Jul 29, 2026
Merged

fix(frontend): drive latest-edited symlink + open nested file links in Files#5523
bekossy merged 4 commits into
release/v0.106.1from
fe-fix/drive-bugs

Conversation

@ardaerzin

@ardaerzin ardaerzin commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Context

Two drive file-surface bugs reported after 105.8.

The "latest edited files" list showed an agent-files row instead of real files (#5480). The agent's durable mount is a separate mount, symlinked into the session cwd under agent-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". isListableDrivePath answers a single question for every drive surface: does this path belong in a user-facing list? It excludes runner plumbing (agents/, .agenta-*) and the bare agent-files fold marker. Every list uses it, and so does hasVisibleRecords, 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 same agent-files/ prefix the full drive uses. resolveMount already maps that prefix back to the agent mount, so the rows open normally.

Before: fallback = the cwd top level, which contains the agent-files symlink 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=1 delimiter 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. Anchor sends 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. A scheme: 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 a entry lives in the hoisted MD_COMPONENTS constant 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-files row.

Tests

  • pnpm --filter @agenta/oss exec eslint clean on both touched files.
  • tsc --noEmit reports no error referencing either touched file. The repo's existing error baseline is unchanged.

What to QA

  • Open the config Files section or the chat Files rail on a session where the agent worked. There is no agent-files row. You see real files.
  • Do the same on a session where the agent wrote nothing. The list shows the drive's top-level files, including the agent mount's files listed under agent-files/. Click one. It opens in Quick Look rather than erroring.
  • In a reply that references a nested file such as 03-gtm/plan.md as a markdown link, click it. It opens in Files, not a new tab, when that file exists in the drive.
  • Regression: a real external link (https://...) in a reply still opens in a new tab. A made-up relative path stays a plain link with its original label.
  • Regression: streaming a long reply still feels the same. The link change touches the shared markdown renderer.

Fixes #5480
Fixes #5481

…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
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 29, 2026 11:25am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a120dc48-2934-4daf-bdf5-091b77ef83c6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Markdown relative links can resolve through the active conversation drive, while external targets remain plain safe anchors. Session-drive listings and summaries now exclude the agent-files fold-point and include agent-root fallback entries.

Changes

Drive-aware file navigation

Layer / File(s) Summary
Markdown link resolution
web/oss/src/components/AgentChatSlice/assets/markdown.tsx
Classifies external targets and resolves relative paths through the conversation drive’s file-link resolver when available.
Session-drive path filtering and summaries
web/oss/src/components/Drives/useSessionDrive.ts
Adds normalized listable-path filtering, excludes the agent-files fold-point, combines cwd and agent-root fallback entries, and tracks agent-root fetching.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main frontend drive fixes in the PR.
Description check ✅ Passed The description matches the implemented changes and the linked bugs.
Linked Issues check ✅ Passed The changes address #5480 by filtering agent-files and #5481 by resolving relative file links in chat.
Out of Scope Changes check ✅ Passed The PR stays within scope; the added logic supports the two reported drive/file-link fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fe-fix/drive-bugs

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.

❤️ Share

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

@ardaerzin
ardaerzin marked this pull request as ready for review July 29, 2026 07:08
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Frontend labels Jul 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a3e7fdf and 38172e1.

📒 Files selected for processing (2)
  • web/oss/src/components/AgentChatSlice/assets/markdown.tsx
  • web/oss/src/components/Drives/useSessionDrive.ts

Comment thread web/oss/src/components/Drives/useSessionDrive.ts Outdated
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

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.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jul 29, 2026
@ardaerzin
ardaerzin changed the base branch from main to release/v0.106.1 July 29, 2026 07:57
@ardaerzin
ardaerzin requested a review from ashrafchowdury July 29, 2026 07:58
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 29, 2026
@bekossy
bekossy merged commit 6c83e92 into release/v0.106.1 Jul 29, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Not all files in chat can be opened directly in the files when clicking on them [bug] Latest edited files view shows agent-files symlink

3 participants