M25: the fleet in one page (every host at once) #39

Closed
opened 2026-10-02 04:07:04 +00:00 by jhgaylor · 4 comments
Owner

Depends on: #37; #30 for machines reached only through control's relay (tailnet hosts work without it)
Blocks: #40

Swarm track. The page holds every machine at once, so one view covers all your panes.


Today the page shows one host and connects to whichever is selected (M4a's hosts.ts). Control never sees terminal content, so it can't merge panes on the server side. The merge happens in the browser.

  • Fleet connections:
    • the page opens a summary subscription (M23) to every host in the directory, whether that's control's list or the home daemon's;
    • each host uses its usual transport (tailnet, dial-out, provider tunnel or relay), with its own E2E channel;
    • a pane's output is attached only when you open it;
    • relayed daemons share one WebSocket to control, with each daemon's channel multiplexed inside it. S16: Chrome spaces out WebSocket connections to one address past about 8, so 20 separate relay sockets took 2.2–4.6 s to reconnect after a wake, against 10–21 ms for 8.
  • One model:
    • a pane is (host, pane id);
    • the client keeps a merged list with each host's state (connected, stale with its last-seen time, or offline);
    • an offline host's panes stay in view, greyed, from the last summary.
  • Sleeping sandboxes: provider hosts that are asleep don't get woken just to be counted. They show from the provider's status, and wake when you open one of their panes.
  • Behaving well:
    • reconnects are spread out after a laptop wakes or the network changes, for direct daemons too;
    • a slow or dead host never holds up the others;
    • the connection count has a cap, with a clear notice when it's reached. S16 measured about 14 MB of page memory for 20 daemons and 600 panes, so the cap is about connections, not memory.
  • Done when:
    • geek, jake-mini and a resident sandbox appear together on the laptop over the tailnet, and on the phone through control's relay;
    • unplugging jake-mini greys its panes within 10 s and brings them back when it returns;
    • 20 fake daemons (a test fixture) connect after a simulated wake without a burst of failures.
**Depends on:** #37; #30 for machines reached only through control's relay (tailnet hosts work without it) **Blocks:** #40 *Swarm track. The page holds every machine at once, so one view covers all your panes.* -------- Today the page shows one host and connects to whichever is selected (M4a's `hosts.ts`). Control never sees terminal content, so it can't merge panes on the server side. The merge happens in the browser. - **Fleet connections:** - the page opens a summary subscription (M23) to every host in the directory, whether that's control's list or the home daemon's; - each host uses its usual transport (tailnet, dial-out, provider tunnel or relay), with its own E2E channel; - a pane's output is attached only when you open it; - **relayed daemons share one WebSocket to control**, with each daemon's channel multiplexed inside it. S16: Chrome spaces out WebSocket connections to one address past about 8, so 20 separate relay sockets took 2.2–4.6 s to reconnect after a wake, against 10–21 ms for 8. - **One model:** - a pane is `(host, pane id)`; - the client keeps a merged list with each host's state (connected, stale with its last-seen time, or offline); - an offline host's panes stay in view, greyed, from the last summary. - **Sleeping sandboxes:** provider hosts that are asleep don't get woken just to be counted. They show from the provider's status, and wake when you open one of their panes. - **Behaving well:** - reconnects are spread out after a laptop wakes or the network changes, for direct daemons too; - a slow or dead host never holds up the others; - the connection count has a cap, with a clear notice when it's reached. S16 measured about 14 MB of page memory for 20 daemons and 600 panes, so the cap is about connections, not memory. - **Done when:** - geek, jake-mini and a resident sandbox appear together on the laptop over the tailnet, and on the phone through control's relay; - unplugging jake-mini greys its panes within 10 s and brings them back when it returns; - 20 fake daemons (a test fixture) connect after a simulated wake without a burst of failures.
Author
Owner

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.
Author
Owner

From S16: Chrome spaces out WebSocket connections to one address past about 8 (20 daemons took 2–5 s to reconnect). Carry relayed daemons over one socket to control, and stagger direct reconnects. 20 daemons (600 panes) add about 14 MB to the page.

From S16: Chrome spaces out WebSocket connections to one address past about 8 (20 daemons took 2–5 s to reconnect). Carry relayed daemons over one socket to control, and stagger direct reconnects. 20 daemons (600 panes) add about 14 MB to the page.
Author
Owner

Done 2026-10-02, apart from real phones and a real provider sandbox. Merged in 33a749f.

What landed:

  • Every host at once (web/src/fleet.ts). The page holds a summaries-only connection (M23) to every host in the directory, control's or the home daemon's. Each goes over its own transport and end-to-end channel, and they merge into one list where a pane is (host, pane id).

    • Output is attached only when a pane is opened in its tab, which also wakes a sleeping sandbox.
  • Each host has a state:

    • connected;
    • stale: its last summary is kept and greyed, with when it was last seen;
    • offline;
    • asleep: a provider sandbox that isn't running is never woken just to be counted;
    • capped: past 24 connections, most recently used first, with a notice.

    The last summaries are kept for the next load.

  • Relayed daemons share one WebSocket to control.

    • /api/relay/m carries numbered channels, each a daemon's Noise channel over its existing relay stream.
    • It's routed, checked and metered like /api/relay/c/<id>.
    • The daemon is unchanged. Hosted sandboxes keep their own socket.
  • Reconnects:

    • Connects go through a limiter: 4 at once, and a dead host holds a slot for at most 3 s, with jitter.
    • Waking, the page becoming visible and online spread reconnects over 1.5 s.
    • A heartbeat notices a link that died without closing, within about 7 s.
  • The host menu says what each host is doing ("2 panes · live", "stale, seen 4s ago", "asleep").

Measured: after a simulated wake, 23 direct hosts were back in 0.48 s, and 20 through control (19 relayed, over one new socket) in 0.5 s, with no failed tries. S16 measured 2.2–4.6 s with a socket each.

Tests: e2e/fleet.spec.ts and e2e/fleet-control.spec.ts cover the three done-whens with local daemons and a local control, in laptop and phone-sized contexts.

Not covered:

  • real phones and networks (loopback stands in);
  • a real resident sandbox (a tailnet stand-in; "asleep" is tested from a provider status);
  • a pulled cable (a stopped process stands in).

Next: #47 builds on fleet.list and fleet.panes, with each host's owner and team from control's directory.

**Done 2026-10-02, apart from real phones and a real provider sandbox.** Merged in 33a749f. **What landed:** - **Every host at once** (`web/src/fleet.ts`). The page holds a summaries-only connection (M23) to every host in the directory, control's or the home daemon's. Each goes over its own transport and end-to-end channel, and they merge into one list where a pane is (host, pane id). - Output is attached only when a pane is opened in its tab, which also wakes a sleeping sandbox. - **Each host has a state:** - connected; - stale: its last summary is kept and greyed, with when it was last seen; - offline; - asleep: a provider sandbox that isn't running is never woken just to be counted; - capped: past 24 connections, most recently used first, with a notice. The last summaries are kept for the next load. - **Relayed daemons share one WebSocket to control.** - `/api/relay/m` carries numbered channels, each a daemon's Noise channel over its existing relay stream. - It's routed, checked and metered like `/api/relay/c/<id>`. - The daemon is unchanged. Hosted sandboxes keep their own socket. - **Reconnects:** - Connects go through a limiter: 4 at once, and a dead host holds a slot for at most 3 s, with jitter. - Waking, the page becoming visible and `online` spread reconnects over 1.5 s. - A heartbeat notices a link that died without closing, within about 7 s. - **The host menu** says what each host is doing ("2 panes · live", "stale, seen 4s ago", "asleep"). **Measured:** after a simulated wake, 23 direct hosts were back in 0.48 s, and 20 through control (19 relayed, over one new socket) in 0.5 s, with no failed tries. S16 measured 2.2–4.6 s with a socket each. **Tests:** `e2e/fleet.spec.ts` and `e2e/fleet-control.spec.ts` cover the three done-whens with local daemons and a local control, in laptop and phone-sized contexts. **Not covered:** - real phones and networks (loopback stands in); - a real resident sandbox (a tailnet stand-in; "asleep" is tested from a provider status); - a pulled cable (a stopped process stands in). **Next:** #47 builds on `fleet.list` and `fleet.panes`, with each host's owner and team from control's directory.
Author
Owner

Done: merged to main in 33a749f (Merge M25). Not yet checked on real phones or a real provider sandbox.

Done: merged to main in 33a749f (Merge M25). Not yet checked on real phones or a real provider sandbox.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#39
No description provided.