Repository navigation
fix: pace buffered RPC and renderer readers - #1878
Merged
domgan-oai merged 15 commits intoOct 8, 2026
Merged
Conversation
…alesce-stream-signal-renders
domgan-oai
marked this pull request as ready for review
October 8, 2026 00:57
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
54 other measured values are unchanged. Public-import reachability bundles (bytes)No changes across 111 measured values. |
trueadm
added a commit
that referenced
this pull request
Oct 8, 2026
Main c0192ec (#1889, #1872, #1883, #1878 landing together) failed the new "bundle size checks" job: binding-base-ui-vite measures 62,351 gzip, so the downward ratchet requires its budget to drop from 62,384 to 62,383. run-minimal.mjs and run.mjs --write-budgets on that head change nothing else. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 19 tasks
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.
Summary
An already-buffered RPC stream can consume every value in one microtask checkpoint. A custom renderer can do the same when a held delivery acknowledgement releases a ready backlog. With 32 values and 2 ms of work per value, both paths previously finished the entire backlog before another task ran.
Pace direct RPC and optional renderer-response readers with one shared approximately 5 ms host budget. Recheck retirement and abort state after waits, preserve ordered delivery and backpressure, and keep inline document delivery on its existing path. This independently implements priority 5 in #1864 against current
main; it no longer includes the unmerged transition or signal-render changes from #1872/#1875.A paced consumer can also wait before its first transport read. The server producer now observes its result immediately, retaining the original rejection for a sanitized error frame while avoiding an unhandled rejection during that wait. Iterator acquisition and pulls remain demand-driven.
Validation
git diff --checkpass; independent read-only correctness/complexity reviews are clean.perf-review: reader and server follow-on scans report zero candidates. Work is admitted between indivisible reader pulls, parses, and receiver calls. No component/render path, Block/Scope layout, or DOM measurement changes. The existing task poster is reused; early rejection observation adds one handler per server result, not per streamed value.c0e899c9dis green: CI and benchmark report. All unit, Chromium, parity, static, package/build, example, and byte-budget gates passed. The catalog omission, native-capture test timer race, and delayed server-result rejection exposed by the prior runs are corrected.pnpm syncand workspace typecheck: the pinned toolchain is unavailable. Sync stops at missingtypescript-native/package.json; focused runtime checks use cached Vitest, while the full pinned gates remain with CI.Production-minified Node 22.22.3 reader probe: one excluded warmup pair and three alternating measured runs against exact main source
573127fd3on the same machine:Run
node benchmarks/scheduler-responsiveness/reader-backlog.mjs; pass another checkout and--reportfor a baseline. These measurements establish task opportunities and completion cost, not browser input/paint latency. The subsequent server ownership fix is covered by rejection and cancellation tests; it does not change these reader admission paths. CI production bundle measurements remain authoritative; no budget is raised here.Risk / follow-ups
The shared window cannot interrupt a single expensive parse or callback. Receiver work after its own later asynchronous continuation is outside admission. Delivery deadlines include queueing and admission; the transport deadline excludes local budget waits. Component render admission and signal producers' own scheduling policy are unchanged.
Provenance
agent-authored)Codex task · host
com-79386Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes low-level stream/RPC consumption, cancellation, and host scheduling semantics; mistakes could cause dropped frames, stale delivery, or timing regressions without touching auth or persistence.
Overview
Buffered streamed RPC and optional
readStreamedRendererResponsepaths could drain large ready backlogs in a single task, starving other host work. This PR adds a shared ~5 ms host budget (yieldForHostBudget) that yields between transport pulls, frame parsing, and custom delivery admission while keeping frame order, backpressure, and inline document delivery unchanged.RPC iteration and renderer reads re-check abort/retirement after budget waits so
iterator.return()and signals cannot publish stale values or swallow fresh protocol errors. Streamed signal producers observe rejected results at creation so a delayed first consumer read does not cause unhandled rejections. Docs, performance-audit guidance, areader-backlogbenchmark probe, and broad regression tests cover the behavior; the MCP bridge also registers@tanstack/react-query-devtools.Reviewed by Cursor Bugbot for commit c0e899c. Bugbot is set up for automated code reviews on this repo. Configure here.