Repository navigation
Description
Problem
The owner, 2026-10-18, after a working day from the desk: the desk shows "Reconnecting to the session…" often, and the path from a session to the web should be as fast as it can be. Both are friction on the loop the desk exists for: seeing what needs the owner and answering it.
What the machines' logs show for 2026-10-18 (01:46Z–18:50Z, about 17 h):
MacBook (macbook) |
Mac mini (mini) |
|
|---|---|---|
| uplink stream (re)connects | 27 | 27 |
| caused by the uplink process restarting (daemon restarts: plugin rolls, kickstarts) | 14 | 8 |
409 stale-generation (an hb-ack or POST named a stream the hub no longer holds) |
12 | 15 |
| "the hub ended the stream" | 0 | 4 |
500 error code: 1101 (a Worker exception) |
1 | 0 |
So each machine's stream drops about 1.5 times an hour, and most drops come from the hub's side. Every drop resets the browser's session subscriptions. apps/desk-web/src/depth/view/TranscriptPane.tsx draws "Reconnecting to the session…" while the subscription is reconnecting with no rows, between a reset and its fresh snapshot. A reset clears the rows the reader was looking at and reloads them, so a machine's reconnect is visible as a blank pane and a reload, even when it lasts a second.
stale-generation is the main suspect. MachineObject (apps/desk-hub/src/objects/machine.ts) holds the machine's current stream in memory (this.stream). A POST naming a generation with no in-memory stream is refused 409. So anything that loses the object's memory while the uplink's GET still looks open (a deploy, an eviction, a runtime restart of the Durable Object) surfaces only at the next heartbeat ack, up to one heartbeat (15 s) later. One deploy today matches one drop (#55 at about 18:45Z, the drop at 18:48Z). Most drops match no deploy.
Latency today is not measured end to end. One spot check: an owner message from the web at 17:04:26.985Z (hub ts) reached the session's transcript at 17:04:27 (CI-opt, hub/1858…:1). The other direction (a session's <message> or question until it is drawn on the web), the session view's first rows, and a streaming chunk until it is drawn have no numbers.
Intent
The desk feels live. A machine's reconnect is invisible to the reader unless it really is offline. Every hop on the path between a session and the web has a measured latency and a budget it is held to.
Shape
- Measure first. Instrument the paths and record a per-hop breakdown on the deployment, from timestamps the frames already carry where possible:
- owner send → session receives;
- a session's
<message>, question or permission prompt → drawn on the web; - opening a session view → first rows;
- a streaming chunk → drawn.
Count reconnects with their causes from both sides (the uplink'sdaemon.log, the hub's object). Keep the instrument cheap enough to leave on (a debug readout or a log line, not a dashboard).
- Find why the hub loses the stream (
stale-generation, "the hub ended the stream", the 1101) and fix what is ours. If the Durable Object's memory is lost by design (eviction, restarts), the stream must survive it: the generation and what the uplink needs persisted, or a drop detected at once rather than at the next heartbeat. - Make a reconnect invisible to the reader. After a machine reconnects, a session subscription resumes from the offset the browser already holds instead of resetting to a fresh snapshot. Presence holds through a short gap rather than flapping offline and back. The "Reconnecting…" line stays for a real outage.
- Fewer uplink restarts. A daemon restart for a plugin roll restarts the uplink, which drops the stream. Restart the uplink only when its own code changed, or keep the gap short enough that (3) hides it.
- Latency budgets set from (1)'s numbers and held by a check. Proposed until measured: an owner message reaches the session within 1 s; a session's message or request is drawn on the web within 2 s at p95; a reconnect under 30 s draws nothing.
Acceptance
- (1)'s breakdown recorded for every path above, on the deployment, from both Macs.
- Over a working day, both machines show a reconnect rate from hub-side causes well below today's (about 1.5 an hour each), or every remaining cause is named and outside our code.
- Against the fake machine, a machine reconnect mid-session leaves the session view's rows in place (no "Reconnecting…", no reload) and the stream resumes. Pinned by a desk-web e2e (Linux lane) and a desk-hub test.
- The budgets in (5) hold, with the numbers in the PR.
Notes
- Two repositories:
- MAWS:
apps/desk-hub(the machine object, the session plane) andapps/desk-web(the subscription keeper,TranscriptPane). - doperpowers:
skills/sminos/scripts/sminos_uplink.pyand the daemon's restart rule.
- MAWS:
- A Durable Object storage change goes to the owner first. Deploys of master follow the standing rule.
- The org directory (doperpowers gate: dashboard-scale and design-scale wait for the measured-job guard (MAWS #92) #93, in flight) touches the uplink's hellos and the hub's Registry. Sequence after its M2/M3 or coordinate with its executor.
- Related: Phase 1 acceptance 10 (no loss across restarts) holds. This ticket is about what the reader sees and how fast, not about loss.
Activity
fake machine: a chunk carries its stamp t, as the machine's plane now…
desk-hub: an RPC sent in a closed stream's grace waits for the next s…
desk-hub: the hub's hops of #57's latency paths on the local runtime,…
Merge pull request #58 from SSFSKIM/desk-reconnect-hub
desk-web: review fixes for the reconnect merge's fork guard and the s…
desk-web e2e: the latency case times chunks by the fake machine's sta…
desk-web: a snapshot older than a drawn request changes nothing of it…
tech debt: two #57 residue rows (an older snapshot's named block on a…
Merge pull request #61 from SSFSKIM/desk-reconnect-web
Merge pull request #62 from SSFSKIM/desk-57-fold
desk-web: the org view says nothing of a gap shorter than the reader'…
gate-offload spec: Decision Log 77, the load in every posture line (c…
Merge pull request #95 from SSFSKIM/desk-e2e-hub-session-plane
U7b fix wave (round 4): WR #57's scene keeps one pass, the first clic…
U7b fix wave (round 6): WR #57 ends on an Escape so the app can quit;…