Skip to content

Fix CLI onboarding detection and launch routing#415

Merged
Cheggin merged 1 commit intomainfrom
fix/onboarding-cli-launch-router
May 7, 2026
Merged

Fix CLI onboarding detection and launch routing#415
Cheggin merged 1 commit intomainfrom
fix/onboarding-cli-launch-router

Conversation

@Cheggin
Copy link
Copy Markdown
Collaborator

@Cheggin Cheggin commented May 7, 2026

Summary

  • Gate Claude/Codex onboarding auth/API-key flows on real CLI install status so missing CLIs show install actions first.
  • Route CLI launches through one shared PATH/router layer for macOS, Linux, and Windows, including Windows npm shim resolution and macOS Codex.app bundled CLI locations from fix(mac): find bundled Codex app CLI #413.
  • Run installers in the background, resolve from the installer process close event, and return exit code/signal/output tails plus post-exit install probe state.
  • Keep onboarding install detection polling after installer completion so delayed CLI availability updates the UI instead of leaving stale install cards.

Verification

  • npm run test
  • task typecheck
  • npm run lint -- --quiet
  • git diff --check origin/main...HEAD

Notes

Manual full Electron installer flows on physical Windows/Linux machines were not run.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 11 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/hl/engines/pathEnrich.ts">

<violation number="1" location="app/src/main/hl/engines/pathEnrich.ts:127">
P2: Windows npm prefix handling adds the wrong directory (`prefix\\bin` instead of `prefix`), which can prevent custom-prefix global CLIs from being found.</violation>
</file>

<file name="app/src/renderer/onboarding/OnboardingApp.tsx">

<violation number="1" location="app/src/renderer/onboarding/OnboardingApp.tsx:503">
P2: Installation status is refreshed only once after 3s, so successful installs that finish later can remain undetected and leave onboarding UI in a stale state.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread app/src/main/hl/engines/pathEnrich.ts Outdated
Comment thread app/src/renderer/onboarding/OnboardingApp.tsx Outdated
@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from 18c21ba to 664562d Compare May 7, 2026 20:07
Comment on lines +105 to +109
child = spawn(spawnSpec.command, spawnSpec.args, {
env: spawnSpec.env,
stdio: ['ignore', 'pipe', 'pipe'],
...spawnSpec.spawnOptions,
});
@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from 664562d to f07190c Compare May 7, 2026 20:19
@Cheggin
Copy link
Copy Markdown
Collaborator Author

Cheggin commented May 7, 2026

@cubic review

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented May 7, 2026

@cubic review

@Cheggin I have started the AI code review. It will take a few minutes to complete.

@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from f07190c to c813575 Compare May 7, 2026 20:27
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 20 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/renderer/hub/ConnectionsPane.tsx">

<violation number="1" location="app/src/renderer/hub/ConnectionsPane.tsx:266">
P2: The install flow now sets a persistent error on any immediate `installed=false` probe, which can produce stale false-failure messages when CLI detection lags briefly after installer exit.</violation>
</file>

<file name="app/src/preload/shell.ts">

<violation number="1" location="app/src/preload/shell.ts:231">
P2: `engineInstall` preload typing is missing `stdout`/`stderr`, so renderer consumers can’t use installer output tails returned by IPC.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread app/src/renderer/hub/ConnectionsPane.tsx Outdated
Comment thread app/src/preload/shell.ts
@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from c813575 to 260075f Compare May 7, 2026 20:34
@Cheggin
Copy link
Copy Markdown
Collaborator Author

Cheggin commented May 7, 2026

@cubic review

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented May 7, 2026

@cubic review

@Cheggin I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 21 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/renderer/hub/EnginePicker.tsx">

<violation number="1" location="app/src/renderer/hub/EnginePicker.tsx:221">
P1: `installing` is cleared immediately after one status probe, so delayed install detection can regress to a stale “Install” state instead of continuing to wait/poll.</violation>
</file>

<file name="app/src/main/identity/codexLogin.ts">

<violation number="1" location="app/src/main/identity/codexLogin.ts:60">
P1: `resolveCliLaunch` options are being dropped, so Windows shim launches can be mis-quoted and fail in the PTY login path. Preserve and apply `resolved.spawnOptions` when spawning.</violation>
</file>

<file name="app/src/main/hl/engines/installer.ts">

<violation number="1" location="app/src/main/hl/engines/installer.ts:173">
P2: When the process is killed by an external signal (not the timeout), `exitCode` is `null` and `signal` is set, but the error message interpolates `exitCode` directly, producing "installer exited null". Include the signal in the fallback message for a meaningful error.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread app/src/renderer/hub/EnginePicker.tsx
Comment thread app/src/main/identity/codexLogin.ts Outdated
Comment thread app/src/main/hl/engines/installer.ts Outdated
@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from 260075f to 2940598 Compare May 7, 2026 21:03
@Cheggin
Copy link
Copy Markdown
Collaborator Author

Cheggin commented May 7, 2026

@cubic review

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented May 7, 2026

@cubic review

@Cheggin I have started the AI code review. It will take a few minutes to complete.

@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from 2940598 to a54345f Compare May 7, 2026 21:05
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 21 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/renderer/onboarding/OnboardingApp.tsx">

<violation number="1" location="app/src/renderer/onboarding/OnboardingApp.tsx:339">
P2: Using a single `installingEngine` value causes incorrect install-button state when installs overlap, so one provider can appear idle while its installer is still running.</violation>

<violation number="2" location="app/src/renderer/onboarding/OnboardingApp.tsx:1171">
P3: Codex install UI text still tells users to run a manual npm command, but this button now launches the installer automatically.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread app/src/renderer/onboarding/OnboardingApp.tsx Outdated
Comment thread app/src/renderer/onboarding/OnboardingApp.tsx Outdated
Codex and Claude onboarding now separate CLI installation from authentication, so missing CLIs show install actions instead of sign-in prompts. CLI launches use one high-level router that enriches GUI PATHs on macOS/Linux/Windows, includes Codex.app bundle locations on macOS, and resolves Windows npm shims before spawning.

Installer actions now run in the background and resolve from the installer process close event. The result includes completion status, exit code/signal, output tails, and a post-exit install probe; onboarding keeps polling after installer completion so delayed CLI detection still updates the UI.

Constraint: Electron GUI launches can miss user shell PATH entries, Codex.app can ship its CLI inside the macOS app bundle, and Windows npm-installed CLIs often resolve to .cmd or .ps1 shims.

Rejected: Keep per-call Windows launch fixes | leaves Codex PTY login and future CLI calls easy to miss.

Rejected: Poll with fixed timers after install start | does not distinguish slow installs, failed installs, or hung installers.

Confidence: high

Scope-risk: moderate

Tested: npm run test

Tested: task typecheck

Tested: npm run lint -- --quiet

Tested: git diff --check origin/main...HEAD

Not-tested: Manual Windows/Linux Electron installer flow on physical machines

Co-authored-by: Rich <admin@atomtan.studio>
@Cheggin Cheggin force-pushed the fix/onboarding-cli-launch-router branch from a54345f to ce4fa4f Compare May 7, 2026 21:13
@Cheggin
Copy link
Copy Markdown
Collaborator Author

Cheggin commented May 7, 2026

@cubic review

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented May 7, 2026

@cubic review

@Cheggin I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 22 files

@Cheggin Cheggin merged commit 72fd656 into main May 7, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants