Skip to content

fix(setup): resolve fresh-user setup, binary detection, and bootstrap dead ends - #1555

Merged
Juliusolsson05 merged 4 commits into
mainfrom
fix/fresh-user-setup-and-bootstrap
Nov 28, 2026
Merged

Juliusolsson05 merged 4 commits into
mainfrom
fix/fresh-user-setup-and-bootstrap

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

Summary

Fixes the highest-impact fresh-user onboarding and setup dead ends found in our day-1 audit:

  1. Live provider enablement sync & 0-provider PathPickerModal — setup:check and setup:set-tool-path now sync newly detected providers into providerEnablement and broadcast provider-enablement:changed (no restart required to see newly installed CLIs in ⌘T). When 0 providers are enabled, PathPickerModal offers Open Setup and a Terminal option instead of silently submitting claude.
  2. Gatekeeper / XProtect probe resilience — probeExecutable now has an 8s timeout (SIGKILL on hang) and evicts rejected entries from execProbeCache so Retry works after clearing quarantine without restarting.
  3. Bundled OpenCode exec verification — prerequisites.ts probes bundled opencode via resolveBundledTool (while keeping 87 MB mitmdump tarball extraction lazy) and honors valid manual overrides above bundled tools.
  4. SetupGate UX fixes — Pressing Enter in the manual path input submits the path without closing SetupGate (data-owns-enter + confirmOnEnter={false}); setup:set-tool-path expands ~/; Change Path… is available on Found/Bundled provider rows; SetupGate renders error state + Retry when requested && error even if check === null.
  5. Noisy .zprofile & missing macOS bin dirs + check dedupe — binaryResolver.ts reads the last non-empty line of zsh -lc stdout and adds ~/.local/share/mise/shims, ~/Library/pnpm, ~/.npm-global/bin, and ~/.claude/local; concurrent checkPrerequisites() calls deduplicate with { force: true } + monotonic generation guards on post-mutation callers.

Linked Issues

Fixes #1553

Plan & Review Disposition (one round, independent read-only reviewer)

Plan: docs/plans/2026-11-27-fresh-user-setup-and-bootstrap.md

Finding Verdict Disposition
Stale in-flight checkPrerequisites() coalescing across setup mutations valid fixed in 611fb24ed ({ force: true } + checkGeneration guard)
Race between detectInstalledKinds() and syncDetectedProvidersFromCheck() valid fixed in 611fb24ed (detectionGeneration guard)
Eager 87 MB mitmdump tarball extraction on fresh launch valid fixed in 611fb24ed (kept mitmdump lazy via isBundledArchiveAvailable)
Enter in manual path input skipped busy === null guard & left ↩ chip visible valid fixed in 611fb24ed

Verification

  • npm run typecheck: passed (0 errors).
  • npx vitest run src/main/setup/ src/main/ipc/setup.test.ts src/renderer/src/features/setup/ src/renderer/src/features/path-picker/ src/renderer/src/components/ui/dialog-actions.renderer.test.tsx: 15/15 files, 89/89 tests passed.

…ication

Refs #1553

- Parse the last non-empty line of login-shell stdout so noisy .zprofile banners do not break command -v detection, and scan ~/.local/share/mise/shims, ~/Library/pnpm, ~/.npm-global/bin, and ~/.claude/local.
- Add an 8s timeout to probeExecutable (killing Gatekeeper/XProtect stalls) and evict failed probes from execProbeCache so Retry re-probes cleanly.
- Resolve bundled tools via resolveBundledTool instead of isBundledArchiveAvailable so unrunnable bundled binaries fall back to system PATH or manual/install flows, and honor valid manual overrides above bundled binaries.
- Deduplicate concurrent in-flight checkPrerequisites() calls on startup.
…athPicker UX

Refs #1553

- Sync newly discovered providers from setup:check and setup:set-tool-path into providerEnablement and broadcast provider-enablement:changed so PathPickerModal updates without an app restart.
- When zero providers are enabled in PathPickerModal, show an inline Open Setup action and open a Terminal tab instead of silently submitting DEFAULT_PROVIDER ('claude').
- Prevent Enter inside SetupGate's manual path input from closing the dialog via DialogActions, expand leading ~/ in setup:set-tool-path, expose Change Path... on Found/Bundled provider rows, and render the error + Retry state when requested with check === null.
…tighten SetupGate Enter

Refs #1553

Address PR review findings:
- Add { force?: boolean } and monotonic checkGeneration to checkPrerequisites() so post-mutation callers never coalesce onto a stale pre-mutation check and older checks cannot clobber newer write-backs or toolchain state.
- Add monotonic detectionGeneration guard in providerEnablement.ts so an older in-flight detectInstalledKinds() cannot overwrite a newer syncDetectedProvidersFromCheck().
- Keep mitmdump on lazy isBundledArchiveAvailable so fresh startup does not block on extracting an 87 MB tarball, while continuing to probe bare-binary opencode via resolveBundledTool.
- Guard SetupGate manual path Enter with busy === null and hide DialogActions' Enter key chip while editing a path.
@Juliusolsson05
Juliusolsson05 merged commit 78a6780 into main Nov 28, 2026
2 checks passed
@Juliusolsson05
Juliusolsson05 deleted the fix/fresh-user-setup-and-bootstrap branch November 28, 2026 00:47
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.

fix(setup): resolve fresh-user setup, binary detection, and bootstrap dead ends

1 participant