fix(web): Open in editor on a chat file chip opens the file the chip names #18389
main fromrefs/pull/18389/head·merged by juliusmarminge View on GitHubA chat chip naming a nested file by basename opened the correct file in the preview, but Open in editor and both copy actions used a nonexistent file at the workspace root. Resolve these actions through the preview's existing workspace-index lookup, preserving line/column and the authored fallback when no match is found.
Clipboard writes begin with a pending payload before lookup completes, following the existing media-copy pattern to retain Safari user activation. Safari itself remains unverified.
Retains @chickenputty's original work in #18389, with main merged and the helper and callbacks simplified. The Electron desktop client loads this web renderer; native mobile has a separate renderer and is outside this change. Related: #14624.
Validation: 69 focused tests in four files before → 69 in three existing files after. Replaced the standalone suite with two path regressions; the indexed-path regression fails when lookup is disabled. The two relevant browser suites also pass, 75 before → 76 after, including a regression that starts the clipboard write before the delayed lookup resolves. Changed-file type-aware lint, formatting and web typecheck pass. The original 117-test count refers to an older test layout and was replaced with current results.
Headless Linux live verification used an isolated server and synthetic conversation fixture naming HostResources.ts:10:2, which exists at src/resourceTelemetry/HostResources.ts. On main, the menu sent the workspace-root path. On this head, the actual editor RPC spawned a code argv recorder with --goto <workspace>/src/resourceTelemetry/HostResources.ts:10:2. Both copy actions passed that nested path, retaining the workspace-labelled relative format and position. The file preview also opened the nested source. Clipboard writes were recorded at the browser API boundary; native clipboard integration and a real VS Code window were not verified. No provider was started. A local DejaVu font fixture made screenshots legible.
Before — Copy full path points at the workspace root:

After — Copy full path names the existing nested file:

