Skip to content

Markdown file:// links open in default browser (Edge) instead of VS Code editor #12661

Open

Description

@CT-2026

Environment:

  • OS: Windows 11 Pro 10.0.26200
  • VS Code: 1.109.5 (x64)
  • Extension: openai.chatgpt 0.5.76

Steps to reproduce:

  1. Open the ChatGPT/Codex sidebar in VS Code.
  2. Obtain any response that contains a Markdown link to a local .md file, for example:
    README.md
  3. Click the link inside the chat message rendering.

Expected:

  • The linked local Markdown file opens in a VS Code editor tab.

Actual:

  • The link opens via the OS default browser (Microsoft Edge), showing the Markdown in the browser.

Observed routing in extension source:
In webview/assets/index-*.js, the Markdown renderer attaches an onClick handler that dispatches "open-in-browser" for link clicks:

"_blank", rel:"noopener noreferrer", onClick:h=>{!a||!MZt(a)||(h.preventDefault(),Xt.dispatchMessage("open-in-browser",{url:TZt(a)}))}

In out/extension.js, the "open-in-browser" message is handled via vscode.env.openExternal():

case "open-in-browser": {
Ee.env.openExternal(Ee.Uri.parse(r.url));
break;
}

Result:

  • When the href is a file:// URI to a local .md, the click path goes through openExternal and is handed to the OS, which opens the default browser (Edge).

