Skip to content

[Bug] 2.80.0 Linux desktop: a proxy the app did not start serves no dashboard, so the reopened app shows JSON #6720

Closed

Description

@sungyongcho

Client or integration

OpenCodex dashboard

Area

Installation or packaging

Summary

On the Linux desktop package (open-codex .deb), a proxy that the desktop shell did not start answers GET / with the JSON fallback "dashboard":{"available":false,"reason":"GUI build not found. ..."}. If the desktop app is opened while that proxy is running, it attaches to it as a guest and the window renders that JSON instead of the dashboard. The package installs the dashboard at /usr/lib/OpenCodex/gui/dist, so the expected behavior is that /usr/bin/ocx serves it no matter who started it.

Cause. findGuiDist() in src/server/gui-static.ts tries OPENCODEX_GUI_DIST, then <directory of ocx>/gui/dist for a standalone binary, then source-tree paths. The desktop shell sets OPENCODEX_GUI_DIST only on the sidecar it spawns itself (desktop/src-tauri/src/sidecar.rs). Tauri installs bundle resources in its resource_dir: ../lib/<productName> relative to /usr/bin on Linux, and ../Resources relative to Contents/MacOS on macOS. That means /usr/bin/gui/dist never exists. Two starters run the same binary without the variable:

  • ocx ensure from the Codex autostart shim (~/.opencodex/bin/codex), which spawns /usr/bin/ocx start --port 10100 detached
  • the user service unit (ExecStart=... exec '/usr/bin/ocx' start --port 10100)

This is not a 2.79.0 → 2.80.0 regression. src/server/gui-static.ts, src/cli/index.ts, src/codex/shim.ts and desktop/src-tauri/src have no commits between those tags.

The macOS app bundle has the same gap on paper (OpenCodex.app/Contents/MacOS/ocx vs Contents/Resources/gui/dist), but I have not reproduced it on a Mac. Windows is unaffected: Tauri keeps resources next to the executable there, and the existing beside-the-binary candidate already covers that.

Proposed fix. For a standalone binary, also try the desktop bundle's resource directory: ../Resources/gui/dist on macOS and ../lib/OpenCodex/gui/dist on Linux. This mirrors Tauri's resource_dir. The Linux rule also covers /usr/local/bin and an AppImage's usr/bin. A PR follows.

Reproduction

  1. Install open-codex 2.80.0 (.deb), with the desktop app owning the runtime and the Codex autostart shim installed.
  2. Quit OpenCodex from the tray. This stops its sidecar proxy.
  3. Start Codex (the Codex App, or codex in a shell). The shim runs ocx ensure, which starts /usr/bin/ocx start --port 10100.
  4. curl -s http://127.0.0.1:10100/ returns the JSON fallback with "dashboard":{"available":false,...}.
  5. Open OpenCodex again. It finds the runtime listening and attaches as a guest ("a runtime was already listening and this installation already owns it"), and its window shows that JSON.

Recovery today: quit the app, run ocx stop, and reopen the app before anything else starts a proxy. A workaround is to set OPENCODEX_GUI_DIST=/usr/lib/OpenCodex/gui/dist in the session environment (for example in ~/.config/environment.d/), so every starter inherits it.

Version

2.80.0

Operating system

Ubuntu 26.04.1 LTS (x86_64, GNOME)

Provider and model

No response

Logs or error output

$ curl -s http://127.0.0.1:10100/
{"status":"ok","service":"opencodex","version":"2.80.0","dashboard":{"available":false,"reason":"GUI build not found. Run `bun run build:gui` from the opencodex repo, or use `ocx gui` from a packaged install."},"endpoints":{"health":"/healthz","models":"/v1/models","responses":"/v1/responses","chatCompletions":"/v1/chat/completions","management":"/api/*"}}

# The listening proxy was started from the Codex App's process scope, not by the desktop shell
$ ps -o cmd= -p <pid>
/usr/bin/ocx start --port 10100
$ cat /proc/<pid>/cgroup
0::/user.slice/user-1000.slice/[email protected]/app.slice/app-org.chromium.Chromium-<n>.scope

# The package does ship the dashboard, just not where findGuiDist() looks
$ dpkg -L open-codex | grep 'gui/dist/index.html'
/usr/lib/OpenCodex/gui/dist/index.html

Screenshots and supporting files

No response

Redacted configuration

No response

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    gui
    install
    on Oct 8, 2026
  2. Ingwannu commented on Oct 8, 2026

    @Ingwannu
    Owner

    Source triage at dev bbab02a confirms the discovery mismatch: findGuiDist checks OPENCODEX_GUI_DIST, beside-the-standalone-executable gui/dist and source-relative paths; the desktop sidecar separately supplies resource_dir()/gui/dist, and tauri.conf.json maps the bundled GUI there with productName OpenCodex. That supports your packaging-path diagnosis; I have not independently installed the .deb or reproduced macOS behavior.

    A focused PR is welcome; since you are preparing one, I am not taking over the implementation. Please use synthetic package layouts to cover Linux usr/bin -> usr/lib/OpenCodex, AppImage/custom prefix, macOS Contents/MacOS -> Contents/Resources, the existing Windows adjacent layout, explicit env-override precedence, source-checkout fallback and absent resources. Preserve the served-index/session-bootstrap behavior; discovery should not copy/build files, change a user's environment or start/stop a service. Report which packaged artifacts/platforms were actually tested, separately from path-fixture tests. No installed runtime, GUI assets or service configuration were changed here.

  3. sungyongcho commented on Oct 8, 2026

    @sungyongcho
    ContributorAuthor

    Thanks for the triage. PR #6722 now covers each case you listed with synthetic layouts: Linux usr/bin → usr/lib/OpenCodex, the AppImage $APPDIR/usr/bin, /usr/local and /opt prefixes, macOS Contents/MacOS → Contents/Resources, and the existing Windows layout beside ocx.exe. A Windows binary ignores the other two layouts. The tests also cover OPENCODEX_GUI_DIST precedence over every layout, the source-checkout fallback, and absent resources, which keep the JSON fallback. Discovery is existence checks only, and a test asserts it leaves the fixture tree and process.env unchanged. Another test serves index.html from a discovered bundle and checks the session-bootstrap meta tags.

    Packaged artifacts I actually tested, reported separately from the fixtures:

    • the installed 2.80.0 .deb and the 2.80.0 AppImage (extracted, not executed), on Ubuntu 26.04 x86_64
    • the 2.80.0 .dmg, mounted read-only, on an M1 MacBook Pro (macOS 27.0.1, arm64)

    In each, a probe compiled from the branch resolves the packaged gui/dist, and the same probe built from dev returns null. On Linux the branch probe also serves index.html with the session bootstrap. Windows is fixture-only plus CI, because I have no Windows machine. Details, including which commit each run used, are in the PR's Verification section.

  4. lidge-jun commented on Oct 8, 2026

    @lidge-jun
    Owner

    Fixed by #6722 (merged to dev). A standalone ocx started outside the desktop shell (for example by ocx ensure from the Codex autostart shim or the login service) now also looks for the dashboard in the desktop bundle's resource directory: <exe>/../lib/OpenCodex/gui/dist on Linux packages and <exe>/../Resources/gui/dist on macOS. OPENCODEX_GUI_DIST and a gui/dist next to the binary still take precedence, and source checkouts and Windows behave as before. It will ship in the next release. Thanks for the detailed report and the 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

    bugguiinstall

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions