Repository navigation
Description
Area
Service lifecycle
What are you trying to accomplish?
Install and repair the Codex launcher shim from the dashboard (Startup → Protection details) while OpenCodex Desktop runs the proxy, so a Codex CLI launch brings the proxy back when the Desktop app is not running. Reported in #6963.
What prevents this today?
While Desktop owns or supervises the runtime, gui/src/pages/startup-sections.tsx disables shim Install/Repair together with the background service (desktopManagesStartup), and the recovery panel hides ocx codex-shim install. That gate is deliberate for the shim too: an ordinary Codex launch through the shim runs ocx ensure, and handleEnsure (src/cli/index.ts) spawns a detached CLI proxy whenever no live proxy answers. During a Desktop restart backoff, or after Desktop quits while its durable claim remains, that CLI proxy takes the port and Desktop comes back as a guest, losing supervision.
Two more gaps sit behind the gate:
- The Desktop sidecar inherits the GUI PATH (
desktop/src-tauri/src/sidecar.rsadds only two variables; Finder/login launches get/usr/bin:/bin:/usr/sbin:/sbin). A dashboard-triggeredcodex-shim installthen scans that PATH and reports "Native Codex launcher not found" for Homebrew, npm, bun, nvm/fnm/volta/mise installs; an npm launcher also lacksnodefor the install probe. - Overlay health (
overlayDiagnosticinsrc/codex/shim-overlay.ts) judges activation against the proxy process's own PATH, so a shell-activated shim reads "Stale" with a Repair button when the proxy runs under Desktop, and reinstalling cannot change that.
What should OpenCodex do?
- Define
ensure's cold-start behavior under Desktop ownership and unowned supervision (for example, launch or wait for the Desktop app instead of spawning a CLI proxy, and fall back only when Desktop is absent), with isolated tests for live reuse, Desktop restart gaps, stopped Desktop with a retained claim, and consent preservation. - Then unblock shim install/repair in the dashboard while keeping the service guards.
- Give the dashboard installer a bounded, asynchronous way to discover Codex in the user's login shell PATH (deadline, process-group cleanup, PATH-only output, negative caching), kept separate from the service plist PATH.
- Report shim activation against the user's shell, or as unverified, instead of the sidecar PATH; offer the activation step instead of Repair for an intact inactive wrapper.
Example usage or interface
Startup → Protection details under Desktop: "Codex launcher shim — Install" enabled; after install the row says "Installed; add . ~/.opencodex/codex-shell-env.sh to your shell startup file" until the shell activates it.
Alternatives or workarounds
Turn on Start at Login in the OpenCodex menu (Desktop protection). Or quit OpenCodex and run ocx codex-shim install / ocx service install from a terminal to move startup management to the CLI.
Additional context
Investigation and audit notes: devlog/_plan/261012_6963_desktop_codex_shim/ (000, 010, 020). The partial fix for #6963 lands separately.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Activity
Ingwannu commentedon Oct 12, 2026
Triaging this separately from the compiled installer argv fix in #6980: that PR deliberately retains the Desktop-owned/supervised shim-install guard, so it does not implement this feature.
The design decision is the owner of
ocx ensureduring a Desktop restart gap. Before allowing the dashboard action, please specify the existing owner/lease to reuse, bounded cold-start acknowledgement, concurrent ensure deduplication, explicit failure when Desktop cannot start, and when a stopped Desktop may intentionally hand over to a CLI service. A missing Desktop process alone must not silently authorize a competing proxy. Runtime/PATH candidate discovery from #6973 can be composed with this but is not ownership proof.Keeping this open for project-owner lifecycle acceptance, not implementing a second supervisor or changing live Desktop/service/shim configuration as part of triage.
fix(startup): dashboard installer on compiled ocx and clearer Desktop…
fix(startup): fail closed on unknown Desktop evidence and harden laun…
fix(startup): user-scoped Linux Desktop detection and generation leas…
fix(startup): stand down when a higher Desktop launch generation exis…
fix(startup): rule out non-dumpable Linux processes by comm and requi…
fix(startup): keep the newest launch generation and refuse on hidden …
fix(startup): keep handleEnsure's live branch in place for the Deskto…
test(startup): order-free procfs fixture; colon-only login PATH merge (…
pr-assets: #6971 Startup Desktop shim screenshot
fix(startup): let the Codex shim run under OpenCodex Desktop without …
lidge-jun commentedon Oct 13, 2026
Fixed by #7032, squash-merged into dev as 148cfef (not yet released).
ocx ensure(run by the shim before every Codex launch) no longer starts a CLI proxy while OpenCodex Desktop owns or runs the runtime. It waits for a running Desktop (up to 40 s, covering the restart backoff) and relaunches a claimed macOS Desktop hidden, with one launch per cold start. Otherwise it fails with guidance, and that includes when ownership or the process list can't be verified.Remaining limits: Desktop relaunch is macOS only, so on Linux/Windows a claimed but stopped Desktop gets an explicit error instead of a proxy. A proxy stopped on purpose from the Desktop menu makes each shim launch wait up to 40 s before that error.