← Back to PRs

#8260: fix(macOS): gateway readiness detection + reversible Configure later

by xksteven open 2026-02-03 20:15 View on GitHub →
app: macos commands stale
## Summary Fixes #6156 - **Early bailout on startup failure**: `waitForGatewayReady()` now checks `GatewayProcessManager.status` each poll iteration — if the gateway startup already failed (e.g. CLI not found), it returns immediately instead of wasting the full timeout. - **Surface actual failure reason**: The onboarding wizard now shows the real error (e.g. "openclaw CLI not found. Install it (npm i -g openclaw) or add it to your PATH.") instead of the generic "Gateway did not become ready." - **Reversible "Configure later"**: A "Run Setup…" button now appears in the menu bar when `connectionMode == .unconfigured`, calling the existing `DebugActions.restartOnboarding()`. - **CLI IPv6 fallback**: `probeGatewayReachable()` retries with `[::1]` when `127.0.0.1` fails (uses the correct WebSocket protocol via `callGateway`). ## Root Cause `setActive(true)` fires `enableLaunchdGateway()` in a background Task. When the `openclaw` CLI isn't found, that method fails immediately and sets `status = .failed(reason)`. But `waitForGatewayReady()` never checked for this — it kept polling the WebSocket health endpoint for the full 12-second timeout, then threw a generic error that hid the actual cause. ## Files Changed | File | Change | |------|--------| | `GatewayProcessManager.swift` | +2 lines: early bailout when `status == .failed` | | `OnboardingWizard.swift` | Surface actual failure reason from process manager status | | `GatewayEnvironment.swift` | Better error message suggesting `npm i -g openclaw` | | `MenuContentView.swift` | "Run Setup…" button when unconfigured | | `onboard-helpers.ts` | IPv6 loopback fallback in CLI gateway probe | | `onboarding.ts` | Use `resolvedUrl` from probe result | | `CHANGELOG.md` | Changelog entries | ## Testing Done - Built macOS app locally via `scripts/package-mac-app.sh` (ad-hoc signed) - Launched app without `openclaw` CLI globally installed — confirmed the error now surfaces the actual reason ("openclaw CLI not found") immediately instead of polling for 12 seconds and showing a generic message - Verified the "Run Setup…" button appears in the menu bar when connection mode is unconfigured 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR improves macOS onboarding and gateway startup UX by (1) bailing out of `waitForGatewayReady()` immediately if the gateway process is already in a `.failed` state, (2) surfacing the underlying failure reason in the onboarding wizard instead of a generic timeout message, (3) adding a reversible “Run Setup…” menu bar action when the app is unconfigured, and (4) improving the CLI onboarding probe by retrying loopback connectivity via IPv6 (`[::1]`) and threading through a `resolvedUrl`. The changes fit into the existing architecture by reusing `GatewayProcessManager.status` as the single source of truth for startup failure state on macOS, and by keeping the gateway health check logic centralized in `probeGatewayReachable()`/`callGateway()` for the CLI wizard. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge; the changes are localized and mostly improve error reporting and readiness detection. - Mac app changes are small and leverage existing state (`GatewayProcessManager.status`) without changing startup mechanics. The main risk area is the new IPv6 fallback URL rewrite in the CLI probe, which currently uses substring matching and string replacement and could mis-handle edge-case URLs. - src/commands/onboard-helpers.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs