Register-when-ready Iroh hosts, bounded dial phases, cold-start release gate
Fixes https://github.com/manaflow-ai/cmux/issues/9724 in three layers.
Summary
- Mac register-when-ready: automatic-mode host startup starts relay activation eagerly and gives the relay a bounded window (
automaticRelayReadinessTimeout, default 5s) to become usable, so the binding published at activation carries post-attach dialable hints instead of the half-ready bootstrap snapshot phones were racing. Only the cancellation-safewaitForUsableHomeRelayis awaited; timeout, broker error, or a hung credential install publishes the bootstrap policy exactly as before and leaves repair to the standard refresh-on-online path. Direct-only startup still skips readiness; the strict relay-only barrier is unchanged. - Bounded dial phases:
CmxIrohClientSession.establishConnectionawaitedendpoint.connectwith no clock on either the public or the private-fallback phase, which is where the dogfood trace burned a 16.2s hang against stale hints. Each phase now races the fork's cancellable ConnectAttempt againstdialPhaseTimeout(default 5s); expiry cancels the FFI dial promptly, surfacesdialTimedOut(diagnostic kindtimedOut), and a timed-out public phase still falls through to the private fallback. - Cold-start release gate: new
--mode cold-start(GATE_SCENARIO=cold_start_dial) pins the launch-to-usable deadline to 20s on the gate's phone launch against the freshly relaunched Mac, making this race a permanent tripwire. Also selectable in the iroh-release-gate workflow matrix.
Evidence base: decoded cmuxdiag timeline from the PR 9430 dogfood round (discovery succeeded at t+7s; dial 1 connected then failed pairing after 7.6s; dial 2 hung 16.2s; dial 3 connected in 455ms; usable at ~t+43s), full decode in the issue.
Verification
- Red/green regression pair for register-when-ready: commit 6c2984a123 adds the failing test (automatic startup published bootstrap hints, one registration), commit feb58d3407 turns it green.
- swift test --package-path Packages/Shared/CmuxIrohTransport: 572 tests, 64 suites, all pass, including the new hung-dial bound test and the credential-installation race test updated to the bounded contract.
- swift build --package-path Packages/iOS/CmuxMobileShell compiles the new scenario case.
Build and behavior verification (2026-08-07, tag irdy)
- The app-target build caught a non-exhaustive scenario switch in the release-gate probe, fixed in 1cd310bef7 (cold-start reuses the standard probe legs).
- macOS + iOS simulator builds green on tag irdy; sim app signed in and attached to the tagged Mac (workspace list live).
- Behavior preflight of the fixed path: quit and relaunch the tagged Mac with the sim app open; the sim's terminal-events subscription re-established 22s after relaunch, including full Mac cold start, with no hung-dial churn. The pre-fix baseline on tag asrm was 70+ seconds with a 16.2s transportDialFailed hang (https://github.com/manaflow-ai/cmux/issues/9724).
- iPhone: dev.cmux.ios.irdy built, signed, and installed on the personal iPhone; the signed launch retry is pending the phone being awake.
Pending verification
- Runner admission test for the new scenario: hosted iOS lane dispatched at head 1cd310bef7 (plus the PR 9668 test-compile fix on throwaway branch ci-irdy-gate-verify): https://github.com/manaflow-ai/cmux/actions/runs/31215706452
- A cold-start gate run (
--mode cold-start) on this branch. - Dogfood round on the phone.
Deferred (documented in the issue)
- Server-side
readyflag on iroh_endpoint_bindings needs a schema migration via the cloud-vm-ops flow; this PR is client-only. - Between-retry hint re-fetch on iOS (registry context provider snapshot caches) is the remaining Layer 2 half, follow-up PR.
Notes
- no autoreview, Codex review, Claude review, or second-model review was invoked
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
[!NOTE]
Cursor Bugbot is generating a summary for commit 1592f48833fe8d2bd4fe3785c85c96c909d03e7e. Configure here.
Summary by cubic
Prevents long post-restart dial hangs by publishing relay-ready hints during automatic host startup and by bounding each dial phase. Adds a cold-start release gate that relaunches the Mac and enforces a 20s launch-to-usable deadline via the orchestrator.
-
Bug Fixes
- Automatic-mode
CmxIrohHostRuntimeeagerly activates relay and waits up to 5s for readiness before publishing; on timeout/error it publishes bootstrap and refreshes later. Direct-only behavior is unchanged. CmxIrohClientSessionbounds each dial phase withdialPhaseTimeout(default 5s); expiry cancels the connect, surfacesdialTimedOut, and public timeouts still fall back to private paths.- Diagnostic mapping adds
.timedOutfordialTimedOut.
- Automatic-mode
-
New Features
- Release-gate mode
cold-start(cold_start_dial) with a 20s launch-to-usable deadline; added to the workflow matrix, runner admission, probe switch, andscripts/run-iroh-release-gate.sh. The probe reuses standard usability checks; timing is enforced by the script.
- Release-gate mode
Summary by CodeRabbit
-
New Features
- Added cold-start release-gate testing for recently launched devices.
- Added configurable connection and relay-readiness timeouts.
- Added explicit timeout reporting for connection attempts.
- Improved automatic relay startup and route publication.
-
Bug Fixes
- Prevented stalled connections from blocking session establishment.
- Improved startup when relay credentials or bindings are temporarily unavailable.
-
Tests
- Added coverage for stalled dialing, cold-start scenarios, relay readiness, and startup lifecycle races.