Skip to content

[Feature] Launcher shim under OpenCodex Desktop: Desktop-aware ensure cold start, then allow install/repair from the dashboard #6971

Closed

Description

@lidge-jun

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:

  1. The Desktop sidecar inherits the GUI PATH (desktop/src-tauri/src/sidecar.rs adds only two variables; Finder/login launches get /usr/bin:/bin:/usr/sbin:/sbin). A dashboard-triggered codex-shim install then scans that PATH and reports "Native Codex launcher not found" for Homebrew, npm, bun, nvm/fnm/volta/mise installs; an npm launcher also lacks node for the install probe.
  2. Overlay health (overlayDiagnostic in src/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

  1. added
    enhancement
    on Oct 12, 2026
  2. added
    gui
    service
    on Oct 12, 2026
  3. Ingwannu commented on Oct 12, 2026

    @Ingwannu
    Owner

    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 ensure during 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.

  4. lidge-jun commented on Oct 13, 2026

    @lidge-jun
    OwnerAuthor

    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.
    • Startup safety enables shim Install/Repair under Desktop; the background service guard stays.
    • Under Desktop the dashboard's shim installer gets the user's login-shell PATH, so Homebrew/npm/bun/nvm/fnm/volta/mise Codex installs are found.
    • An intact shim that the dashboard's PATH can't see shows "Installed · activation not confirmed" with the shell step instead of Repair.

    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.

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

    enhancementguiservice

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions