Repository navigation
fix(server): serve the desktop bundle's dashboard from an ocx the app did not start - #6722
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughStandalone GUI discovery now checks platform-specific desktop bundle paths, in addition to the executable-adjacent path. The environment override and source-checkout fallbacks retain their existing precedence. Tests cover packaged layouts and dashboard responses. ChangesStandalone GUI discovery
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change lets a standalone ocx binary find the desktop bundle's dashboard on Linux and macOS. No concrete merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
…and absent resources
|
@codex review |
|
@coderabbitai review |
|
To use Codex here, create a Codex account and connect to github. |
✅ Action performedReview finished.
|
Summary
When the desktop shell did not start a desktop-bundled
ocxitself, that proxy served no dashboard. The shell passesOPENCODEX_GUI_DISTonly to the sidecar it spawns.ocx ensurefrom the Codex autostart shim and the login service run the same/usr/bin/ocxwithout the variable.findGuiDist()then checked only/usr/bin/gui/distand source-tree paths, while the .deb installs the dashboard at/usr/lib/OpenCodex/gui/dist. The proxy answeredGET /with the "GUI build not found" JSON, and a desktop app reopened afterwards attached to it as a guest and showed that JSON in its window.For a standalone binary,
findGuiDist()now also tries the desktop bundle's resource directory. The rule mirrors Tauri'sresource_dirin tauri-utils 2.9.3, the version locked indesktop/src-tauri/Cargo.lock:<exe dir>/../lib/OpenCodex/gui/dist. This covers the .deb (/usr/bin),/usr/local/bin, a custom prefix, and an AppImage's$APPDIR/usr/bin.<exe dir>/../Resources/gui/dist, forOpenCodex.app/Contents/MacOS/ocx.The lookup order is otherwise unchanged:
OPENCODEX_GUI_DISTDiscovery only checks whether
index.htmlexists. It creates, copies and builds nothing, does not change the environment, and does not start or stop anything.findGuiDist()now takes an optional lookup object (standaloneDir,platform,moduleDir) so tests can drive synthetic layouts; production callers pass nothing. The served-index path is untouched:serveGuiFile()and the session-bootstrap injection work as before.The desktop's guest-attach behavior does not change. A reopened app still attaches to a runtime that is already listening, but that runtime now serves the dashboard.
Closes #6720
Verification
Run on Ubuntu 26.04 (x86_64) at head
d73bd2b230, which sits on the currentdevtipbbab02ab27.Path-fixture tests (synthetic layouts,
tests/gui/gui-static.test.ts)19 pass / 0 fail on Ubuntu. With the Linux and macOS bundle candidates disabled, 9 of them fail. The remaining cases guard behavior this PR must not change, so they pass both ways. On the M1 MacBook below, the file at
609bc8d923(its first 9 tests, before the second commit added the rest) ran 9 pass / 0 fail./usr/bin→/usr/lib/OpenCodex$APPDIR/usr/bin→$APPDIR/usr/lib/OpenCodex,/usr/localand/optprefixesContents/MacOS→Contents/Resourcesocx.exe; Linux and macOS directories not consultedOPENCODEX_GUI_DISTwins over every packaged layoutgui/distwins over a bundle layoutgui/distand never consults a bundle layout; a packaged layout comes before the checkout fallbacknull, soGET /keeps the JSON fallbackindex.html(and an SPA route) withno-storeand the session-bootstrap meta tagsprocess.envunchangedDESKTOP_PRODUCT_NAMEmatchesproductNameintauri.conf.json, and the bundle maps a resource togui/distPackaged artifacts actually tested
For each artifact I compiled two probe binaries with
bun build --compile. One imports this branch'sfindGuiDist(and, on Linux,serveGuiFile); the other importsdev'ssrc/server/gui-static.ts. I placed both in the artifact's executable directory and ran them withoutOPENCODEX_GUI_DIST.HOME,OPENCODEX_HOMEandCODEX_HOMEpointed at empty temporary directories, which stayed empty.~/.codexand~/.opencodexwere identical before and after each run.devopen-codex2.80.0 .deb, installed (/usr/bin/ocx,/usr/lib/OpenCodex/gui/dist/index.html, no/usr/bin/gui)<tmp>/usr/bin, with<tmp>/usr/lib/OpenCodexa symlink to the installed/usr/lib/OpenCodexgui/dist;GET /returnstext/html,no-store, with session metanullOpenCodex-2.80.0-linux-x86_64.AppImage(SHA-256 matches the release asset digest; not executed)usr/lib/OpenCodex/guiextracted withunsquashfs; the payload hasusr/bin/ocxand nousr/bin/gui; probes placed in the extractedusr/binnullOpenCodex-2.80.0-macos.dmgon an M1 MacBook Pro, macOS 27.0.1 arm64 (SHA-256 matches the release.sha256; mounted read-only, nothing installed). The bundle hasContents/MacOS/ocx,Contents/Resources/gui/dist/index.html, and noContents/MacOS/gui<tmp>/OpenCodex.app/Contents/MacOS, withContents/Resourcesa symlink to the mounted bundle's; run at609bc8d923Contents/Resources/gui/distnull/usr/bin/ocx, started byocx ensurefrom the Codex shimGET /returned the "GUI build not found" JSON (see #6720)The macOS run used
609bc8d923.d73bd2b230only addsfindGuiDist()'s optional lookup object and tests. A call without arguments, which is what every production caller makes, resolves exactly as before. Theplatform-macosCI leg does not run for this path, so this M1 run is the macOS hardware evidence.A side note from that run, unrelated to this PR: on macOS 27.0.1, Bun 1.4.0's
bun build --compileleft the probes' ad-hoc signature invalid. The first run of each probe was SIGKILLed (exit 137), and re-signing withcodesign --force --sign -fixed it. The shipped 2.80.0ocxis Developer ID signed and verifies. This only matters to someone buildingocxlocally on macOS.Not tested on hardware:
ocxagainst a packaged layout, to avoid touching the proxy already running on this machine. The served-index path is covered by the probes and the session test above.Other checks
bun run test:changed(merge basebbab02ab27): 3007 pass / 31 skip / 0 fail across 146 files.bun run testat609bc8d923(the fix commit; the second commit only adds tests and the lookup object): run in two parts.tests/storage/storage-restore-job-responsive.test.ts). The runner stopped with 371 files not started.bun run typecheck,bun run structure:check,bun run privacy:scan: pass.Unrelated test failures on this host (the test cases need an update)
These fail identically with and without this change. I ran each file on its own against both this branch and
dev'ssrc/server/gui-static.ts, with the same pass and fail counts. They come from the test machine, not from this PR, and should be fixed in the tests:tests/clients/link-ssh-argv.test.ts(2 tests: "the remote prelude appends ~/.bun/bin after the remote PATH and keeps every argument" and "the constructed remote command preserves POSIX argument bytes").PATH: "/usr/bin:/bin"as the fake remote PATH. On a host where the Linux desktop package has installed/usr/bin/ocx, that real binary resolves first, which is what the prelude intends ("an ocx the remote PATH already resolves wins"). The stub in~/.bun/bintherefore never runs.shsymlink to/bin/sh(remoteOcxArgvrunssh -c).tests/config/serving-runtimes.test.ts(2),tests/codex-integration/codex-runtime.test.ts(1),tests/cli/cli-connect-readiness.test.ts(1).devon this machine, which has the .debocxand the Codex App runtime installed. For example,resolveCodexRuntimewithPATH: ""returnssource: "installed"where the test expects"fallback".tests/cli/cli-access-audio-live.test.tstimed out under full-suite load and passes on its own (36 / 0).Checklist
structure/dashboard-and-usage.mdstates the new lookup order.structure/ops/service-and-sidecars.mdis still accurate as written.resolveGuiFilePath.ocx, it is no more writable than the existing beside-the-binary candidate or the binary itself.Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
OPENCODEX_GUI_DISToverride retains priority.