codex icon indicating copy to clipboard operation
codex copied to clipboard

local HTML Browser Open button does nothing and local screenshot previews always stay stale on Windows

Open methoddss opened this issue 6 months ago • 4 comments

What version of the Codex App are you using (From “About Codex” dialog)?

26.429.61741

What subscription do you have?

Pro

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What issue are you seeing?

Environment:

  • Codex Desktop on Windows
  • Local workspace on a secondary drive
  • Local HTML and PNG files opened from disk

Issue 1: When Codex renders a local HTML file as a preview card in chat, the card includes an Open button. Clicking the Open button does not do anything. The in-app browser does not open or navigate to the local file, and no visible error is shown.

Issue 2: Local screenshot previews in chat can stay stale after the underlying file is overwritten.

What steps can reproduce the bug?

Issue 1:

  1. In a Windows Codex Desktop workspace, create a simple local HTML file, for example: C:\Projects\example-site\preview.html
  2. Link it in a Codex response using a local file markdown link: preview.html
  3. A preview card appears in chat with an Open button.
  4. Click Open.

Issue 2:

  1. Generate or save a screenshot, for example: C:\Projects\example-site\preview.png
  2. Link or display it in Codex chat.
  3. Overwrite preview.png with a new screenshot.
  4. Link or display the same path again.

What is the expected behavior?

The chat image preview should show the updated screenshot.

This makes local frontend/design review confusing because users cannot reliably open generated HTML previews or trust that screenshot previews are showing the latest file contents.

Additional information

What actually happens instead is the chat preview will continue showing the older image.

methoddss avatar May 06 '26 06:05 methoddss

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #21016

Powered by Codex Action

github-actions[bot] avatar May 06 '26 06:05 github-actions[bot]

I can reproduce the stale local image preview behavior on macOS as well, so this does not appear to be Windows-only.

Environment:

  • Codex App: 26.519.81530
  • Bundle version: 3178
  • Bundle identifier: com.openai.codex
  • Platform: macOS 26.5, build 25F71
  • Architecture: arm64
  • App path: /Applications/Codex.app

Reproduction:

  1. In a local Codex workspace, generate or overwrite a PNG screenshot.
  2. Have Codex show it in chat using Markdown with an absolute local path, for example: ![preview](/Users/<user>/path/to/workspace/output/preview-latest.png)
  3. Overwrite the same PNG path with a new screenshot.
  4. Ask Codex to show the same Markdown image path again.

Expected: The chat image preview should show the updated image contents.

Actual: The chat continues to show the older image, apparently cached by local file path. Saving the same image under a new filename, for example with a timestamp suffix, makes the updated image appear immediately.

Impact: This is confusing during iterative visual QA because stable filenames such as latest.png are natural for generated previews, but the chat preview can show stale content.

Workaround: Use a unique filename for every screenshot shown in chat, while keeping stable filenames only for automation or repository output.

chongdae avatar May 28 '26 01:05 chongdae

Confirming the local HTML card Open button issue on Codex Desktop 26.1117.3838.0 (installed package version), Windows 11 25H2 x64 (build 26200.9974).

  1. Generate a self-contained HTML file in a local Windows workspace on a drive such as E: and link it in the Codex response using its absolute path.
  2. Click Open on the resulting Website card. The card shows the HTML title, but no browser tab opens and there is no visible error. The same file renders when opened directly in Edge.

The desktop log records this warning on repeated clicks (path anonymized):

warning [link-opening] Invalid link URL initiator=mcp_app_resource url=E:/workspace/预览.html

The warning shows that the click reaches the link handler with a raw Windows path. The URL parser reads E:/… as the e: scheme, so the browser handoff is rejected before the page can load. Please route Windows absolute paths from these cards through the local-file opener or convert them to a standard file: URL before URL validation. If opening fails, a visible error would also help.

AaronandWork avatar Nov 20 '26 07:11 AaronandWork

Still reproducible on Codex Desktop for Windows 26.1120.6357.0 (app version 26.1120.50957, Windows 11 x64). Also related to #32078.

Symptoms

For a generated local HTML file shown as a Website end-resource card:

  1. Clicking Open does nothing (no error toast/dialog).
  2. Opening the Open ⌄ dropdown only shows ChatGPT and Copy link (no Chrome/Edge, even though Windows default associations for http/https/.html are set to Chrome).
  3. Clicking ChatGPT in the dropdown also does nothing.
  4. Clicking Copy link works (and pasting the copied path into Chrome opens the file).
  5. Clicking the inline file link in the assistant message text does work and renders file:///C:/... in the right-panel browser sidebar.

Desktop log on every Open / ChatGPT click:

warning [link-opening] Invalid link URL initiator=mcp_app_resource url=C:/Users/<user>/.../example.html

Root Cause (from inspecting app.asar)

1. Renderer (Chromium GURL) vs. Main Process (Node.js URL) mismatch on Windows drive paths

The Website card receives a raw Windows absolute path (C:/Users/<user>/.../example.html) from editedFilePaths, without a file:/// scheme:

  • In the Electron renderer (Chromium on Windows): new URL("C:/Users/<user>/.../example.html") automatically coerces a Windows drive path into protocol: "file:" (href: "file:///C:/...").
  • Because the local-URL check uses new URL(target) and tests protocol === "file:", the renderer mistakenly classifies the raw Windows path as an already-valid file: URL (on macOS/Linux, new URL("/Users/...") throws, so it correctly falls into the local-file branch).
  • As a result:
    • Both Open and dropdown ChatGPT bypass openWorkspaceFile (which uses pathToFileURL() and works) and instead dispatch open-in-browser with the original unconverted string C:/Users/... (which also slips past the renderer's URI scheme regex /^(?:[a-z][a-z0-9+.-]*:|www\.|\/\/)/i because C: matches a scheme).
    • Copy link is enabled for the raw string and works because it writes straight to the clipboard without main-process URL validation.
  • In the Electron main process (Node.js WHATWG URL): new URL("C:/Users/<user>/.../example.html") parses C: as protocol: "c:", not "file:".
    • Even when clicking ChatGPT (openTarget: "in-app-browser"), the target resolver rejects "in-app-browser" because protocol is "c:", falls through to the protocol allowlist, fails validation, logs Invalid link URL, and silently returns false.

2. Missing external browsers in the Open ⌄ dropdown on Windows

In the main-process browser target discovery (getTargets), both the native URL-handler helper (launch-services-helper) and its fallback immediately return null / [] when process.platform !== "darwin", leaving Windows with no external browser entries in the dropdown.

Suggested Fix

  1. Reject raw Windows drive paths (^[A-Za-z]:[\\/]) in the renderer's local-URL helper before calling new URL(...) (similar to how the Website card's own HTML <title> loader already checks for Windows drive paths), so local Windows HTML files route through openWorkspaceFile → pathToFileURL() — and/or normalize to file:/// before sending open-in-browser.
  2. Add Windows browser discovery (or at least a "Default browser" option) to getTargets so external browsers appear in the Open ⌄ dropdown on Windows.

Abhoth1102 avatar Nov 27 '26 16:11 Abhoth1102