Fix unstable local file link navigation in the VS Code Codex chat window
Fix unstable local file link navigation in the VS Code Codex chat window
Summary
In the OpenAI/Codex chat webview inside VS Code, local file links behave inconsistently on Windows. Some links are rendered as blue hyperlinks, but clicking them opens the browser instead of VS Code. Some links appear clickable but do nothing. The result also varies by file type and path encoding.
This issue is reproducible in local Windows workspaces.
Reproduction
- Emit a local file link in the chat window.
- Click the link.
- Observe whether VS Code opens the target file or whether the browser opens instead.
Observed behavior
- A local resource URL can be treated as a normal external URL and open in the browser.
- The special citation-style link format is unstable in this rendering path and often degrades to plain text.
- Plain Markdown local links are currently the most reliable form.
Expected behavior
Any valid local file link should open the target file inside VS Code, not in a browser, and should work consistently across:
- text files
- images
- archives
- cache and metadata files
- paths containing Chinese characters
- paths containing special characters such as
+and-
Why I believe this is an extension-side issue
This looks like a chain problem across three layers:
- Webview Markdown rendering
- Some links are downgraded to plain external links, which sends clicks to browser behavior.
- Path encoding and decoding
- Chinese characters, spaces, and special symbols can be percent-encoded in the URL layer.
- If the path is not decoded before reaching the host, the string no longer matches the real filesystem path.
- Host-side open logic
- A text-first opening strategy such as
openTextDocument + showTextDocumentis fine for source files, but it is unstable for images, archives, and binary files.
Because the relevant logic lives in the extension's webview and host integration, this appears to be a plugin integration issue rather than a VS Code core regression.
Verified fix direction
- Detect local resource URLs in the click handler instead of treating every URL as an external link.
- Decode and normalize the path in the
open-fileentry point before opening it. - Route text files to the editor and non-text files to
vscode.open. - Keep a fallback path and log failures instead of silently doing nothing.
Verification results
After applying the above logic locally, I verified that the following link types can be opened reliably:
- text files
- Chinese directories and Chinese file names
- images
- archives
- binary or compressed files
- cache and metadata files
dist-infometadata files- filenames with
+or-
Recommendation
Please upstream this fix in the extension source code instead of relying on a patched local bundle, because extension updates can overwrite local modifications. The most important safeguards are:
- Decode and normalize local paths consistently.
- Split text and non-text files into separate open flows.
- Add regression tests for the edge cases above.
Supporting notes are maintained in separate local English drafts and are intentionally omitted from this public-facing issue text.
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Adding the most important verification details from local Windows testing:
Confirmed stable cases after the fix
+and-work (for example GMT-style metadata names)What this confirms
Recommended upstream safeguards
open-fileentry point.vscode.openfallback for non-text files and failure cases.I also documented the full troubleshooting notes locally, but the short version above is the most useful signal for the upstream fix.
Short follow-up after more Windows testing:
The critical upstream safeguard is explicit text vs non-text routing.
vscode.open(with fallback).This avoids forcing binary content through
openTextDocumentand makes the fix robust across file types.Adding a fuller end-to-end summary here in case it helps consolidate the duplicate cluster.
What I verified on Windows
Root cause I converged on
openTextDocument + showTextDocument) is fine for source files, but not for images, archives, or binary files.Successful fix direction locally
open-fileentry point.vscode.open.This combination resolved the browser-jump issue for:
I realize this may overlap with #15377, #15859, #16245, and #14946. I am leaving this note because the end-to-end reproduction and the successful routing split may still be useful for whoever consolidates the duplicate cluster.
I’m seeing what appears to be the same issue on Windows with the official OpenAI VS Code extension (
openai.chatgpt).In my case, Codex renders a local file reference as a blue clickable link in the chat UI, for example
agent_backend_session_summary.zh.md, but clicking it does not open the file inside VS Code. Instead, it opens Microsoft Edge and navigates to afile+.vscode-resource.vscode-cdn.net/.../webview/...URL, which then fails withERR_CONNECTION_RESET.I inspected the chat DOM in VS Code Developer Tools and found that the filename is rendered as an actual
<a>element, not just styled text. The relevant part looks roughly like this:What stood out is that the anchor appears to have no meaningful
hrefvalue (or at least no valid local-file/navigation target), while still being rendered as a clickable external-style link withtarget="_blank". That seems consistent with the behavior: the link is visually rendered, but the click is not translated into “open this workspace file in VS Code”, and instead falls back to external browser navigation.So from my debugging, this does not look like a model output formatting problem. It looks more like an extension-side link handling/navigation issue in the VS Code chat webview on Windows.
My environment:
openai.chatgpt)Observed behavior:
file+.vscode-resource.vscode-cdn.net/...URL and failsThis issue is highly reproducible for me. Happy to provide additional DOM screenshots / DevTools details if helpful.
Similar issue for me on Windows OS
I’m seeing what looks like a behavior change after a recent VS Code extension update, but the underlying local file navigation issue does not appear to be fully fixed.
Previously, when Codex rendered a local file reference in chat, clicking it would open the external browser (Edge) and navigate to a broken
file+.vscode-resource.vscode-cdn.net/...URL.After the recent update, that no longer happens in my environment. However, the file link now appears to be non-clickable / unclickable in the VS Code extension. In addition, when I open the Codex app, the referenced file sometimes shows up in the right-hand sidebar, but the panel says “Unable to load file” instead of opening the file contents.
So from the user side, this looks less like a full fix and more like a behavior shift:
This makes me suspect the browser fallback may have been suppressed, but the underlying workspace-file resolution / file-open logic is still failing.
Environment:
openai.chatgpt)I can confirm this is still broken for me on Windows with the current VS Code extension, and in my environment the local Markdown links are not just unstable, they are unusable.
Environment:
Examples tested:
[cso_pymmain_policy_clp.xml:1](/d:/CSO_CLP/Main/02-Backend/PYM-Main-20260409/Teld.Boss.PYM.Main.DataAccess/Maps/PYM/cso_pymmain_policy_clp.xml:1)[AGENTS.md:9](/c:/Users/阳/.codex/AGENTS.md:9)Actual result:
Control result:
code -g "absolute_path:line"opens the same files correctly every time.Important detail:
Impact:
Current workaround:
code -g "absolute_path:line"instead of relying on chat-panel Markdown local file links.Please prioritize a fix for the VS Code extension path, not only renderer-side formatting, because from the user side this currently breaks a core workflow.
same issue
Rolling back to an older version from at least two weeks ago may solve this problem.