Not verified: macOS, Windows, iOS, Android, Electron desktop, a real desktop editor, native clipboard, remote relay/tunnel or a separate physical client. Existing environment-scoped RPC and permission paths are retained; no contracts or provider adapters change.
Implementation: Codex GPT-6.1 Sol through T3 Code; tests: Codex GPT-6 Astra; independent review: Claude Opus 5.5 and Codex GPT-6 Sol.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Approvability#
Verdict: Approved at
2d3e3b9Macroscope's review found this PR approvable — This is a localized web bug fix that resolves existing chat file-chip actions through the workspace index while preserving fallback paths and source positions. It adds focused regression coverage without changing schemas, defaults, deployment, or security-sensitive code.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Note
This comment is posted by Julius' dot
The focused tests cover the resolved paths, but the changed menu actions have no before/after client evidence. Please add a short recording showing the bare-filename chip opening the existing nested file in the editor and both copy actions producing the correct paths, as required by the verification guide. A recording of the equivalent fix in your Windows fork is fine if you identify the build.
Warning
Review limit reached#
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 12 minutes.
View limit details
-
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
916774ec-a118-4017-9076-e098c571a041
📥 Commits
-
Reviewing files that changed from the base of the PR and between cb3ecbf659d3d9e0ad3b24b739b82ece7ffebc8b and 2d3e3b9d3f5df9e68c708f429a97c06401646805.
📒 Files selected for processing: 4
-
apps/web/src/components/ChatMarkdown.permissions.browser.test.tsxapps/web/src/components/ChatMarkdown.tsxapps/web/src/markdown-links.test.tsapps/web/src/markdownFileHostPath.ts
-
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a0f4cff5-ba15-469f-85d8-84c50dbb74b4
📥 Commits
-
Reviewing files that changed from the base of the PR and between 83fbbc18f8718b0254e696f02b8e381386fd6c7b and cb3ecbf659d3d9e0ad3b24b739b82ece7ffebc8b.
📒 Files selected for processing (3)
-
apps/web/src/components/ChatMarkdown.tsxapps/web/src/markdownFileHostPath.test.tsapps/web/src/markdownFileHostPath.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
File-link actions now resolve bare filenames through the workspace index when workspace path and
cwdare available. Resolved host paths drive editor, reveal, and copy actions. Unmatched links retain their metadata paths. Tests cover matched and unmatched results.Changes: File-link path resolution
Layer / File(s) Summary Host-path resolution and formatting
apps/web/src/markdownFileHostPath.ts,apps/web/src/markdownFileHostPath.test.tsNew helpers resolve matched workspace paths and format editor and copy paths. Tests cover matched and unmatched paths. ChatMarkdown file-link actions
apps/web/src/components/ChatMarkdown.tsxChatMarkdown uses resolved paths for editor, reveal, and copy actions. The optional copy-path resolver is passed to the file-link component and included in callback dependencies and memoization. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to
cb3ec-
The reviewed file-chip actions retain their previous paths when lookup fails, and no actionable merge-blocking risk remains after normal checks.
Security Architecture Review
-
Security architecture risk: 🔵 Low · up to
cb3ecFile actions remain user-triggered and permission-controlled. No concrete security regression was established, but evidence is incomplete for downstream path validation and actions pending during access or workspace changes.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The new reachability is from a content-derived bare filename to an indexed file target used by the user's editor or clipboard action. The caller carries the initiating environment and workspace; the copy action writes path text, not file contents. This does not establish server-side containment or validation of every index result.
Trust Boundaries and Controls
- observed — After resolution, editor and reveal dispatch still use the captured environmentId and re-read orchestration permission before issuing the host command. This counters an environment-identity mismatch or simple permission-revocation bypass at these inspected call sites.
Resilience and Maintainability Implications
- observed — The new actions await lookup before their terminal side effect and preserve the initiating path context. Unlike panel opening, chip editor, reveal, and copy resolution have no latest-result guard. Copy completion also has no terminal filesystem-permission check. These are lifecycle-policy questions, not demonstrated security violations; host actions retain terminal permission checks.
-
Pre-merge checks:
2 · 2-
Failed checks: 2 warningsCheck name Status Explanation Resolution Linked Issues check Issue #14624requires the Windows desktop file context menu action Open in VS Code to open the nested file. The whole-PR diff changes onlyapps/webchat file-chip actions inChatMarkdown.tsxa…Implement the workspace-path lookup in the desktop file context-menu flow used by #14624. Add an automated test that verifies a nested file opens in VS Code with its full path. Alternatively, remove the direct link if this PR intentionally …Out of Scope Changes check The changed behavior targets web chat file-chip actions: Open in editor, Reveal, and copy actions. Issue #14624targets theapps/desktopfile context menu. The diff provides no evidence that…Move the web chat-chip fix to a PR linked to the relevant web issue, or establish that the desktop file context menu uses this exact flow and add coverage for that flow. Keep the #14624PR focused on the desktop context-menu behavior. Passed checks: 2 passed-
Check name Status Explanation Title check The title clearly identifies the primary fix: opening the file named by a chat file chip in the editor. Description check The description clearly explains the problem, implementation, scope, verification results, screenshots, recording, and unverified environments. It does not use the template headings or include an expl… Full details: Description check
-
Explanation
The description clearly explains the problem, implementation, scope, verification results, screenshots, recording, and unverified environments. It does not use the template headings or include an explicit maintainer approval comment, but the required information is otherwise substantially complete.
-
Full details: Linked Issues check
-
Explanation
Issue
#14624requires the Windows desktop file context menu action Open in VS Code to open the nested file. The whole-PR diff changes onlyapps/webchat file-chip actions inChatMarkdown.tsxandmarkdownFileHostPath.ts. It does not change or test theapps/desktopcontext-menu flow. The web chip tests therefore do not establish compliance with the linked issue.Resolution
Implement the workspace-path lookup in the desktop file context-menu flow used by
#14624. Add an automated test that verifies a nested file opens in VS Code with its full path. Alternatively, remove the direct link if this PR intentionally fixes a separate web chat-chip issue.
Full details: Out of Scope Changes check
-
Explanation
The changed behavior targets web chat file-chip actions: Open in editor, Reveal, and copy actions. Issue
#14624targets theapps/desktopfile context menu. The diff provides no evidence that the desktop context menu usesChatMarkdown.tsx, so these changes are outside the linked issue's stated feature scope.Resolution
Move the web chat-chip fix to a PR linked to the relevant web issue, or establish that the desktop file context menu uses this exact flow and add coverage for that flow. Keep the
#14624PR focused on the desktop context-menu behavior.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge assignedjuliusmarminge
Taking over this one. I will merge current main, simplify the path resolution and tests, and verify the editor and copy actions with before/after evidence.
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thisfc4319c
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed