Repository navigation
fix(macos): fail promptly after terminal gateway startup errors - #126697
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 11:01 AM ET / 15:01 UTC. ClawSweeper reviewWhat this changesThe PR makes macOS Gateway activation return the recorded terminal startup failure instead of probing for up to the migration timeout when no recovery evidence exists. Merge readinessKeep open. This is a focused, source-backed macOS lifecycle repair; no blocking correctness or security finding was identified, but the active maintainer-labeled PR should remain open through exact-head native validation. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togethermacOS onboarding and local-mode setup activate a launchd-managed local Gateway, then wait for readiness before continuing. The Gateway lifecycle owner records whether a launch attempt, candidate process, or retained failure can still recover and reports the resulting state to the installer and onboarding UI. flowchart LR
A[Onboarding or local setup] --> B[Gateway lifecycle owner]
B --> C[Attach or launchd startup]
C --> D{Recovery evidence?}
D -->|Yes| E[Bounded readiness probe]
D -->|No, terminal failure| F[Return recorded failure]
E --> G[Ready or recorded timeout]
F --> H[Installer and onboarding outcome]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceOther +10. Total +10 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the lifecycle decision in GatewayProcessManager, retain the zero-probe regression, and merge only after exact-head macOS validation confirms all recoverable launch paths remain intact. Do we have a high-confidence way to reproduce the issue? Yes, source reproducible: current main enters the audit probe after a failed owner state, and the focused fixture can observe that session creation; the read-only review did not execute the native test. Is this the best way to solve the issue? Yes. The lifecycle owner already holds the precise recovery facts, so deciding before the consumer-facing audit avoids masking a terminal failure in onboarding or the installer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 855599d7e940. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Summary
Prevent macOS onboarding and other local Gateway activation callers from stalling after startup has already reached a terminal failure with no process to recover.
GatewayProcessManager.waitForGatewayReadyintentionally keeps probing after some owner failures because a launchd-managed process can become healthy after its initial readiness deadline. That recovery is correct when there is an installed LaunchAgent, a current-generation install, a pending readiness candidate, or a retained process-backed readiness failure. It is incorrect for terminal states such as attach-only/launchd-disabled startup, failed launchd installation, or configuration repair failure when no Gateway process exists. The CLI installer gives this readiness wait a 120-second migration budget, so first-run onboarding could keep spinning long after the actionable failure reason was known.Teach the lifecycle owner to return immediately only when it is already failed and none of those recovery facts exists. Preserve the generation/cancellation guard and every legitimate delayed-start recovery path. Strengthen the existing owner regression to assert that a terminal failure does not create a Gateway WebSocket probe.
This is deliberately distinct from the healthy-Gateway reconciliation in #119850: this change handles only a terminal failure with no launched/recoverable process and does not change onboarding views or install-row ownership.
Validation
session.snapshotMakeCount()was1, proving an unnecessary Gateway probe after the terminal startup failure.--attach-only.07:53:51.321174, followed by downstream control-channel configuration at07:53:51.325855: 4.681 ms from terminal failure to completion of the shared readiness wait. The test profile never started a Gateway; the original app and operator Gateway stayed untouched.Production LOC: +9/-0 (net +9); tests: +2/-1 (net +1). The production growth records the lifecycle-owner distinction between terminal no-process failure and four independent, existing sources of legitimate recovery evidence.
Release note: macOS onboarding now reports terminal local Gateway startup failures promptly instead of potentially waiting through the full startup migration timeout.