Repository navigation
fix(macos): first-run gateway startup survives state migrations - #121012
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 9, 2026, 5:48 AM ET / 09:48 UTC. ClawSweeper reviewWhat this changesThe PR gives macOS Gateway launch commands, first-run readiness polling, and onboarding activation a 120-second migration allowance and retries readiness after a failed startup owner. Merge readiness⛔ Blocked by patch quality or review findings - 9 items remain Keep this maintainer PR open: it addresses a real macOS first-run failure, but the proposed shared timeout both remains shorter than the core migration lease and unintentionally lengthens shutdown blocking. Priority: P1 Review scores
Verification
How this fits togethermacOS onboarding starts the local Gateway through launchd and waits for its health endpoint. Core startup may perform state integrity work and migrations before that endpoint is ready, while the app must also preserve bounded stop-to-start lifecycle transitions. flowchart LR
A[macOS onboarding] --> B[Gateway launch command]
B --> C[Core state migration lease]
C --> D[Gateway health endpoint]
D --> E[Mac readiness waiter]
E --> F[Setup success or retryable failure]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceDocs +1, Other +11. Total +12 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the core migration lease as the authoritative first-run policy, scope any longer timeout to startup operations only, and retain the short bounded timeout for uninstall and other shutdown work. Do we have a high-confidence way to reproduce the issue? Yes: source establishes both a legitimate core migration lease beyond 120 seconds and a stop-to-start path that waits for a pending uninstall task; focused regression tests can inject those two conditions. Is this the best way to solve the issue? No: a fixed shared 120-second default is not the core lease-backed policy and also applies to shutdown; the longer allowance must be scoped to startup operations and aligned with the owner lease. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 135278c8968f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…claw#121012) * fix(macos): tolerate first-run state migrations during gateway start * fix(macos): tolerate loaded-host version probes
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where fresh macOS onboarding could report “The Gateway didn’t start” while healthy first-run state integrity checks and migrations were still running.
The reproduced sequence was:
Why This Change Was Made
The Mac app owned shorter watchdogs than the CLI startup-migration lifecycle it launched: daemon mutations were killed after 15–20 seconds, fresh-install readiness stopped after 60 seconds, and onboarding’s follow-up health audit stopped after 12 seconds. One named 120-second first-run tolerance now governs daemon mutations, fresh-install readiness, and onboarding’s bounded follow-up audit.
The readiness waiter now continues with its own health re-check when the startup owner finishes with a prior failure, while preserving cancellation and generation guards. This avoids duplicating the CLI’s startup-migration lease policy or adding IPC. After the full budget expires, the existing visible error remains unchanged.
The CLI-page activation path was also checked against the attach-only marker and already honors
~/.openclaw/disable-launchagent; it does not bypass the marker.User Impact
Fresh macOS setup now waits for legitimate first-run migration work and proceeds as soon as Gateway health becomes ready, instead of manufacturing a setup failure while migration is still making progress. Truly stalled starts remain bounded and keep the existing retryable error.
Evidence
cd apps/macos && swift build— passed (Build complete! (36.82s)).swift test --filter GatewayProcessManagerTests— 41 tests passed, including owner failure followed by bounded readiness recovery.swift test --filter GatewayLaunchAgentManagerTests— 9 tests passed.swift test --filter CLIInstallerTests— 20 tests passed.swiftformat --linton all five touched Swift files — clean.node scripts/check-changed.mjs -- <changed files>— passed on Blacksmith Testbox; 5 Vitest shards passed and the native-state schema guard remained at v6.