cnx-ios: after a redial the shown browser tab keeps its video; terminals follow a Mac restart

Draft
AZ
17d ago
+2317-69

Fixes the redial defects a fresh verifier found (cnx-ios/verify/transport-verify-20261019.md on feat-cnx-ios-transportverify), on top of the hybrid link (#22337).

What changed

  • Defect 7 (high): the browser tab you're looking at keeps its video after a transport switch or a cnx-hostd restart.
    • The phone reopens only the tab on screen. Hidden tabs open when they are shown.
    • Tabs of workspaces closed on the Mac are dropped when the Mac's workspace list arrives.
    • The tab on screen tells the Mac with rb.visibility. cnx-hostd gives it back the media lane, starting at a keyframe. This works on WireGuard RTP, the WebRTC media session (hybrid) and WebRTC-only.
    • cnx-hostd's host limit now stops idle hosts first, then hidden tabs, then the tab on screen. It closes the stopped tab with evicted instead of replaced.
    • A page cnx-hostd stopped reopens at its current address. It does this twice at most, then shows a Reopen button.
    • New browser workspaces keep their page when the Mac assigns the real tab id.
  • Defect 2 (medium): a terminal reattach looks up its terminal by terminal_id with resolve-terminal before it attaches. If the Mac's daemon restarted, the surface number has changed and the reattach follows it.
    • If the Mac no longer has the terminal, the terminal says so in one line.
    • A terminal the daemon is still restoring is retried.
    • When retries run out, the terminal says so, and the next keystroke tries again.
  • Defect 4 (low): Settings shows "UDP blocked" only for WireGuard.

Details, tests and live numbers: cnx-ios/verify/redial-video.md. Contract: PROTOCOL.md browser.

Tests

  • The failing tests were committed before the fixes.
  • Swift on mini-cmux11s: CnxLive, CnxBrowserStream, CnxModel, CnxTransport, CnxShell and CnxWorkspaces, 426 tests passing.
  • Rust on rbx: cargo test --workspace and clippy -D warnings, both green.
    • The new lane tests fail without the fix on all three carriers and pass with it.

Review

Two fresh review subagents checked correctness: one after the first fix, one after the live fixes. Every finding and how it was handled is in redial-video.md. Two items are still open:

  • The shown tab's rb.visibility reminder and a hidden tab's open travel on different channels, so they can arrive at hostd out of order. Fixing this needs visibility inside rb.open, which is a hostd change.
  • A renamed placeholder's Mac host stays until the host limit stops it.

Live check (real link, mini-cmuxs-mac-mini-3)

The phone opens two browser workspaces, the Mac closes one, and the other stays on screen. Then cnx-hostd is killed, or the transport is switched in Settings. This ran on WireGuard-only, hybrid and WebRTC-only.

  • Every row came back on the right carrier: wg-rtp on WireGuard-only, track on hybrid and WebRTC-only.
  • The overlay showed 25 to 48 fps, and the bench measured 27 to 33 fps with glass-to-glass p50 of 60 to 82 ms.
  • After each event hostd saw one browser open (the verifier saw 3 to 5) and stopped no host.

Terminal: the Mac app was quit, killed, and killed together with its daemon (surfaces renumbered from 269 to 394). Each time, a command typed on the phone reached the same terminal, with no [unknown surface].

Several bugs were found and fixed during the live check:

  • A page reopened after a cnx-hostd restart came back blank.
  • A page stayed hidden on the Mac after the next link opened it.
  • A new browser workspace lost its page when the Mac named the tab.
  • A page could be marked hidden while it was on screen.
  • resolve-terminal answered terminal_not_found for a moment after a Mac app restart, which ended a live terminal.

Changelog

none (cnx-ios is unreleased)

šŸ¤– Generated with Claude Code