Stabilize Iroh multi-Mac sessions and sign-out cleanup
Merged
AZ
3mo ago+1055+1055+0123456789012345678901234567890123456789-77-77-01234567890123456789
Fixes three observed INTERNAL failures:
- Keep IRX host QUIC sessions alive when control traffic is idle; legacy TCP keeps its 30s idle guard.
- Prevent a second control client from forcing an explicit session replacement and host-shutdown/redial storm; release the lane claim when the owner closes.
- Reconcile the first signed-out auth observation so stale Iroh endpoint identity, binding, and app-instance state are erased on cold launch while the stable device ID remains.
Tests include host control-idle lifecycle behavior and cold signed-out identity cleanup. Focused source parsing and git diff checks pass; hosted checks still need to run.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes three internal Iroh failures and adds direct and authenticated LAN path discovery, including explicit direct-dial allowlists, so IRX peers can dial without the relay.
- IRX host QUIC sessions ignore the 30s control idle timeout; legacy TCP keeps it.
- A second control client gets a transient closed error instead of replacing the live QUIC session; the lane claim releases when the owner closes.
- The first signed-out auth observation now always reconciles, erasing stale endpoint identity, binding, and app-instance state on cold launch while keeping the stable device ID; IRX network path observation stops on sign-out and cancels queued starts so it can't repopulate LAN authorization for the next account.
- Discovery refresh replaces stale path hints, so a retired relay or direct hint is cleared instead of retained.
Direct and LAN paths
- IRX host publishes observed direct candidates in broker registrations and the public status route; relay-only mode advertises none.
- Client dials refresh direct hints from discovery and adopt authenticated Bonjour LAN peers, sharing network path state with the legacy runtime.
- Network changes invalidate cached direct routes and abort in-flight dials so stale coordinates are never used.
- Explicit direct dials are a fail-closed allowlist; port-less candidates use the broker's published per-family port, and a changed intent replaces the session.
- Private Addresses from the legacy store join automatic dials when the Mac advertises
iroh.private_paths.v1; a new settings adapter routes private-address reads and writes to IRX so switching transports never loses user routes.
Summary by CodeRabbit
- New Features
- Added automatic LAN peer discovery and authenticated direct-connection support.
- Advertised validated direct network addresses alongside relay routes for faster local connections.
- Added support for user-pinned direct routes, including relayless and offline connections.
- Bug Fixes
- Prevented healthy multi-lane connections from closing due to control-idle timeouts.
- Improved control-lane contention handling and connection cleanup.
- Fixed cold signed-out launches so stale endpoint identity is cleared and regenerated correctly.
- Tests
- Added coverage for direct routing, idle timeouts, contention, and signed-out recovery.