Repository navigation
Open local file links from chat replies in the Aiden browser and Files - #566
Conversation
Agent replies often link files as file:// URLs, absolute paths, or name.ext:12. react-markdown's default URL sanitizer blanked file: hrefs, and the link router only handled relative .html/.pdf paths, so clicking most file links did nothing. - markdown: keep file: and name.ext:12 link targets - router: file:// URLs, absolute and relative paths of any type become file routes with a workspace-relative path; line suffixes are dropped - opener: HTML/PDF preview in the Aiden browser, other files open in the Files editor, folders expand in the Files tree, and files outside the workspace show a notice instead of failing silently - docs and link-opening notes updated; router, provider and e2e tests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LtHWujhdbTBrQC56sMBXMR
There was a problem hiding this comment.
Important
Folder links can open an error instead of expanding the folder when Files has a cached index. This should be addressed before merging.
Reviewed changes Reviewed local-file link sanitization, path classification, browser/Files dispatch, and directory reveal behavior, including downstream preview confinement and the added tests.
- Local link parsing: Preserves
file:and file-and-line Markdown targets and resolves workspace-relative paths for local files and folders. - Opening destinations: Routes HTML/PDF to the Aiden browser and other workspace paths to Files, with feedback for unsupported outside-workspace paths.
- Folder reveal: Expands and focuses directory entries in Files; adds routing/provider tests, an Electron E2E scenario, and documentation.
Validation: 74 focused tests passed. A separate mounted-component probe reproduced the cached-index folder failure described inline. Electron E2E was not run on this Linux runner because the fixture requires macOS.
gpt-6.1-sol | 𝕏
very-hermes-bot
left a comment
There was a problem hiding this comment.
Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.
Hermes Review BotConfidence: 5 Engine: SummaryChat replies from agents frequently include references to created or inspected files ( Confidence Score: 5/5Fully traced and verified end-to-end: verified Markdown sanitization logic, router pathname normalization, Files panel index refresh state machine, IPC security invariants, and unit/e2e test coverage. 📁 Important Files Changed
FindingsNo findings. 📊 Sequence DiagramsequenceDiagram
autonumber
actor User
participant LinkOpener as LinkOpenerProvider
participant Browser as Browser Service
participant Files as FilesPanel
participant Main as Main Process (IPC)
participant OS as Operating System
User->>LinkOpener: Click local file link in chat
alt Preview file (HTML / PDF)
LinkOpener->>Browser: open_file (browser:command)
Browser-->>User: Preview document in Aiden browser tab
else Workspace file / folder
LinkOpener->>Files: onOpenWorkspaceFile(workspacePath)
Files-->>User: Focus/expand folder tree or open editor
else Right-click -> "Open in system browser"
LinkOpener->>Main: browser:open-file-external(workspaceId, path)
Main->>Main: resolveExternalWorkspaceDocument(realpath verification)
Main->>OS: shell.openPath(target)
OS-->>User: Open document in OS default app
end
Machine-Readable Findings[]
|
|
Desktop tests (renderer-other) failed on c4216fe with one test, I don't think this PR caused it. The diff doesn't touch the remote Bot chat view or its stream handling; it only changes the Markdown URL transform for Generated by Claude Code |
A link to a folder created after Files loaded its index was read as a file and the request consumed before the refresh arrived. Refresh once when the index doesn't list the path and decide on the fresh result. The e2e spec now clicks the folder link before style.css so the folder assertion doesn't pass from expandAncestors alone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LtHWujhdbTBrQC56sMBXMR
On the test window the floating environment panel covers the transcript, so the style.css link click was intercepted after the browser opened. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LtHWujhdbTBrQC56sMBXMR
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the two follow-up commits since the prior Pullfrog review, focusing on stale-index request handling and the revised end-to-end scenario.
- Fixed folder classification: Waited for index loading and refreshed unlisted paths before consuming their requests, preventing newly created folders from being read as files.
- Added behavioral coverage: Tested deferred folder discovery and immediate opening of already indexed files, and registered the suite in
test:browser. - Strengthened E2E checks: Opened the folder before its child file, verified folder focus, and closed the floating panel between chat-link clicks to prevent interception.
Validation: 29 focused tests passed, along with application and E2E type-checks and targeted ESLint. A separate mounted-component probe also confirmed the original hidden-panel reactivation failure is fixed. Electron E2E execution remains unverified locally because its fixture requires macOS.
gpt-6.1-sol | 𝕏
File links get their own context menu: Open in Aiden browser (HTML/PDF) or Open in Files, Open in system browser for workspace HTML (default app for PDF), and Copy path. browser:open-file-external accepts only HTML or PDF regular files that still resolve inside the workspace and hands them to shell.openPath. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LtHWujhdbTBrQC56sMBXMR
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed 8d0a8c0 since the prior Pullfrog review, focusing on file-link context menus and the new desktop file-opening IPC.
- Added file-link menus: Offered Aiden previews or Files navigation, OS opening for workspace HTML/PDF documents, and path copying while retaining existing web-link actions.
- Confined external documents: Added active-document and workspace-access checks, canonical-path containment, symlink-escape rejection, regular-file and extension validation, and OS error reporting.
- Extended coverage and documentation: Added context-menu and filesystem-resolver tests and documented the new actions.
Validation: 32 focused behavior tests, 11 IPC contract checks, and 15 CI-inventory checks passed, along with application type-checking and targeted ESLint. Actual OS application launching and Electron E2E were not exercised on this Linux runner.
gpt-6.1-sol | 𝕏
…the Bots branch Brings in chat file links that open in Aiden Browser or Files (#566) and the iOS paced streaming and Markdown tail healing (#572). - ios/CHANGELOG.md: union of both sides (the rev 37 Bots entry, then main's "Smoother chat streaming"). - docs/environment-browser.md: the Bot browser's "Where it shows" row now says chat links never open in a Bot's browser, web links go to the system browser, and local file links don't open on a Bot's page. - .memory/link-opening.md: notes the Bot boundary for the new file routes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FTLKrZsPKZM2hnxHVxEnak
The partial "Looking at your calendar" has no block boundary, so the streaming reveal holds it for STREAMING_REVEAL_MAX_WAIT_MS (1s), the same second findByText waits by default. The test passed only while the reveal's timer fired a few milliseconds before the wait gave up, and failed on a busy CI runner (here and on #566). The test is about live frames reaching the chat, not the reveal's pacing, so it turns on Reduce Motion, which shows the words at once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CkwDBzVQkZrymewb2q975S
The partial "Looking at your calendar" has no block boundary, so the streaming reveal holds it for STREAMING_REVEAL_MAX_WAIT_MS (1s), the same second findByText waits by default. The test passed only while the reveal's timer fired a few milliseconds before the wait gave up, and failed on a busy CI runner (here and on #566). The test is about live frames reaching the chat, not the reveal's pacing, so it turns on Reduce Motion, which shows the words at once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CkwDBzVQkZrymewb2q975S

Requested by sbt · project thread
Problem
File links in agent replies (
index.html,style.css,script.js, folders) did nothing when clicked. Link opening from #486 (shipped in v0.57.0) only routed relative.html/.htm/.pdfpaths. Two other gaps made most agent file links dead:defaultUrlTransformblanksfile:hrefs (andname.ext:12, which it reads as a URL scheme), so[index.html](file:///…/index.html)rendered with an empty href.nullforfile:URLs and for every non-HTML/PDF file, so those clicks were dropped with no feedback.Changes
renderer/components/markdown.tsx: aurlTransformthat keepsfile:andname.ext:12link targets and leaves everything else to the default sanitizer.renderer/lib/browser-link-routing.ts:file://URLs (empty host orlocalhost), absolute paths and relative paths of any type now resolve to{ kind: "file", path, preview, workspacePath }. Line suffixes (:12,:12:4) are dropped.workspacePathis the path relative to the active workspace folder, ornullwhen the path is outside it (this covers..escapes and~/). Absolute paths with no extension outside the workspace (app routes like/settings) are still ignored.renderer/lib/link-opener.tsx: HTML/PDF go to the existingopen_filepreview in the Aiden browser. Other workspace files and folders go to a newonOpenWorkspaceFilecallback. Paths outside the workspace show a toast instead of failing silently.browser:open-file-externalIPC (main/handlers/browser.ts) accepts only HTML/PDF regular files that still resolve inside the workspace afterrealpath(main/services/browser/external-document.ts), then callsshell.openPath.renderer/components/environment-panel.tsx: passes the workspace folder andopenFile(Files tab) to the provider.renderer/components/files-panel.tsx: a requested path that the index lists as a directory is expanded and focused in the tree. A path the index doesn't list triggers one refresh before it's classified, so a newly created folder isn't read as a file.Terminal links share the router, so terminal file paths of any type can now open in Files too.
Tests
renderer/lib/browser-link-routing.test.ts: file://, absolute, relative, folder, file:line, outside-workspace, and app-route cases, plusworkspaceRelativePathcontainment.renderer/lib/link-opener.test.tsx: the left-click flow (file:// HTML sendsopen_file; CSS and folder links reach Files with workspace-relative paths; an outside file shows the toast) and the right-click menu.renderer/components/files-panel.test.tsx: a folder newer than the loaded index expands after the refresh, and an indexed file opens without an extra refresh.main/services/browser/external-document.test.ts: workspace containment, symlink escapes, a symlinked workspace folder, and the type and folder checks.tests/e2e/browser.spec.ts: an agent reply with a file:// HTML link, a folder link and a relative CSS link opens a browser tab, the expanded and focused folder, and the Files editor.Ran locally:
type-check,type-check:e2e, eslint on the touched files, and the router/provider/Files/markdown/environment/terminal suites. Intest:browser, the one failure isChromium previews load exact assets…, which fails identically onmainin this Linux container. The Electron e2e suite can't launch in the container (the fixture is macOS-only), so the e2e spec runs on macOS CI.Docs
docs/environment-browser.md(Links/files row), thedocs/plans/README.mdlink-opening row, and.memory/link-opening.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01LtHWujhdbTBrQC56sMBXMR