Activity

  1. added
    bug
    extension
    windows-os
    on Feb 24, 2026
  2. CT-2026 commented on Feb 26, 2026

    @CT-2026
    Author

    Regression after update to openai.chatgpt 0.5.78:

    I had closed this issue because the behavior was fixed after an earlier update, but after updating to 0.5.78 it is reproducible again.

    Environment:

    • OS: Windows 11 Pro 10.0.26200
    • VS Code: 1.109.5 (x64)
    • Extension: openai.chatgpt 0.5.78

    Steps:

    1. Open the Codex sidebar in VS Code
    2. Click a Markdown link to a local file://…/*.md inside the webview message

    Expected:

    • Opens the Markdown file in a VS Code editor tab

    Actual:

    • Opens the link via the OS default browser (Edge), same as before

    If you want, I can test specific builds or provide logs, but the reproduction is consistent on 0.5.78.

  3. HumboldtK commented on Mar 1, 2026

    @HumboldtK

    I have this issue as well

  4. kelesmert commented on Mar 1, 2026

    @kelesmert

    I have this issue too it was ok 2 days ago

  5. MadProff31 commented on Mar 1, 2026

    @MadProff31

    I'm seeing this as well. It isn't limited to Markdown; .asm files are also affected.

  6. fender commented on Mar 2, 2026

    @fender

    Since this morning any link to a file in codex is opening in the browser rather than the editor..
    e.g. https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/Joe/.vscode/extensions/openai.chatgpt-0.4.79-win32-x64/webview/

  7. denizyigit commented on Mar 2, 2026

    @denizyigit

    I have this issue as well

  8. Klwildri commented on Mar 3, 2026

    @Klwildri

    yes i have it also

  9. staytomorrow commented on Mar 4, 2026

    @staytomorrow

    i have it also

  10. HckSir commented on Mar 4, 2026

    @HckSir

    我也有这个问题

  11. Andreas-UI commented on Mar 5, 2026

    @Andreas-UI

    I encounter this issue with file+.vscode-resource.vscode-cdn.net/xxxxx

  12. 27 remaining items

  13. woodlynn commented on Mar 30, 2026

    @woodlynn

    可以将这个脚本丢给codex,让他根据内容自己改。
    我已经直接改好了扩展里的 markdown 渲染 bundle,没有用到 Node。
    这次补的是最新版扩展:
    C:\xxx\openai.chatgpt-26.325.31654-win32-x64\webview\assets\markdown-Cqst3qDh.js
    做了两件关键事:
    放行本地文件链接:tO(...) 现在会允许 ZS(e) / QS(e) 这类本地文件 href,不再被 urlTransform 干掉
    规范化 Windows markdown 路径:插入了 __codexNormalizeWindowsMarkdownLinks(...),会把像 x 这种路径转成更稳定的斜杠形式再渲染
    备份也已经留好了:
    C:\xxx\openai.chatgpt-26.325.31654-win32-x64\webview\assets\markdown-Cqst3qDh.js.codex-local-file-link.bak
    你现在需要做的基本只有一步:

    完全重载 VS Code 窗口,或者把 VS Code 关掉再打开

  14. zedrun00 commented on Mar 31, 2026

    @zedrun00

    This fucking bug has been around for two months already. Why the hell hasn't it been fixed yet? FK!

    # Check cpp file 
    [BBGameplayCueNotify_VoidRayCast.cpp:295](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/zedrun/scoop/apps/vscode/1.108.2/data/extensions/openai.chatgpt-26.5325.21211-win32-x64/webview/) 
    
    # jump to browser FK!
    https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/zedrun/scoop/apps/vscode/1.108.2/data/extensions/openai.chatgpt-26.5325.21211-win32-x64/webview/
    

    i try @kiss10101 apply_codex_local_file_link_patch.zip fix this bug, thx you

  15. CargoCultScientist commented on Mar 31, 2026

    @CargoCultScientist

    Also pushing this up again, I do have a Codex conversation that will temporarily fix the problem (based on one of the prompts above) but I have to ask Codex every other day "can you please fix it again"...
    Definitely every new update makes the bug come back again, sometimes the fix works, last time I had to downgrade to get Codex back to working order again, it's extremely disruptive to the workflow.

  16. Charl-Ep commented on Apr 1, 2026

    @Charl-Ep

    A work around is to let the agent output the file path in the form of `@PATH` instead of default [x](PATH) form
    The backtip mark is included.

  17. zx20030501 commented on Apr 1, 2026

    @zx20030501

    SAME! any link to a file in codex is opening in the browser rather than the editor..

  18. clshortfuse commented on Apr 1, 2026

    @clshortfuse

    Welp, time to make an open OpenAI Codex extension.

    Image

    ChatGPT Review

    Primary regression
    - extension/src/components/markdown/file-reference.ts:95
      parseFileReference() trims text but does not decode URI-encoded file refs.
    - extension/src/components/markdown/file-reference.ts:188
      isFileReference() is the main gate for markdown file links.
    - extension/src/components/markdown/file-reference.ts:191
      isFileReference() rejects any scheme:// href, so file://... never becomes a FileLink.
    - extension/src/components/markdown/render-prompt-link.tsx:99
      Markdown links are only upgraded to FileLink if isFileReference(href) or isAbsoluteFilesystemReference(href) succeeds.
    - extension/src/components/markdown.tsx:452
      The anchor renderer calls renderPromptLink(...) first.
    - extension/src/components/markdown.tsx:467
      When that fails, the fallback <a> path routes scheme URLs to open-in-browser.
    - extension/src/components/markdown.tsx:689
      urlTransform(...) whitelists app/plugin/agent hrefs and image src, but not local file hrefs.
    
    Windows path handling
    - extension/src/components/markdown.tsx:619
      displayChildren is the last clean pre-render hook before ReactMarkdown.
    - extension/src/components/markdown.tsx:727
      displayChildren is passed directly into <ReactMarkdown>.
    - extension/src/components/markdown/remark-preserve-windows-paths.ts:123
      The existing plugin only preserves backslashes in text nodes; it does not normalize markdown link destinations like [x](C:\foo\bar.ts) before parsing.
    
    Known-good open path
    - extension/src/components/markdown/mention-chips.tsx:209
      FileLink component.
    - extension/src/components/markdown/mention-chips.tsx:226
      FileLink already uses useMutationFromVSCode("open-file"), so correctly classified links already follow the proper editor-open path.
    
    Host-side note
    - raw/extension/out/extension.js
      The host bundle's "open-file" handler already has an absolute-path branch. Host-side URI decoding is still a useful hardening fix, but the primary regression is in the webview markdown classification path above.
    
    Minimal fix set
    - Decode URI-encoded file refs before parsing.
    - Stop classifying local file-style hrefs as generic external URLs.
    - Normalize Windows markdown link destinations before ReactMarkdown render.
    - Keep host-side path decoding as a fallback/hardening change.
  19. petterton commented on Apr 9, 2026

    @petterton

    A work around is to let the agent output the file path in the form of @PATH instead of default x form The backtip mark is included.

    Finally a working solution. And making a skill that tells Codex to always do it this way also helped

  20. virtushda commented on Apr 14, 2026

    @virtushda

    A work around is to let the agent output the file path in the form of @path instead of default x form The backtip mark is included.

    This is not working anymore either.

  21. DustyShoe commented on Apr 15, 2026

    @DustyShoe

    A work around is to let the agent output the file path in the form of @path instead of default x form The backtip mark is included.

    This is not working anymore either.

    Can confirm.
    As of v26.409.20454 it stopped working as well.
    As a workaround rolling back to 26.406.31014.

    VS Code: 1.115.0
    OS: Windows_NT x64 10.0.19045

  22. aoaoaoao-wu commented on Apr 24, 2026

    @aoaoaoao-wu

    26.5422.21459好像已经修复了这一问题

  23. aoaoaoao-wu commented on Apr 24, 2026

    @aoaoaoao-wu

    但是最近的版本有一个git相关的错误,没有git init的项目codex扩展会后台循环某些进程导致高cpu占用

  24. kelesmert commented on Jun 16, 2026

    @kelesmert

    is that fixed?

  25. naipi11 commented on Aug 19, 2026

    @naipi11

    A workaround that avoids the OS browser handoff is to stop using file:// links for workspace files:

    1. Ask Codex to return a workspace-relative path, for example [README.md](README.md), or just the plain relative path.
    2. Click the relative link first.
    3. If the current renderer still routes it externally, use VS Code Quick Open (Ctrl+P / Cmd+P) and paste that relative path.
    4. Verify the file opens in an editor tab rather than the system browser.

    Limitation: this is only reliable for files inside the open workspace. Files outside the workspace still need to be opened explicitly, and this does not fix the extension's file:// click routing.

  26. naipi11 commented on Sep 7, 2026

    @naipi11

    The issue is still open, and I do not have reliable evidence that current releases have fixed the Windows/macOS file:// click-routing problem.

    The older 26.5422.21459 report is not enough to establish a current fix, especially because later comments still report the regression. The temporary method remains:

    1. Ask Codex to emit a workspace-relative path or Markdown link such as [README.md](README.md), not a file:// URL.
    2. If the link still routes externally, open the file with VS Code Quick Open (Ctrl+P / Cmd+P) using that relative path.
    3. Treat files outside the active workspace as requiring explicit manual opening.

    This is a workaround, not an official fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextensionwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions