Skip to content

perf: read channel history ahead of the reader and slide past the budget - #4194

Open
kalvinnchau wants to merge 25 commits into
mainfrom
peon/history-prepagination
Open

kalvinnchau wants to merge 25 commits into
mainfrom
peon/history-prepagination

Conversation

@kalvinnchau

@kalvinnchau kalvinnchau commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Older channel history loaded in fixed 20-row pages, read only once the reader neared the top. Scrolling back under real relay latency kept hitting the edge and waiting. A window at its row or byte budget stopped paging altogether.

Change

  • Read ahead.
    • A settled reader at the bottom reads older history once the main thread is idle: a first page sized to the reader's reach, then full pages up to six screens, at most five pages per visit.
    • While scrolling, each older page (20–200 rows) is sized from the upward scroll speed and a smoothed request-to-render round trip.
    • Leaving the channel cancels the read-ahead.
  • Rows first, aux after. An older page shows its rows and thread summaries first. Its edits, reactions and deletions follow in background 50-row reads, one at a time per window. They merge only for rows the window still holds. Opening another channel pauses them; they resume on revisit.
  • Slide past the budget.
    • An older page past the row or byte budget drops the newest rows and detaches the window from the head.
    • A detached timeline reads newer rows near its end, and "jump to latest" reattaches.
    • Live traffic at the budget drops the oldest rows instead of stopping.
  • Anchor stability. The reader hold releases only once every row from the viewport top to the held row is mounted at the size Virtua lays it out with. That applies on its scheduled check and at input end, bounded at sixteen checks.
  • Revisit revalidation. A revisit past the head's freshness lease revalidates any attached window. A window paged back from the head merges the newer head when it meets the rows, and takes the head when there is a gap.
  • Concurrent relay reads: reader 7, HTTP 10, broker 10 (reads and writes share the signed lane of 10, so writes keep three slots).

Tests

Unit

  • history-prefetch.test.ts: page sizing.
  • rows-settled.test.ts: the settle predicate.
  • Store: aux closure, sliding, aux pause on channel open, and revisit merge/replace. Each new store test fails without its change.

Browser (history-loading.spec.mjs, both engines)

  • Paging inside one second under latency.
  • Drag, wheel and keyboard handover.
  • Unmounted reader rows.
  • A press released while rows measure. This one fails without the input-end change: 107.7 px in Chromium, 84.7 px in WebKit.
  • A read-ahead the reader scrolls up to survives leaving the channel. Fails without the change in both engines.

Fixture changes

  • Every window read is bounded, as the relay bounds them.
  • Aux closure reads are served without being held.
  • Cancelled reads are dropped.
  • Journeys whose premise is unloaded history hold the read-ahead.

Perf

  • scroll-paging.perf.mjs adds a short-message corpus, a delayed short-paging case and edgeWaitMs (time held at the top edge).
  • Desktop A/B against main, switching through six channels: first paint is equal. With warm data, the first painted frame is the final view: no rows arrive below the newest, and the bottom stays pinned.

Deferred

  • layout.spec.mjs "Alt+ArrowUp from a message link preserves native scroll ownership" fails on main too, in both engines; untouched here.
  • history-loading.spec.mjs "split before the first loaded row" fails intermittently (2 of 20 runs on this branch); cause not confirmed.
  • history-loading.spec.mjs "paging older slides the window to the channel start" moved the reader's row about 101 px twice in Linux WebKit CI, both times on the last page, which reaches the channel start; 0 of 6 in a local Linux WebKit container. Cause not confirmed.
  • "a fast upward scroll reads larger pages than a slow one" failed once in a Linux WebKit flake repeat on a runner where the test took 1.6 min instead of about 25 s. Wheel notches that land more than 250 ms apart measure no pace by design.
  • "input after the page lands starts from the reader's row" (body unchanged from main) moved the reader's row after a 40 px wheel twice in Linux WebKit CI (23.6 px, 38 px); 0 of 40 in a local Linux WebKit container and 0 of 30 in local macOS WebKit. Cause not confirmed; one candidate is the page's aux closure, which now lands in a second read after its rows.
  • The release check depends on Virtua's 150 ms shift-idle window. It is covered by test, not by contract.
  • Displays above 60 Hz, touch input and the native desktop host were not exercised by the browser tests.
  • Retained memory can exceed one page's worth during read-ahead, up to about 7× a single page, still within the window budgets.
  • Live trim at the budget while detached is untested end to end.
  • The rows-settled unit mock has no start margin.
  • Not changed here, same as main: opening a channel whose saved head is stale (first visit after launch or a dropped connection) paints the saved rows, then the catch-up adds missed messages and the "New messages" line, which moves the content up.

🤖 Generated with Claude Code

@kalvinnchau
kalvinnchau force-pushed the peon/history-prepagination branch 3 times, most recently from 9a0083d to ac79fef Compare November 21, 2026 22:50
@kalvinnchau
kalvinnchau marked this pull request as ready for review November 22, 2026 16:17
@kalvinnchau
kalvinnchau requested a review from a team as a code owner November 22, 2026 16:17

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Star Lord recommends changes on 41244e8 for history continuity, paging recovery and window budgets. These findings come from source review. Required CI was green in the snapshot.

Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Needs a desktop and mobile check before merge
Channel-window reads in Desktop/browser now split rows (include_summaries, no include_aux) from 50-row auxiliary closure reads (include_aux, no summaries), with older pages up to 200 rows and client/HTTP concurrency of 8/10; verify Desktop history/reconnect and Mobile's existing combined 50-row query against the relay.

🤖 :bot: Jude’s code review agent — integrated review of 352f46e77e4eb0682fe2c29b7139f823f2effc74..41244e8c64595104ccafbed78c78e927a0200ab0 (clean checkout). Verdict: COMMENT; author fixes required before approval. Risk: high (history continuity, window budgets, and reconnect). The change aims to prefetch older rows, paint before aux, and slide the retained window; the failures below affect those very contracts. I independently traced the client store against the channel-window relay path and reconciled focused behavioral probes with the product/interaction review.

Blocking findings — author action required:

  1. src/features/relay/store.ts:1063–1084: the second query pages by cursor/limit again rather than by the IDs of the rows just shown. A backdated/same-second row inserted between reads consumes a chunk slot; the displaced original row never gets its edit/reaction closure. A production-store scripted-relay probe kept the original text instead of applying its edit. Author action: bind aux closure to the original row IDs or a common snapshot; add an intervening-row displacement regression.
  2. store.ts:1088–1101,4615–4633: aux events merge without re-enforcing the 8 MiB retained-window budget. A focused probe exceeded that budget, then a live arrival evicted the row the reader had just reached; store.test.ts:363–376 currently accepts an oversized closure. Author action: bound cumulative retention without losing effective edits/deletions or the reader anchor; cover multi-chunk aux plus live trim.
  3. store.ts:1103–1111,4172–4179: a quota retry timer can restart an older channel's aux at foreground priority after another channel opens. A focused probe observed the old-channel read after navigation. Author action: pause queued and late aux dispatch when the channel is inactive, resume on revisit, and use background admission where appropriate.
  4. store.ts:1571–1582: Jump to latest discards outstanding aux before the head replaces its rows. On head-read failure the detached segment remains but its edit/reaction work is gone; a focused failure/revisit probe found no resumed aux query. Author action: retain paused aux until replacement succeeds, and resume it on failure.
  5. store.ts:1413–1427: a refreshed head overlapping only a previously received live tail is mistaken for continuity with the older paged segment. A focused probe with old rows through time 20, a live row at 60 and a fresh head at 60…41 retained a missing 21…40 interval and marked it verified. Author action: prove overlap with fetched history, fill the gap, or replace the segment; add the split-tail regression.
  6. store.ts:4364–4417,4728–4743,5091–5111 and src/features/messages/ChannelTimeline.tsx:2110–2129: a stream drop aborts loadNewer() but leaves loadingNewer true; continuous resume does not clear it, and the UI refuses subsequent forward paging. Jump to latest is an escape, not recovery of the reader's place. Author action: clear the flag for the owning cancelled request and cover held forward read → disconnect → continuous resume → another forward page with anchor preserved.

At the row cap, store.ts:4615–4633 also aborts an in-flight older read on each new live row. A single cancellation is covered; sustained traffic faster than read latency may starve older paging. This is a source-established risk, not a reproduced sustained-load failure. Please stabilize the older-page boundary through trims and test repeated arrivals as part of the paging fix. Conversely, the 200×48-KiB response-too-large scenario is not established as a dead-end: the visible Retry calls the default 20-row read at the unchanged cursor. A refusal → smaller retry → stable-anchor journey still needs checking; do not treat the hypothetical as a separate blocker without that evidence.

Validation and verification ownership: At this exact head, pnpm typecheck, pnpm check, and pnpm build passed on an isolated Linux workstation; pnpm test was still running at publication (Node integration 340 passed, 6 skipped, 0 failed; Vitest/Rust/browser aggregate not established). Required hosted CI and Chromium/WebKit browser/flake shards reported success; green CI does not negate the focused failures. No native macOS Tauri, Flutter device, or concurrent real-relay acceptance was run in this review. Verification owner: reviewer/tooling, not an author-action item by itself: exercise a seeded >2,400-row Desktop channel with edits/deletions/reactions/summaries, wheel/keyboard paging, window slide, reconnect and Jump to latest in the exact native artifact; in parallel exercise Mobile's existing 50-row combined NIP-CW request and older cursor with the Desktop split-read pattern on the same relay, including reconnect and no gaps/duplicates. Check relay fleet load for the increased read concurrency. Residual risk: native/touch behavior, real-relay cross-client behavior, and the incomplete full local suite remain unverified.

Recommendation: request changes for the six concrete defects above; the desktop/mobile check is a separate reviewer/tooling-owned merge gate, not a code-defect inference.

@kalvinnchau
kalvinnchau force-pushed the peon/history-prepagination branch from 41244e8 to e2470b8 Compare November 22, 2026 17:14
@kalvinnchau

Copy link
Copy Markdown
Contributor Author

🤖 Re the review above: all six blockers and both noted risks are addressed at e2470b8. Each has its own commit and regression test; details are in the inline threads.

  1. Aux displacement: 84e9cf0
  2. Byte budget after aux: 9896d7c
  3. Aux after navigation: 5235875 (gated on the open channel; no background admission, reason in the thread)
  4. Jump to latest loses aux: 61ff870
  5. Head overlapping only the live tail: f035322
  6. loadingNewer stuck after a drop: 3ab1258
  • Older paging starved by live trims: 065b217
  • 200-row page over the response limit: 11b080c (retries once at the default size)

Validation at e2470b8: pnpm check (includes typecheck) passes. Vitest for src/features/relay, src/features/messages and src/bundled: 15237 passed. Browser history-loading, history-prefix, membership, unread, large-channel-unread and navigation-channel-history in Chromium and WebKit: 96 passed. The native desktop and mobile check stays with the reviewer, as you note.

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Carl, an automated reviewer, commenting via Wes's GitHub account.

Changes requested. Reading ahead and sliding past the budget are good ideas, and CI is green. But the PR adds two paging bugs (reproduced below), and it starts a lot of unrequested relay work at foreground priority. Each problem is explained in its own inline thread.

Merge criteria

  • Unrequested history and aux reads run at background priority. Size the relay load for the whole fleet, or start smaller (one idle page) and measure.
  • The live-trim cursor skip and the stray live row after a revisit replacement are fixed, each covered by extending an existing store test.
  • A failing aux chunk no longer stalls the aux queue, sliding prunes traffic, and the Jump button stops counting rows read into a detached window as new messages.

Validation gaps (not blocking on their own)

  • The ~101 px WebKit move on the page that reaches the channel start may be a product jump, not a flake. In that commit hasMore turns false and the .edge swaps "Loading older…" for the intro above Virtua, while the slide takes the non-prepend hold path. Logging the .edge height in that spec would settle it.
  • No browser journey has aux land after its rows, so late edits and reactions reflowing under a reader are untested end to end.

Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
kalvinnchau and others added 18 commits November 23, 2026 09:52
older pages were a fixed 20 rows, read only once the reader neared the
top, and a window at its row or byte budget stopped paging at a history
wall.

- loadOlder takes a row count of 20..200; head reads keep 20
- the timeline sizes each older page from decaying upward scroll speed
  and a smoothed, bounded request-to-render round trip, refilling the
  prefetch distance plus twice the distance scrolled during one round
  trip; the distance grows with that reach, capped at one page
- a settled reader at the bottom reads ahead once the main thread is
  idle: a first page sized to the reach, then full pages up to twelve
  screens, at most five pages a visit. a revisit restored at the bottom or
  below a pending saved row reads ahead too, and a read-ahead page never
  returns the reader to that saved row. leaving the channel cancels it
- an older page shows its rows and thread summaries first; its aux
  closure (edits, reactions, deletions) follows in the background in
  50-row reads, one at a time per window, merged only for rows the window
  still holds and cancelled when the window closes. a part applies to
  the held rows past the budget too, without sliding; the next older page
  slides or limits the window. a part the relay refuses with a retry hint
  is read again when the hint expires
- concurrent relay reads: reader 8, http 10, broker 10
- an older read cancelled under the window, as a stream drop cancels
  every relay read, ends its page so the window pages again
- an older page past the budget slides the window down to it: the newest
  rows drop and the window detaches from the head. a detached timeline
  reads newer rows near its end, does not follow its end, and jump to
  latest reattaches the head
- live traffic at the budget drops the oldest rows instead of stopping;
  an older read in flight below them is cancelled
- budget trims keep a kept row's edits and reactions together with their
  deletions, through one shared rule
- the reader hold picks up an unmounted row's new inset when it mounts and
  waits two frames after each height change, so a large page landing
  among the loaded rows keeps the reader in place
- the hold releases only once every row from the viewport top to the
  held row is mounted at the size virtua lays it out with, on the scheduled
  check and at input end alike, bounded at sixteen checks
- opening a channel pauses the other channels' aux reads; their pages stay
  queued and are read again on revisit
- a revisit past the head's freshness lease revalidates any attached
  window: a reader paged back from the head merges the newer head when it
  meets the rows, and takes the head past a gap
- browser journeys settle the read ahead before their baseline; the
  fixture bounds every window read, as the relay does, and serves an aux
  closure read without holding it, and drops a read the app cancels;
  journeys whose premise is unloaded history hold the read ahead
- perf harness: short-message corpus, delayed-short paging case and
  edgeWaitMs (time held at the top edge)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a read-ahead page still in flight when the reader scrolls within reach
of it is now the reader's read, so leaving the channel no longer
cancels it and returning to the saved top finds it in flight, as with
reads the reader starts.

tests: serve the background aux read unheld in the channels page
context fixture; count only rows served outside the visit's own pages
as preloaded in the first-seen perf case; measure wheel progress in
the production broker journey as distance from the bottom, which rows
above measuring taller do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
the ended-before-hold journeys judge the reader's move at scrollend net
of virtua corrections. a correction dispatched after the input's
scrollend, as a further older read can cause, left the move unjudged.
judge it again on each correction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
one 1500 px wheel per pass lands more than 250 ms after the last when
the pass waits on a read, so no pace is measured and every page stays
at the base size. three 500 px notches per step keep samples inside the
gap. linux webkit: 6/10 before, 12/12 after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
the two-filter head read awaited its parts inside the fault catch, so a
held part the app cancelled was reported as an unexpected fixture fault.
returning the promise keeps cancellation out of the catch, like the
presence hold. unread.spec focus cancellation failed in both engines
after rebasing onto the head-notices read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
the head that meets a paged window keeps the older rows; with notices
read beside the head (#4179) it must take them from that read rather
than issue a second notice read. fails if the path falls back to a
separate notice read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a runner too slow to land wheel notches inside the 250 ms pace sample
gap gives the app no pace, so base-size pages are correct there. the
test counts scrolls that land under 125 ms apart and skips the size
assertion with a reason when fewer than five did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
the aux closure counted down by rows, so a row written into the page's
range between the two reads took a place and left an original row
without its edits and reactions. track the rows still uncovered and read
on from the relay cursor, no older than the page's oldest row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a page or retry timer landing after navigation started an aux read
for a channel no longer shown; it now waits for the revisit, which
ensure already fills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
an aux merge could leave a window above maxHistoryBytes, so the next
live reaction trimmed the oldest rows the reader had just paged to.
past the budget the merge now slides down to the rows paged to, as
an older page does; a closure that leaves no shown row applies as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
at the cap every live row trimmed the oldest and aborted the older
read, so fast traffic could stop older paging. live traffic no longer
trims while an older page is in flight; the page slides the window
within its budget when it lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a 200-row page of large messages passes the reader's 8 mib response
budget and stopped older paging. a response-size refusal now reads the
same cursor again at the default page size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a stream drop cancelled the newer read and left loadingNewer set, so
every later scroll near the bottom skipped forward paging. the cancelled
read now clears the flag when no other read owns the window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a live row can sit in the window past a stretch the stream missed; a
fresh head that met only that row kept the hole and marked the window
verified. overlap now counts only rows read, not live traffic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
jump to latest dropped the queued aux work before the head landed, so
a failed head read left the segment without its edits and reactions.
aux work now waits while the head loads: it ends when the head replaces
the rows and continues when the read fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
… floor

a live row backdated below the loaded floor that survived a byte trim
moved the next older read to it, skipping every unread row between.
a trim now moves the cursor only when it drops rows paging read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
halves the unrequested older pages, and their aux closures, a settled
visit reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
kalvinnchau and others added 5 commits November 23, 2026 09:52
…laces the window

past a gap the head replaced the paged rows but kept their floor and
live traffic, so a live row below the head stayed on screen across the
gap. the replacement now resets the floor and drops live rows below the
head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a failed aux part went back to the front unchanged, so a closure past
the response budget blocked the aux of every page behind it. a part
too large for a response now reads again in halves; one that fails
without a retry hint goes behind the other pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a slide replaced the window's events but kept their live traffic, so
dropped bodies outlived both budgets and showed again on return to
the head. a committed slide now drops traffic outside the rows kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
rows a newer page read into a detached window, up to the page that
reaches the head, raised jump to latest's new-message count for history
the reader was scrolling back into. live rows never enter a detached
window, so its updates now count no arrivals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
@kalvinnchau
kalvinnchau force-pushed the peon/history-prepagination branch from 95e7bbd to 1b55e27 Compare November 23, 2026 18:04

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Carl, an automated reviewer, commenting via Wes's GitHub account.

Changes still requested. I re-reviewed the fix commits (9b53e31f3..1b55e27ab; the rebase itself is clean). The revisit stray row, the slide traffic leak and the detached new-message count are fixed, and the original cursor probe now passes. Three store issues remain or are new (inline below), and the relay admission thread is still open.

Merge criteria

  • The aux merge no longer drops live rows held only in traffic (a regression from the fix).
  • The trim guard compares against the composite cursor, not just the timestamp.
  • A failing aux page goes behind the queue without ending the drain.
  • Relay admission: speculative pages and aux go in the background lane, and the reader/HTTP/broker caps go back to 3/6/6 or come with reconnect evidence (see the existing thread at store.ts:1075).

Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread src/features/relay/store.ts Resolved
Comment thread tests/browser/timeline.mjs Resolved
- reconcile traffic only when an aux closure slides the window, so a live
  row held only in traffic survives an aux merge
- decide which rows paging read by the (created_at, id) cursor in relay
  order, so a trim in the cursor's second does not skip unread rows
- read every queued aux page once before stopping on one that failed
- read-ahead browser helper waits for six screens, as the app does
- reword the foreground comment: a read the reader entered survives a switch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
@kalvinnchau

kalvinnchau commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Owner decision on relay admission (merge criterion 4):

  • Read-ahead reads stay at foreground priority. That covers speculative older pages and aux closures; neither moves to the background lane. Per window, read-ahead runs one older page and one aux part at a time, and only the open window starts them. A read the reader scrolled into survives a channel switch, so read-ahead can hold a few of the reader's slots. The owner judged that the cap leaves enough room for navigation and thread reads. The code comment at the aux read says this (2d73aed).
  • Caps are reader 7, HTTP 10, broker 10 (d94dd61). They are not restored to 3/6/6. Reads and writes share the signed API lane of 10, so a reader cap of 7 leaves writes and other signed requests the same three spare slots they had under 3/6.

This PR does not include simultaneous-reconnect evidence. That would need relay-side measurement.

- reader runs at most 7 reads at once, under the api lane's 10, so writes
  and other signed requests keep the three spare slots they had at 3/6
- companion layout journeys take their paging baseline after the reader's
  own wheel: a fast wheel reads ahead at its pace past six screens, and the
  invariant is that panel close and restoration do not page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>

This branch has not been deployed

No deployments
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.

3 participants