codex icon indicating copy to clipboard operation
codex copied to clipboard

[Linux/KDE] PDF and HTML downloads silently fail: SaveFile sends current_folder="." and portal discards relative file:Downloads URI

Open fslurrehman opened this issue 2 weeks ago • 1 comments

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

ChatGPT desktop Linux production package 26.1111.21308, verified from dpkg-query and installed linux-package-metadata.json, rather than the About dialog. The installed metadata identifies the runtime as Owl.

What subscription do you have?

Not collected for this report.

What platform is your computer?

Linux 6.12.116+deb13-amd64 x86_64 unknown
  • Debian GNU/Linux 13 (trixie), reported VERSION_ID=13
  • KDE Plasma workspace 6.3.6; Wayland session
  • Dolphin 25.04.3
  • xdg-desktop-portal 1.20.3
  • xdg-desktop-portal-kde 6.3.5

What issue are you seeing?

Generated PDF and HTML files open correctly in the in-app preview. Download opens the KDE Save dialog, but accepting a destination apparently under Downloads closes the dialog without creating a file or showing an actionable error.

Fresh manual reproductions were traced on the session D-Bus on November 15, 2026. Both HTML and PDF attempts failed through the same exact sequence:

  1. ChatGPT requests org.freedesktop.portal.FileChooser.SaveFile with a bare filename and current_folder = "." + NUL, rather than an absolute starting directory.
  2. The KDE backend returns success (response 0), but supplies a relative URI such as file:Downloads/report_test.pdf.
  3. xdg-desktop-portal logs Only URIs with the "file://" scheme are allowed and removes the URI.
  4. The response delivered back to ChatGPT still has response 0 but contains uris = [].
  5. No file is written.

Filenames, personal paths, and opaque request identifiers in the excerpts below have been replaced with placeholders; the malformed URI structure and option values are unchanged.

ChatGPT -> org.freedesktop.portal.Desktop
  interface: org.freedesktop.portal.FileChooser
  member: SaveFile
  current_name: "report.pdf"
  current_folder: byte array "." + NUL

KDE backend -> xdg-desktop-portal
  reply to the corresponding SaveFile request
  response: uint32 0
  uris: ["file:Downloads/report_test.pdf"]

xdg-desktop-portal journal
  Only URIs with the "file://" scheme are allowed

xdg-desktop-portal -> ChatGPT
  corresponding org.freedesktop.portal.Request.Response
  response: uint32 0
  uris: []

The HTML failure completed at 11:32:59 and the PDF failure at 11:33:24, Asia/Karachi (UTC+05:00). Both had matching portal warnings at those times. This is a correlated fresh trace, not a diagnosis based only on background log messages.

What steps can reproduce the bug?

  1. On the above Linux/KDE setup, generate a PDF or HTML deliverable in a chat.
  2. Open its in-app preview successfully.
  3. Click Download.
  4. Use the Save dialog's location/navigation to choose Downloads, keep or edit the suggested filename, and click Save.
  5. Check the destination folder: no new file appears.
  6. Trace the public and backend FileChooser calls, the backend reply, and the corresponding Request.Response signal to observe the relative URI being filtered out.

For tracing the request:

dbus-monitor --session \
  "interface='org.freedesktop.portal.FileChooser'" \
  "interface='org.freedesktop.impl.portal.FileChooser'" \
  "interface='org.freedesktop.portal.Request',member='Response'"

Capturing the KDE backend's method return as well establishes what URI it returned before filtering.

What is the expected behavior?

Download should start the chooser at a valid absolute local directory and save the file to the accepted destination. An unusable destination or empty successful portal response should produce a visible error rather than silently skipping the write.

Additional information

Verified workaround/control: In a fresh PDF attempt, replacing the filename field with the complete absolute path /home/USER/Downloads/report.pdf succeeded. The KDE backend and the portal response both contained file:///home/USER/Downloads/report.pdf. The PDF was written at 11:36:47 on November 15, 2026 (UTC+05:00), and filesystem inspection verified its new modification time, 638,775-byte size, PDF header, and EOF marker. The file content is not attached.

A temporary create/write/read test in Downloads also succeeded, and approximately 15 GB was free on the home filesystem. No app, system, portal, or permission changes were needed for the successful absolute-path control.

Read-only inspection of the installed bundle finds selectSavePath calling dialog.showSaveDialog with this platform-dependent default (reformatted, variable names normalized):

defaultPath: process.platform === "win32"
  ? path.join(app.getPath("downloads"), suggestedName)
  : suggestedName

Thus Linux receives only a basename. The fresh wire trace independently confirms that the runtime converts this to current_folder=".".

This matches the failure class described by electron/electron#52051 and fixed upstream in electron/electron#52243. This report does not claim that the installed Owl runtime uses that exact upstream revision; it establishes that this app build still exhibits the malformed request.

Please normalize Linux save defaults to an absolute directory, incorporate the equivalent runtime fix where applicable, and surface invalid/empty chooser results. A regression test should cover both the exact SaveFile D-Bus options and the eventual file write.

The user explicitly authorized this report. No document contents, original filenames, personal username/path, account identifiers, conversation IDs, screenshots, or raw logs are included.

fslurrehman avatar Nov 15 '26 06:11 fslurrehman

Summary: I hit this bug today on Arch Linux (Omarchy 4.5.0-3, Hyprland 0.56.2, xdg-desktop-portal-gtk 1.15.3-2) with openai-codex-desktop 26.1111.21308. In .vite/build/early-bootstrap-226-2f6bd181558008cf.js, I found three places that stop the Save dialog from working on Linux:

  1. selectSavePath sends only a file name on Linux:

    defaultPath: process.platform === "win32"
      ? path.join(app.getPath("downloads"), suggestedName)
      : suggestedName
    

    On Linux, this sends current_folder = "." to org.freedesktop.portal.FileChooser.SaveFile. If you join app.getPath("downloads") on Linux too, the portal gets a valid absolute path. Passing the parent BrowserWindow to dialog.showSaveDialog(win, ...) also lets the Wayland portal attach the dialog to the app window.

  2. Browser link downloads skip the Save dialog by default: promptForDownloadLocation (key: "browser-download-prompt-enabled", default: false) is hidden from the settings UI. When it is false, downloadStore.start() calls browserSession.setDownloadPath(...) and saves straight to ~/Downloads with no dialog. When I set "browser-download-prompt-enabled": true in ~/.codex/.codex-global-state.json, downloadStore.start() calls item.setSaveDialogOptions({ defaultPath: reservedPath }) with a full path in Downloads, and the Save dialog opens cleanly.

  3. Deep Research (mcp_app_sandbox) blocks report downloads: When you click Download in connector_openai_deep_research, CSP (frame-src 'none') blocks the ?app=skybridge export iframe (ERR_BLOCKED_BY_CSP). Also, the sandbox session cancels every will-download event (mcp_app_sandbox.download_blocked, event.preventDefault(); item.cancel()).

ryan-winkler avatar Nov 18 '26 16:11 ryan-winkler