Skip to content

desk-hub: a browser's part set bounded; redeploy-check's cleanup bounded; reconnect's grace cases synchronized - #117

Merged
SSFSKIM merged 5 commits into
masterfrom
desk-hub-bounds
Oct 22, 2026
Merged

SSFSKIM merged 5 commits into
masterfrom
desk-hub-bounds

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Closes three desk-hub rows of docs/tech-debt-tracker.md. No Durable Object storage change.

1. A browser's part set is bounded (row 2026-10-15, DC3)

Cause. PartAssembler bounded what a socket held across its unfinished sets (16 MiB, 64 sets, 60 s), but not one set: its count was unbounded, so a set of empty parts filled slots whatever the byte budget, and a set could join to the whole 16 MiB, which the object then parses and checks in memory.

Bounds. A browser's set joins to at most 4 MiB (BROWSER_SET_LIMIT) in at most 9 parts (BROWSER_SET_PARTS), both in src/protocol/browser.ts and passed only by the Project's browser sockets.

  • The largest frame a browser legitimately sends is a human or an RPC, each at most 1 MiB, plus a few bytes of frame. 4 MiB is four times that.
  • 9 is what a frame of 4 MiB takes when cut at 1 MiB: a slice at most doubles as a part escapes it (a quote or a backslash), so every part but the last carries just under 512 KiB. A unit test pins the worst case: an all-backslash frame of exactly 4 MiB is 9 parts and joins, and one byte more is refused.
  • A part whose count is over 9 is refused at once, before anything of its set is held. A part that would take its set past 4 MiB is refused and the set dropped. Both are too-large, like the existing budget refusals.
  • The machine stream's assembler and the web's receiving side keep their old bounds. They carry frames the hub joins up to 16 MiB, such as snapshots and large grids.

The RPC bound that the derivation needs. Nothing bounded an RPC except the part sets. One over the storage's 2 MB row limit failed inside the object and left the request waiting. The hub now fails an RPC over 1 MiB of canonical JSON as bad-shape, as DX1 does for an event.

Not left hanging. A refused set names no request, because the frame is never read. So desk-web's ProjectClient ends a human or an RPC whose frame would join past 4 MiB itself, using the paths the hub's own refusals take: HumanRefused for a human, a failed rpc-state for an RPC. A human or RPC between 1 and 4 MiB still reaches the hub and is refused by its nonce.

The spec's Frame bound paragraph, its DX6 hub-check paragraph and its Decision Log record these.

2. redeploy-check's cleanup holds its bound (row 2026-10-16, DC3)

Cause. The cleanup's own stop of the browser awaited a pending open with no deadline.

Fix. The row's first option: LogFollower.stop() waits for a pending open until STOP_WAIT_MS (15 s) after the first stop, and any later stop waits no longer than that. The stopped loop closes a socket that opens afterwards. Tested with the suite's stand-ins only.

3. Reconnect's grace cases wait on something observable (row 2026-10-21, desk)

Cause. Both grace cases sent 300 ms after closing the machine's stream, assuming the close had reached the project by then.

Fix.

  • Each case now subscribes on the stream before closing it, then waits for that subscription's end at the browser. The project sends that end as the close reaches it.
  • The second case ("no flap") had the same assumption and gets the same fix.
  • The first case also waits for its RPC's answer before its window for a late end.

Tracker

The three rows are removed. One row is added for the org phase: a socket can still hold up to 16 MiB of unfinished sets, and nothing bounds the total across a project's sockets.

Checks

  • Gates static,unit: run 39705714509, green on the head e6bfb90. Run 39705154612 was green on b37885a, before the Decision Log entry.
  • Review: doperpowers:reviewer-medium returned no findings.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)

… size

A browser's set joins to at most 4 MiB (BROWSER_SET_LIMIT: four times the largest frame a browser sends, a `human` or an
RPC of at most 1 MiB) in at most 9 parts (BROWSER_SET_PARTS: what a 4 MiB frame takes cut at 1 MiB, a slice at most
doubling as a part escapes it). PartAssembler takes both as options, which only the Project's browser sockets pass: a
part whose count is larger is refused at once, before anything of its set is held, and one past which its set would
join to more is refused and its set dropped, both `too-large` as the held budget's refusals are. An unbounded count let
empty parts fill a set's slots whatever the byte budget.

The hub fails an RPC over 1 MiB as canonical JSON `bad-shape`, as it refuses an event that large: before, nothing bounded
an RPC but the part sets, and a record past the storage's row limit failed in the object with the request left waiting.
A refusal of a set names no request (the frame is never read), so the web ends a `human` or an RPC whose frame would
join past the bound itself, through the paths the hub's refusals take: HumanRefused, and a `failed` rpc-state.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…ger than its deadline

redeploy-check's cleanup bounded its stop-writing step at 15 s, but its later standalone `browser.stop()` awaited a
pending connection with no deadline, so a slow handshake could hold the revocations after it. A stop now waits for an
open still pending until STOP_WAIT_MS (15 s) after the first stop, and a later stop no longer than that; the stopped
loop closes a socket that opens after.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…t before they send

Both of reconnect's grace cases sent their subscribe or RPC 300 ms after closing the machine's stream, taking the close
to have reached the project by then; under load it had not, and the project carried the subscribe to the closed stream.
Each case now subscribes on the stream before closing it and waits for that subscription's end at the browser, which
the project sends as the close reaches it. The first case then waits for its RPC's answer before its window for a late
end, rather than taking that answer to have come within the window.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…ect-grace rows closed

Removed: a browser's part set with no cap on its count or joined size (2026-10-15, DC3), redeploy-check's cleanup
waiting past its bound on a standalone browser stop (2026-10-16, DC3), reconnect's grace case subscribing 300 ms after
a close (2026-10-21, desk). Added: a project's browser sockets' unfinished part sets, bounded per socket and per set but
not across a project's sockets (the desk's org phase).

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
… RPC bound, flagging their consumers

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
@SSFSKIM
SSFSKIM merged commit c4f0efe into master Oct 22, 2026
SSFSKIM added a commit that referenced this pull request Oct 22, 2026
…S source, not the focused client's layout) and the route that can close it, from cua #117's reading

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant