Repository navigation
desk-web: a reconnect keeps the session view drawn and says nothing for 15 s; a latency readout (#57) - #61
Merged
Merged
Conversation
…thing for 15 s (#57) A socket drop, a gap in n, an end {discontinuity}, or an end {machine-offline} while the session stays reachable no longer empties the transcript. The subscription listener's reset() is now interrupted(): what was delivered stays valid and a fresh snapshot follows. Held rows, their marks, the subagent tree, jobs, usage and the streaming layer stay drawn; rows, diff and output wait until the new subscription is served. The fresh snapshot is merged by uuid into the held rows instead of replacing them: the held rows before its oldest row, then its rows, then any held row newer than its newest. The reader's older pages stay drawn. A marking producer whose offChain disagrees with the held marks on the overlap replaces the held rows, as before. So does a snapshot that overlaps nothing. The rebuild stays staged. A block the snapshot no longer streams stays drawn until the rows it brought have landed. The keeper resubscribes at once after a machine-offline end while the session is reachable; later retries back off. The views say nothing of a disruption of a transcript holding rows for QUIET_MS (15 s, the hub's grace for a closed machine stream). They speak at once when no rows are held, when the session goes unreachable, or on an end of another kind. e2e: reconnect.spec.ts pins both disruptions mid-response against the fake machine with a MutationObserver over the whole window. depth.spec.ts pins the outlasting case under a fast-forwarded clock.
Every hop the web sees is timed into a 200-sample ring per path, always. The samples are drawn and
logged only when asked: localStorage['desk.latency'] = '1' or ?latency turns on a small fixed overlay
(n, p50, p95, max per path, plus the reconnect counts) and one console.info('[desk latency] <path>
<ms>') line per sample. window.deskLatency() returns the same numbers for a scripted read.
The paths:
- an owner message: send to human-ack, to its delivered outcome, and to its framed row's engine
timestamp (cross-clock)
- a session's message or question: its logged ts to drawn, once verified (cross-clock)
- a raised request: its arrival to drawn, and its call row's timestamp to drawn (cross-clock)
- a session view's first rows: subscribe, then snapshot, then drawn
- a chunk's bridge stamp t, when present, to drawn; a live row's engine timestamp to drawn
- each subscription resume's gap
- the project socket's reconnect count
"Drawn" is the next animation frame after the store applied the change. The samples of a frame are
batched into one callback.
e2e: latency.spec.ts runs every exercised path against the fake machine with the readout on, attaches
window.deskLatency() to the report, and bounds only the same-host paths' p95 loosely (5 s).
The project socket's welcome clears every session's presence until the hub sends it again, so for a moment after each reconnect the session read as unreachable. That ended the keeper's quiet window, and the header flashed "Reconnecting…". The keeper now takes the session's reach in three states: reachable, unreachable, or unknown. Only a known unreachable session ends the quiet early. Retries still treat unknown as not live, as before.
…nd the latency instrument (#57) - e2e/reconnect.spec.ts midAnswer: reads the last streaming row's text without waiting for one, so the loop steps the replay into the answer instead of waiting forever for a row that is not drawn yet. - desk-transcript.ts merged: a marking producer's snapshot is merged only when the overlap also holds a row of a type the chain carries that both sides hold on the chain; an overlap of progress rows alone vouches for nothing, and the snapshot replaces the held rows. - layer.ts resume: a block a block-row named before is dropped from a snapshot cut before that row, and its later chunks are ignored, so its partial text is never drawn beside its row. - desk-transcript.ts RowsSource.live: the stream.row sample is taken once the row's events reach the store, so rows that draw nothing, or reach no store yet, give none. - latency.ts drawn: nothing waits for a frame while the page is hidden, and at most 512 samples wait for any one frame.
… not a reconnect (#57) A reconnect now keeps every row drawn before it. The fresh snapshot of the newest rows is merged in, and nothing older is left to page in. A fresh load is what gives the case a view holding only the newest rows.
…treaming layer's resume (#57) A marked snapshot is no longer merged when a row it brings was written under a held row it does not hold: a fork before its window can take older held rows off the chain while every row the window holds stays on (a second append under a tool call leaves the first, the call's result staying), so agreeing marks could certify a stale one. A block a block-row named before the disruption keeps waiting for its own row where the snapshot was merged, since that row is held or still to come live; after a replace a row not held falls back to the snapshot's landing row, as it may be older than the window. A snapshot older than what was drawn keeps each request's higher watermark and the drawn text, and an ended request stays ended, its dropped blocks not drawn again and its replayed chunks not taken.
…mp and logs its numbers for the run's record (#57)
…, and a branch from outside the window replaces (#57) A snapshot whose watermark for a request is below the drawn one keeps that request whole (its blocks, the blocks named, its end, its watermark), and the live part after the snapshot's cut replays the rest; the partial watermark-max and keep-text rules, which lost a block the older snapshot did not stream yet, are gone. Otherwise the snapshot's copy replaces the drawn one as before, an ended request staying ended. The fork check no longer needs the parent held: a row the browser did not hold whose parent is not among the snapshot's own rows forks outside its window, which in paged history can be older than every held row.
… replace; a latency sample across a hidden tab)
SSFSKIM
added a commit
that referenced
this pull request
Oct 18, 2026
…s grace (MAWS #57, #61's rule) A project whose roster was current reads as current through a disruption -- a dropped socket, its backlog read again after the reconnect, a live event still being checked -- until it has lasted QUIET_MS (#61's 15 s, the hub's grace for a closed machine stream); past it the project is named as reconnecting and its rows are marked as last seen. A project never current is said as it is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The web half of #57 (the hub half is #58, merged). A reconnect no longer blanks or reloads the session view. That covers a reconnect of the browser's project socket, of a machine's stream to the hub, or of a hub object after a deploy. A gap under 15 s draws nothing at all. The PR also adds a latency readout that is cheap enough to leave on.
What the reader saw before
DeskTranscript.resetemptied the store key, so the pane went blank with "Reconnecting to the session…".machine-offline. The pane drew "The machine is offline… Trying again in 1 s." and the header said "Unavailable".What the reader sees now
n,end {discontinuity}, orend {machine-offline}while the session stays reachable:morestays as held.QUIET_MS, matching the hub's grace for a closed machine stream. In that grace a subscribe or an RPC waits for the next stream.end {machine-offline}while the session is reachable, the first retry is immediate. Later retries back off as before.The latency readout
To turn it on, set
localStorage['desk.latency'] = '1', or add?latencyto the URL.When on, it shows:
console.info('[desk latency] <path> <ms>')line per sample.window.deskLatency()returns the numbers whether the readout is on or off. Samples are kept always, the last 200 per path in a ring buffer; nothing is drawn or logged while off.ts→ verified and drawntstamp → drawnIt also counts socket reconnects and subscription resumes. "Drawn" means the next animation frame after the store applied the change. The paths that cross clocks say so in their label.
Tests
e2e/reconnect.spec.ts, against the fake machine, run mid-response for both a browser socket drop and a machine's stream replaced. Each case:depth-reconnecting,depth-unavailableor a header word appear;rowsrequest;e2e/depth.spec.ts: a disruption that outlasts the quiet window is said, using Playwright's clock.e2e/latency.spec.ts: with the readout on, every path the session exercises gets a sample, andwindow.deskLatency()is attached to the report.Reviews
reviewer-medium, four rounds:
docs/tech-debt-tracker.md, along with a hidden-tab latency sample.Gates
static,unit,e2e:desk-web --class1a linux --evidenceis green at the head a70ccf7: https://github.com/SSFSKIM/MAWS/actions/runs/39166149401. The tree includes master 074c0d2 with #58. Since then master gained onlywrangler.jsonc's logs setting (#60) and P3 docs.The web's share of each path
These numbers come from
e2e/latency.spec.tson the Linux runner, against the DX3 double and the fake machine. The double relays at once, so the numbers are the web's own processing and drawing. Each run's log line is[desk latency e2e]; these are from run 39165055192.<message>: logged → drawnThe chunk figure is n 33, but the replay applies its steps in one burst, so all 33 chunks were drawn in the same frame. It is the cost of a burst, not of a steady stream.
stream.rowandrequest.rowmeasure from the recording's own timestamps, so they show the recording's age instead of a latency.