Repository navigation
Description
Status
Agent-maintained (Codex, for @trueadm; earlier updates by Claude Code). Updated 2026-10-10 against
mainat2fe1f9f9bf. A tick in the checklist below means the work is onmain. Partial progress is noted inline, without a tick. Measurements below are the linked PRs' recorded results, not a new benchmark run.
All five implementation steps in the investigation comment have merged. The broader investigation remains open for the evidence and contract gaps listed below.
| Step | Path | State |
|---|---|---|
1. useDeferredValue swap in a host task |
5 | Merged: #1867 (3a94771e96) |
| 2. Transition and Action-result renders in a host task (G1) | 4, 5 | Merged: #1873 (d788d32bbb), budgets in #1874, and the Action/View Transition follow-up #1872 (7540c3552e). Same-component cue: #1888 (90a57d8203); ancestor cue: #1899 (b4a61e79b4); isPending falling edge in the transition's commit: #1911 (47e030e4d8) |
| 3. Coalesce ready signal-producer renders (G2a), with one budget shared by stream pulls (G3) | 1 | Merged: #1875 (247dffe6d6). Its initial budget raises landed in #1891 (2f81266018) |
| 4. Island activation gate | 3 | Merged: #1866 (8fa3398c58) |
| 5. RPC and custom-reader pacing | 2 | Merged: #1878 (c0192ec816), which introduced the shared host budget reused by step 3 |
| Chromium backlog coverage | 1, 3, 4 | Merged: #1877 (abe9b42a54). Same-component and ancestor transition-cue browser cases also landed in #1888 and #1899 |
The old merge-order blockers are obsolete: #1887 and #1901 are closed without merging; they are not pending dependencies of the already-landed runtime changes.
On main now
- One task poster,
postHostTask, backs deferred swaps, transition/producer admission and the island gate. It usesscheduler.postTask, then a freshMessageChannelper post, thensetTimeout. - One shared host budget,
yieldForHostBudget, gives about 5 ms per window, reset by a posted sentinel. RPC/custom readers and query/derived stream pulls share it; ready signal results also check it. Producer leases are revalidated after a wait. - Ready query and asynchronous derived publications coalesce native component rendering in the host-task queue. Source subscriptions, graph effects and direct signal bindings still observe every publication. Plain signal writes, native events, lifecycle updates and
flushSyncretain their timing. - Pending cues render over committed values before the transition's task, including when the cue is in an ancestor. Ordinary
useTransitioncompletion now dropsisPendingin the transition's own commit. Holds keep it raised; documented exceptions and narrower follow-ups remain below. - The scheduler contract documents these changes and their limit: there is no time-slicing. A callback, parse, render or commit already in progress runs to completion; a posted task provides an opportunity for input or paint, not a guarantee of either.
- Measurement support from feat: complete profiling counter core #1955 / Profiling mode: count and trace engine work (renders, hooks, Blocks, arms, boundaries, rollbacks) and add <Profiler> #1886 now includes engine-work, accepted-commit, effect and host-task counters. This complements production work coverage and browser measurements; it does not close this issue's remaining responsiveness evidence gaps.
Recorded evidence
- Deferred swap: slow keys dropped from 6/6 to 1/6 in Chromium (fix(octane): run useDeferredValue's deferred render in a later task #1867).
- 100 synchronous
useActionStatedispatches: 101 commits became 2, as in React 19.2.7. The release click for a 12-action backlog went from 176–184 ms to no Event Timing entry at or above 16 ms (fix(octane): render transition-priority work in a later task #1873). - Same-component and ancestor transition-cue Sort fixtures: 5/5 slow clicks became 1/5 at both 1× and 4× CPU, matching the reported React comparison (fix(octane): commit the pending cue apart from its component's transition (#1864) #1888, fix(octane): render a pending cue at urgent priority (#1864) #1899). fix(octane): drop isPending in the transition's own render (#1864) #1911 then removed the ordinary extra falling-edge commit, with task-order/commit and held-transition regressions; that PR did not report a new browser-latency run.
- 100 ready query or derived values: 101 component commits became 1 (fix: coalesce and pace ready signal producers #1875). With 2 ms of subscriber work per value, a pre-armed task ran after about 12 ms for queries or 6 ms for derived streams, rather than after about 203–204 ms. These are production-runtime/jsdom task-order measurements, not input-to-paint evidence. In the 12-query case, commits increased from 11 to 21 while allowing the marker after about 12 ms instead of 242 ms; completion rose from about 242 ms to 246–247 ms.
- Buffered RPC, 32 values at 2 ms each: a pre-armed task ran after 3 values (7.5–7.8 ms), rather than after all 32 (about 67 ms). Total completion moved from 66.8–67.4 ms to 68.0–68.8 ms (fix: pace buffered RPC and renderer readers #1878).
- test: cover buffered backlog responsiveness in Chromium #1877 adds production Chromium canaries at 6× CPU for 100 query/derived/Action values and 60 ready islands. The first trusted keystroke releases the backlog; stream/island cases require later input while work remains. Checks preserve ordered values, draft/focus/caret, island DOM identity and hydrated handlers. Event Timing and completion are reported; an empty Event Timing sample at Chromium's 16 ms floor is reported as
null, not zero. These are fairness canaries, not a comparative speedup verdict.
Still open
Proposed in #1983: the remaining investigation matrix, external starvation watchdog, browser traces and allocation evidence, waiting-island IME/selection/activation coverage, lifecycle audit, and measured budget-policy decision. The investigation also found and fixes an ordinary query-promise publication path that bypassed the shared budget. The PR records the retained Action-callback and atomic-render limits with measurements. It is open for review; the checklist still reflects merged work only.
- An indefinitely ready producer in an isolated page/process with an external watchdog. The existing
signals-waiter-race-watchdog.test.tsbounds a different pending-waiter bug inside the worker; it does not satisfy this requirement. - The full cold/ready, small/large, one/many-root and transport-chunk matrix; sustained fairness between continually ready producers; and a side-by-side count/time/combined-budget comparison. Finite concurrent-producer and reader tests are already on
main. - Complete browser evidence for every path, including direct readers and a committed deferred-swap responsiveness fixture. test: cover buffered backlog responsiveness in Chromium #1877 supplies trusted-input/Event Timing coverage, but not a frame/trace record for each backlog; its post-completion rAF wait only lets Event Timing notifications arrive. Startup, first useful paint, allocations and retained-payload tradeoffs also remain incomplete.
- Input selection, IME/composition and activation-dependent native gesture behavior inside an island that is still waiting. test: cover buffered backlog responsiveness in Chromium #1877's controlled-input caret checks are outside inactive islands.
- Passive-effect timing/ordering review: the current text still says effects normally run after paint without describing early drains during later renders. Coalescing removes per-value component commit bursts, but does not by itself resolve that documentation/audit item.
- Narrower transition follow-ups recorded by fix(octane): render a pending cue at urgent priority (#1864) #1899 and fix(octane): drop isPending in the transition's own render (#1864) #1911: nested pure cues can duplicate a descendant render; native signal Actions and release after held promotion still publish their falling edge separately; sibling falling-edge effect ordering can differ from React. The old same-component/ancestor cue bugs and ordinary extra falling-edge commit are fixed.
Problem
Octane should remain responsive when asynchronous work is already available: a cache hit, a buffered stream, a preloaded island, or a backlog of actions whose promises have settled. Those paths can currently keep producing more microtasks without giving the browser another scheduling opportunity.
This issue investigates megatasks: a task followed by a growing microtask checkpoint that behaves like one uninterrupted block of main-thread work. Individual callbacks may be small and the code may contain many await statements, while their combined work delays input, rendering, timers, and cancellation initiated by a later event.
The existing scheduling contract says renders are microtask-batched and run to completion; priority currently governs Suspense holding rather than general commit deferral. That contract is a design choice and is open to change. The investigation should establish the responsiveness guarantees Octane ought to provide, then evaluate changes to producer scheduling, render scheduling, and the documented contract. Existing behavior should inform compatibility testing, rather than rule out an improvement.
This is an investigation and scheduling-design issue. The source mechanisms below are confirmed, and one stream mechanism has a runnable event-loop reproduction. Browser input/paint impact and appropriate budgets still need measurement; this is not a claim that every listed path already causes a demonstrated production stall.
Why apparently asynchronous work can still block
A JavaScript callback runs to completion. At a microtask checkpoint, the browser drains promise reactions and queueMicrotask callbacks, including new microtasks queued by those callbacks, before returning to normal event-loop scheduling.
Consequently:
await Promise.resolve(value), awaiting an already-settled promise, andqueueMicrotask(next)let other microtasks run, but do not establish a browser task boundary.- Cold I/O can space continuations across separate tasks. Replacing those waits with cached results, or receiving many records in one transport chunk, can remove those scheduling opportunities. A cache can therefore improve completion time while worsening the longest uninterrupted interval.
- Several small operations can accumulate: resolve data → notify signals → render → commit → drain earlier effects → resolve the next item. A per-render loop guard does not necessarily bound the total work across this chain.
- A timer-based timeout or an abort requested by a later input event cannot interrupt an endlessly replenished checkpoint. Cancellation checks inside the chain remain useful, but the event requesting cancellation must first get a chance to run.
- Posting another task gives the browser an opportunity to schedule other work; it does not promise that a paint or a particular input task will occur immediately.
For example, this can process the whole collection before the browser handles another input event when every loader result is already available:
for (const key of keys) {
const value = await loadCachedValue(key);
updateUI(value);
}There is no requirement that each item be expensive. Thirty small updates, plus their dependent work, may consume the frame budget together. Conversely, an isolated large synchronous render is an ordinary long-task problem; adding a yield after it does not make that render interruptible.
Concrete paths to investigate
Source links are pinned to public main at 21f911d51d35fa4bf9ffe8a374bb1b4c1bbfd674.
1. Ready signal streams and cached query results
Query stream pulling uses Promise.resolve(step).then(...), publishes the result, and immediately requests the next step when no observation wait is required. If an observation wait is already settled, its .then() is still a microtask.
Derived streams publish each value and queue their next pull with queueMicrotask. This permits subscriber-driven cancellation before the next pull, but does not let a future browser event run.
A ready backlog can keep producing notifications and scheduled renders in one checkpoint. An indefinitely ready producer could starve the event loop indefinitely unless another path stops it. This can happen with buffered async iterators without any explicit application loop that looks synchronous.
The ordinary query-result path also normalizes results through Promise.resolve. Investigate many simultaneously ready loaders and whether notification/render coalescing sufficiently reduces their work. Do not conflate this with internal ready seed or retained-request reuse: those are separate paths and do not inherently manufacture a new promise chain.
2. Buffered RPC and streamed renderer delivery
The RPC line reader can decode a frame from bytes it already holds; its async return is then immediately ready. The RPC iterator serializes pulls with pulls.then(pull, pull). Repeated consumption of buffered frames therefore need not return to the event loop.
The optional streamed renderer response reader similarly awaits line acceptance and buffered reads. Its delivery queue and backpressure use promises and per-channel chains. Pending frame/byte limits bound queued memory, but do not establish an elapsed-time or main-thread fairness budget when deliveries keep completing immediately.
Investigate both parsing and downstream work: signal publication, HTML placement, style readiness, and resulting render/effect work. Transport chunk boundaries must not be assumed to correspond to a scheduling boundary per logical record.
3. Independent hydration activated in a burst
Independent island activation runs Promise.resolve().then(loadStyles).then(load).then(activate). The generated style loader reuses an existing promise and resolves immediately when the stylesheet is already available. The activation adapter eventually calls hydrateRoot.
Multiple load islands, or several islands activated by one IntersectionObserver notification, can therefore have many ready continuations together. Actual warm module-import timing depends on the browser and build output and must be measured.
The idle strategy delays the initial trigger, but does not itself consume an idle deadline or bound the subsequent activation chain. Starting during idle time is not sufficient proof that all later work stays within an idle budget.
4. Backlogged action dispatches
useActionState starts with a resolved promise and appends each dispatch to a sequential promise chain. Synchronous or already-resolved action results can settle, schedule a render, and release the next action entirely within the same checkpoint.
Relevant workloads include bulk programmatic dispatch and a queue where later external results are ready before the first action finishes. Separate low-volume user submissions do not automatically produce this burst.
Any change must preserve sequential previous-state threading, dispatch-time action selection, pending status, error behavior, and teardown semantics.
5. Deferred ready work and effect amplification
spawnDeferredSwap uses a microtask, then schedules a transition render. If the new value is already ready and its render does not suspend, the earlier and later DOM states can both commit before the browser paints. Transition priority alone does not allow a new browser input task to interrupt the checkpoint.
Also inspect drainPassivesBeforeRender. Following renders may pull earlier passive work into the same burst. Ordinary passive scheduling already has a real rAF followed by a posted task, with a timer fallback; the concern is how repeated ready continuations interact with the early-drain path. Preserve required lifecycle ordering when considering a change.
Reproduced event-loop behavior
The RPC source above was exercised directly with Node 22.22.3, using the public commit, 32 ordered value frames, and four trials per case. Both modes produced all 32 values in order with checksum 496.
A timer was armed immediately before reading. The two transports delivered identical values either as one buffered chunk or one frame per timer task. The consumer was tested with no synthetic work and with approximately 2 ms of synthetic CPU work per value.
| Case | Values consumed when timer ran, all four trials | Timer delay |
|---|---|---|
| Buffered, no synthetic work | 32 / 32 | 0.31–2.92 ms |
| Separate task per frame, no synthetic work | 0 / 32 | 1.22–1.46 ms |
| Buffered, 2 ms consumer work per value | 32 / 32 | 64.44–64.91 ms |
| Separate task per frame, same consumer work | 0 / 32 | 1.20–1.23 ms |
The ordering result demonstrates the mechanism. The added CPU work models downstream cost; 64 ms is not Octane's decoding cost. These are Node event-loop observations, not browser input latency, paint measurements, or a framework throughput comparison. The timer-delivered control intentionally adds scheduling overhead.
Runnable source-level reproduction
Save as megatask-repro.mjs outside the source tree, then run with Node 22.22.3 against a checkout of the pinned commit:
node --experimental-transform-types /path/to/megatask-repro.mjs /path/to/octaneThe resolver only maps local source .js imports to their authored .ts files. No runtime implementation is patched.
import { registerHooks } from 'node:module';
import { accessSync, realpathSync } from 'node:fs';
import { resolve, sep } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
const root = pathToFileURL(realpathSync(resolve(process.argv[2] ?? '.', 'packages/octane/src')) + sep).href;
registerHooks({
resolve(specifier, context, nextResolve) {
if (context.parentURL?.startsWith(root) && specifier.startsWith('.') && specifier.endsWith('.js')) {
const url = new URL(specifier.slice(0, -3) + '.ts', context.parentURL);
try {
accessSync(fileURLToPath(url));
return nextResolve(url.href, context);
} catch {}
}
return nextResolve(specifier, context);
}
});
const { readServerResult } = await import(root + 'server-rpc-stream-client.ts');
const { encodeServerResultFrame } = await import(root + 'server-rpc-protocol.ts');
const task = () => new Promise(resolve => setTimeout(resolve, 0));
const rows = [];
const n = 32;
for (const cost of [0, 2]) {
for (const mode of ['buffered', 'separate-tasks']) {
for (let iteration = 0; iteration < 4; iteration++) {
const frames = [encodeServerResultFrame(0, {kind:'stream'})];
for (let i=0;i<n;i++) frames.push(encodeServerResultFrame(i+1,{kind:'value',value:i}));
frames.push(encodeServerResultFrame(n+1,{kind:'complete'}));
const length = frames.reduce((n, f) => n+f.byteLength, 0);
let index=0;
const body = new ReadableStream({
async pull(controller) {
if (mode === 'separate-tasks') {
await task();
if (index < frames.length) controller.enqueue(frames[index++]);
else controller.close();
} else {
const chunk = new Uint8Array(length);
let offset=0;
for (const frame of frames) {chunk.set(frame,offset); offset+=frame.byteLength;}
controller.enqueue(chunk);
controller.close();
}
}
});
await task();
let done=0, checksum=0;
const start=performance.now();
const marker = new Promise(resolve=>setTimeout(()=>
resolve({count:done, afterMs: +(performance.now()-start).toFixed(2)}),0));
const iterable=await readServerResult(new Response(body));
for await(const value of iterable){
if (value !== done) throw Error('Order violation');
checksum+=value;
const workStart=performance.now();
while(performance.now()-workStart<cost) {}
done++;
}
const totalMs=+(performance.now()-start).toFixed(2);
const seen=await marker;
if(done!==n||checksum!==n*(n-1)/2) throw Error('Invalid final state');
rows.push({mode,cost,iteration,done,checksum,totalMs,seen});
}
}
}
console.log(JSON.stringify({node:process.version,rows},null,2));Investigation checklist
Establish browser impact and the required guarantee
- Build minimal production browser fixtures for each path above. Pair cold/pending inputs with already-resolved, cached, preloaded, and buffered inputs; keep values, final UI, and required lifecycle behavior equivalent. Progress: The Action backlog (fix(octane): render transition-priority work in a later task #1873), query/derived/Action/island backlogs (test: cover buffered backlog responsiveness in Chromium #1877), and same-component/ancestor transition cues (fix(octane): commit the pending cue apart from its component's transition (#1864) #1888, fix(octane): render a pending cue at urgent priority (#1864) #1899) are on
main. Direct readers still have the Node production-runtime probe (fix: pace buffered RPC and renderer readers #1878); fix(octane): run useDeferredValue's deferred render in a later task #1867 used a scratch deferred-swap browser probe. The complete cold/ready fixture matrix is not yet covered. - Measure uninterrupted task/checkpoint duration, frame opportunities, actual trusted input latency, time to first useful state, completion time, commit count, and effect count. Include representative workloads and constrained CPU; do not use the absence of a >50 ms long-task entry as the sole responsiveness criterion. Progress: Recorded Event Timing covers deferred swaps, Action backlogs and both cue placements at 1×/4× CPU; test: cover buffered backlog responsiveness in Chromium #1877 adds trusted-input/Event Timing, commit and completion reports for streams/Actions/islands at 6× CPU. fix: coalesce and pace ready signal producers #1875/fix: pace buffered RPC and renderer readers #1878 report marker latency and completion. Per-backlog frame/trace evidence, first-useful-paint and full effect-cost attribution remain incomplete.
- Cover small/large bursts, one/many roots, small/many transport chunks, and multiple streams or islands becoming ready together. Determine whether a budget needs to be shared across producers rather than resetting for each one. Progress: The shared-budget decision is implemented in fix: pace buffered RPC and renderer readers #1878 and fix: coalesce and pace ready signal producers #1875. Landed tests cover ready islands sharing a module, fragmented/concurrent readers, and concurrent query/derived producers; test: cover buffered backlog responsiveness in Chromium #1877 adds 60-island browser activation. The full burst/root/chunk matrix remains incomplete.
- Reproduce indefinitely ready producers only in an isolated page/process with an external watchdog. An in-page timeout is not a reliable escape from microtask starvation. Progress: No matching external-watchdog reproduction was found in the landed work.
signals-waiter-race-watchdog.test.tsis an in-worker retry bound for a different displaced-pending-source bug. - State the intended responsiveness guarantee and who owns it: producer iteration, stream delivery, island activation, render scheduling, or a shared scheduler. Decide what the framework can guarantee when one application callback or atomic commit alone exceeds the budget. Done: the investigation comment states G1–G4, and the Codex follow-up agreed. Render scheduling owns deferred and transition work (fix(octane): run useDeferredValue's deferred render in a later task #1867, fix(octane): render transition-priority work in a later task #1873). The island gate owns activation (fix(hydration): activate ready independent islands one per task #1866). One shared host budget covers readers and producers (fix: pace buffered RPC and renderer readers #1878, fix: coalesce and pace ready signal producers #1875). The G4 limits are documented: there is no time-slicing (differences §Scheduler), and the budget cannot interrupt one callback, parse, render or commit (
host-budget.ts,docs/deferred-hydration.md).
Find safe and effective scheduling boundaries
- Compare count-based, elapsed-time-based, and combined budgets between stream pulls, accepted frames, island activations, and completed actions. Measure first-value latency and throughput as well as responsiveness. Progress: The selected policies are on
main: one approximately 5 ms elapsed-time window shared by readers/producers, and one island activation per task. fix: pace buffered RPC and renderer readers #1878/fix: coalesce and pace ready signal producers #1875 report marker latency and total completion, including concurrent-stream throughput/commit tradeoffs. A side-by-side count/time/combined comparison remains open. - Evaluate changing the scheduler's microtask-only policy, including actual task boundaries for deferred/transition work. Determine whether yielding between complete work units is sufficient or whether large render preparation needs a deeper scheduling change. Done: deferred and transition work now render in a posted host task (fix(octane): run useDeferredValue's deferred render in a later task #1867, fix(octane): render transition-priority work in a later task #1873), and urgent work stays on microtasks. The chosen depth is yielding between complete units. Time-slicing is out of scope, and differences §Scheduler documents that.
- Evaluate existing scheduling primitives before introducing new machinery. A promise-only yield does not solve this problem; rAF by itself also runs before paint. Account for browser support, background tabs, non-DOM hosts, and server execution. Done: the investigation reviewed the runtime's four ad-hoc task posters. The result is one shared
postHostTask, which triesscheduler.postTask, thenMessageChannel, thensetTimeout.MessageChannelavoids background-tab timer throttling, and hosts with neither get the timer. The poster backs the deferred swap, the transition queue and the island gate. - Check fairness when several producers continually reschedule work, and whether fresh input or urgent work can overtake lower-priority backlog. Avoid a design that fixes one stream while starving its siblings. Progress: Finite reader and query/derived concurrency share one budget (fix: pace buffered RPC and renderer readers #1878, fix: coalesce and pace ready signal producers #1875).
signal-task.test.tschecks aggregate work across 12 producers, ordered delivery, and cancellation after a wait; test: cover buffered backlog responsiveness in Chromium #1877 requires trusted input before prolonged finite stream/island work finishes. Urgent updates can overtake queued work. Sustained fairness for continually ready producers remains open. - Trace notification coalescing, duplicate renders, pending passive drains, and parsing/allocation cost. Remove avoidable work where possible; yield remaining work rather than simply moving the same uninterrupted burst into another callback. Progress: Action bursts dropped from 101 commits to 2 (fix(octane): render transition-priority work in a later task #1873); skipped deferred values never render (fix(octane): run useDeferredValue's deferred render in a later task #1867); 100 ready query/derived values dropped from 101 component commits to 1 (fix: coalesce and pace ready signal producers #1875), while publications, graph effects and direct bindings remain observable. fix(octane): drop isPending in the transition's own render (#1864) #1911 removes the ordinary transition falling-edge commit. feat: complete profiling counter core #1955 adds semantic work/effect counters, but the passive-drain and full parsing/allocation audit is not complete.
Preserve observable correctness
-
For signals and streams, preserve order, completion/error delivery, stale-result checks, scope disposal, iterator cleanup, and request ownership. Removing UI subscribers must not silently cancel a stream whose resource binding still owns it. Done: fix: pace buffered RPC and renderer readers #1878 covers reader ordering, malformed/error delivery, abort/retirement after waits, iterator return and backpressure. fix: coalesce and pace ready signal producers #1875 adds producer-lease revalidation, replacement/disposal and concurrent query/derived regressions, while preserving source publications, resource ownership and server observation acknowledgements. UI render admission is coalesced, not the resource/publication lifecycle.
-
For hydration and streamed DOM placement, preserve atomic adoption/placement, DOM identity, per-channel ordering, activation generations, event replay, input selection, composition/IME state, and native user-gesture requirements. Revalidate stale work after a task boundary. Progress: The island gate (fix(hydration): activate ready independent islands one per task #1866) rechecks generation after waits, keeps captured input queued, and supports pause/dispose/resume and paced bfcache restoration. fix: pace buffered RPC and renderer readers #1878 preserves renderer channel order/backpressure and inline delivery. test: cover buffered backlog responsiveness in Chromium #1877 verifies adopted island identity and live handlers; its draft/focus/caret checks concern a separate active input. Selection/IME and native-gesture requirements inside a waiting island remain unverified.
-
For actions, preserve the previous completed state, dispatch-time action, pending count, errors, and behavior after unmount. Test an early blocked action followed by many already-ready actions. Done in fix(octane): render transition-priority work in a later task #1873.
transition-flush-task.test.tscovers 100 synchronous dispatches, actions that return resolved promises, a slow first action followed by a backlog, a failed action, and an unmount before the task runs. -
For deferred work and Suspense, test visible stale content, urgent supersession, actual suspension, already-ready results, and held commits. Establish which intermediate states must be observable and which may coalesce. Done in fix(octane): run useDeferredValue's deferred render in a later task #1867 and fix(octane): render transition-priority work in a later task #1873. The tests cover:
- the stale value surviving later microtask checkpoints;
- urgent updates before the task retargeting one swap;
- sibling deferred values committing together;
- a transition that suspends after its cue keeping the previous content.
The contract now says that skipped deferred values and intermediate Action results never commit.
-
Audit changed event ordering, controlled input restoration, refs, insertion/layout/passive effects,
flushSync,act(), and promise-continuation observations. Update the scheduling contract when the chosen behavior changes; do not assume every current incidental ordering must remain fixed. Progress: fix(octane): render transition-priority work in a later task #1873 covers task draining byflushSync/act(), controlled-input restoration and urgentsetState(); await 0. fix: coalesce and pace ready signal producers #1875 preserves urgent input and imperative updates during producer work. fix(octane): commit the pending cue apart from its component's transition (#1864) #1888/fix(octane): render a pending cue at urgent priority (#1864) #1899 separate cues and View Transition capture; fix(octane): drop isPending in the transition's own render (#1864) #1911 updates falling-edge/hold ordering and tests. Its native-signal/held-promotion and sibling-effect exceptions, plus the passive-timing documentation noted above, remain follow-ups.
Add regression evidence and quantify the tradeoff
- Add deterministic tests that an independent task can run before a sufficiently large finite burst completes, alongside exact final-state/order/cancellation assertions. A passing
act(), a sequence ofawait Promise.resolve(), or final DOM equality alone does not prove responsiveness. Done:deferred-value-task,independent-island-activation-pacing,transition-flush-task,reader-taskandsignal-taskare onmain(fix(octane): run useDeferredValue's deferred render in a later task #1867, fix(hydration): activate ready independent islands one per task #1866, fix(octane): render transition-priority work in a later task #1873, fix: pace buffered RPC and renderer readers #1878, fix: coalesce and pace ready signal producers #1875). Marker-task tests cover finite bursts alongside final state/order and cancellation; producer replacement and disposal are revalidated after budget waits. - Add real-browser input and frame/trace coverage. Existing sequential action tests, stream lifecycle tests, and stream backpressure tests are useful correctness controls, but are not by themselves fairness evidence. Progress: Production Chromium Action-backlog coverage (fix(octane): render transition-priority work in a later task #1873), buffered query/derived/Action/island canaries (test: cover buffered backlog responsiveness in Chromium #1877), and same-component/ancestor transition-cue cases (fix(octane): commit the pending cue apart from its component's transition (#1864) #1888, fix(octane): render a pending cue at urgent priority (#1864) #1899) have landed. The committed backlog runner reports trusted input, Event Timing, commits and completion at 6× CPU. It does not record per-backlog frames/traces; waiting for rAF after completion is not proof of an intermediate paint, so this combined item remains open.
- Benchmark candidate changes on both small ordinary updates and large ready bursts: startup, first value/paint, throughput, allocations, retained payloads, bundle size, and render/commit overhead. Check that the cost is not shifted into a later oversized callback. Progress: The merged PRs report bundle/work counters and focused probes. fix: coalesce and pace ready signal producers #1875 quantifies coalescing, marker latency, concurrent-root extra commits and completion cost; test: cover buffered backlog responsiveness in Chromium #1877 adds a repeatable browser runner; fix(octane): drop isPending in the transition's own render (#1864) #1911 quantifies falling-edge render/allocation reductions and held-case cost. The complete startup/first-paint/allocation/retained-payload matrix has not been measured.
- Record the selected guarantee, budget rationale, compatibility changes, measured tradeoffs, and remaining indivisible work. Split concrete fixes into focused follow-up issues/PRs once browser reproductions identify the owning boundary. Done: All five implementation steps and the cue/falling-edge follow-ups have merged. Decisions and limits are recorded in differences §Scheduler/§Actions,
docs/deferred-hydration.md, the scheduler benchmark README and the linked PRs. The Status section now distinguishes the selected policies and recorded tradeoffs from the still-open measurement and compatibility work.
Related history and completion criteria
Closed issues #1735 and #1763 covered specific pending-derived stabilization/settled-waiter failures. They are relevant regression neighbors, but this issue does not assert those bugs remain: a finite stream of valid ready values can monopolize a checkpoint even when every value is correct and the graph stabilizes.
Completion should produce browser-backed results for the reachable cases, an explicit scheduling-policy decision, and tested fixes or a documented measured rationale for each retained behavior. The current no-yield contract is not a reason on its own to close the investigation.
Activity
trueadm commentedon Oct 7, 2026
TL;DR
useDeferredValueis the most user-visible case. It currently gives no responsiveness benefit. In real Chromium, typing into the website's ownSlowListpattern costs 40–80 ms before each keystroke paints in Octane. In React, only the first keystroke crosses the 16 ms Event Timing threshold. The code comment and the website docs both promise the opposite.drainPassivesBeforeRendermatches React. The defect is the second render in the same checkpoint, not the drain.Evidence
1. Commits before a pre-armed task (jsdom/Node, Octane vs React 19.2.7 production)
Each probe does three things:
setTimeout(0)and aMessageChanneltask immediately before the burst;useLayoutEffect(..., null);The microtask/task ordering is a property of the host, not of jsdom: no browser can paint or deliver input inside a microtask checkpoint.
for await (x of ready) setState(x)query$(…, { kind: 'stream' }), buffered async iteratorderived$(() => asyncIterable)useActionState, 100 sync dispatches in one task0P, 1, 2, … 100)0P,100)useActionState, actions returnPromise.resolve(…)useActionState, first action gated, then 100 readyuseDeferredValue0→11/0and1/1both commit…1/0layout effect runs before1/1React runs the user's microtask loop to completion in one checkpoint too. The difference is the cost per hop: React only enqueues the update and renders once, in a Scheduler task.
2. Real browser: keystroke-to-paint with the website's
useDeferredValuedemoSetup:
memoSlowListwith a 40 ms busy-wait, which mirrorsplayground-examples.ts:1011, plus a controlled input anduseDeferredValue.durationThreshold: 16), taking the maximum perinteractionId.Both frameworks run exactly 6
SlowListrenders and reach the same final DOM. Octane runs each one before the keystroke paints. The busy-wait is wall-clock time, so CPU throttling scales only the framework's own work.3. The issue's RPC repro
It reproduces unchanged on Node 24.18.0:
Probe sources (scratch-only; not committed)
Fixture,
tests/_fixtures/zz-megatask-probe.tsrx. It is compiled by the normaloctaneVitest project.Harness core. The React side is the same component code written with
createElement, run against[email protected]on jsdom under its default Node Scheduler host.Browser harness: Playwright
page.keyboard.pressper character, with aPerformanceObserver({ type: 'event', durationThreshold: 16, buffered: true })installed before the bundle loads.Point by point
Framing: where the cost actually lives
I agree that a checkpoint cannot be interrupted, that caching removes the task boundaries cold I/O used to provide, and that the timer/abort escape fails.
I'd refine one point. The
for (const key of keys) { await loadCachedValue(key); updateUI(value) }example is a megatask in every framework, React included; React does not yield inside an application's microtask loop either. What Octane controls is the framework work attached to each hop:scheduleRenderarmsqueueMicrotask(flush), and that flush runs before the producer's next value arrives.This is not new.
project-analysis-concerns.md:275-278already notes that Octane "often flushes microtask-separated notifications as separate renders where React's automatic batching produces one commit". The per-update loop guard cannot see this either: every update scheduled withCURRENT_BLOCK === nullstarts a fresh chain (runtime.ts:7565-7575). That confirms the issue's point about the per-render guard.1. Signal streams: agree, and it's worse than stated
nextStreamStep. Derived streams pull throughqueueMicrotask.observePromisepath (requests.ts:403) has one hop per request. Reading the source, many loaders that become ready together should publish before the single flush microtask runs, so they should share one render. I didn't measure that, and I'd treat it as low priority.2. RPC and streamed delivery: A confirmed, B overstated for the default path
A. RPC.
reader.read()once the current chunk is used up (server-rpc-protocol.ts:126-146), which is about 6 microtasks per buffered frame and no task boundary.TextDecoderfor every frame.module serverfunctions that takeServerCallContextand return an async iterable use it.highWaterMark: 0, so a burst needs a lagging client or coalesced network chunks.querystream from §1. Coalescing at that consumer covers most of the cost.B. Streamed renderer delivery.
readStreamedRendererResponseis a custom-host API. Its only in-repo caller is a vite-plugin test fixture.<script>__octaneStreamedRenderer.receive(frame)</script>.setTimeoutplus aPromise.race.3. Island activation: partially confirmed
Confirmed:
adopt→renderBlock→commitRootRenders) is one synchronous block.idlestrategy hands the bare callback torequestIdleCallbackand never reads the deadline (idle.ts:26-36).Mitigating: on a cold load, island chunks are not modulepreloaded (
production.js:336-338). Different island modules therefore usually arrive in separate network tasks, which makes the "severalloadislands already ready" example less likely on a first visit.Realistic convergence points the issue missed:
loadevent (codegen.js:217-239).idle,visibleandmediaisland's chain together (independent-island.ts:241-249).pageshow→resume()re-arms every unfinished island in one loop, with modules already evaluated (document-lifecycle.ts:93,independent-island.ts:415-420).rootMargin: '600px'batches many entries into one IntersectionObserver callback.Fix shape:
activate. It goes after the module resolves and beforeintents.splice(0)andreplayReady = true. If the yield came afterreplayReady, the capture boundary would route input to a hold that doesn't exist yet and drop it.generationafter the yield.IdleDeadline.registerIndependentHydrationIslandrather than codegen, because that function is public and custom hosts call it directly.4. Actions: agree; the commit count matters first
scheduleRenderand thenresolveResult(runtime.ts:43649-43661). The flush microtask is queued ahead of the chain's next.then, so each action commits before the next one starts.pendingCount, error-continues-queue, and teardown.actions.test.ts'ssettle()(30 microtasks, thenflushSync) should still drain, becauseflushSyncdrains both priorities.differences-from-react.md:1065-1067says Actions "match React 19". They don't: Octane commits intermediate states1…99that React never produces. Octane also runs even a sync action one microtask later than React does.5. Deferred work: agree, highest priority
useDeferredValuekeeps today is the Suspense hold when the deferred render suspends.runtime.ts:43900-43902says the swap "can be interrupted by urgent updates". No input can be delivered between those two microtasks.core-apis.mdx:1193-1195says "a search box can receive every keystroke immediately".spawnDeferredSwapposts its swap to a task instead of a microtask.s.next, so a fast typist skips intermediate deferred renders, as in React.drainPassivesBeforeRender: React also flushes pending passive effects before it renders, at the start ofcommitRoot/performWorkOnRoot. The drain isn't the defect; the second render in the same checkpoint is.The guarantee I'd propose
The runtime already accepts this principle in one place.
resumeOnSettleyields one macrotask after an already-seen settlement, specifically so that a re-suspending reader keeps suspending "without starving timers or network callbacks" (differences:1480-1488). SSR retries back off on a timer for the same reason. I'd extend that principle:startTransitioncalled from async contexts. They flush in a posted task.flushSyncis unchanged.act()already drains throughMessageChannelcheckpoints (runtime.ts:10591), so conformance tests that mapwaitForPainttoact()should survive.act(), norflushSync(React's DefaultLane) flush in a task.awaitcontinuation can observe the commit aftersetState(); await 0") and will move test timing broadly.await 0observation for ordinary single updates.setStateafter a measured run. When in doubt, I'd lean toward React parity.frameInterval) before the sentinel has run defers its next step until after the sentinel.Primitive. The runtime already has four ad-hoc task posters:
schedulePostPaint'sMessageChannel(runtime.ts:11135);actCheckpoint;createResizeObserver'spostTask(resize-observer.ts:29-37);resumeOnSettle'ssetTimeout.One shared poster should back G1–G3:
scheduler.postTaskwhere available, otherwiseMessageChannel, otherwisesetTimeout.MessageChannelavoids background-tab timer throttling, andrequestAnimationFramestops entirely in background tabs. That answers the background-tab item in the checklist.On the checklist
MessageChanneltask before the burst, then assert that at most one commit precedes it, or that it runs between the urgent and deferred commits.octane-events-browserPlaywright project.runtime.tscomment,core-apis.mdx, and the playground example.shouldYieldsentinel for stream pulls (G3).IdleDeadline.I also agree with the completion criteria: the current no-yield contract is a design choice and should not be treated as a reason to close the issue.
trueadm commentedon Oct 7, 2026
Step 4 of the split (island activation gate) is up as #1866.
registerIndependentHydrationIslandsends every activation through a per-document gate, after the module resolves and before replays are taken. Custom hosts that call the function directly get the same pacing.scheduler.postTask, thenMessageChannel, thensetTimeout). Islands holding captured input go first.replayReadystays false;pause()and dispose still cancel it, and a cancelled turn does not use up a task;MessageChanneltask armed before activation runs before the last island hydrates;IdleDeadlineforwarding was left out. Each idle callback is already its own task, and the deadline is stale by the time a module that wasn't cached resolves. Pacing within an idle period fits the shared host budget (G3) better.domgan-oai commentedon Oct 7, 2026
Agreed with the priorities. The reported commit counts and Chromium probe strengthen the case for coalescing repeated framework work first, with pacing where work can keep producing ready continuations indefinitely. Simply giving every value a separate task would retain unnecessary render/commit work.
I agree with this order:
Two qualifications should shape the acceptance criteria:
1. Unpainted intermediate commits are not automatically unobservable.
Effects, cleanups, refs, imperative subscriptions, and action execution can have externally visible consequences even when an intermediate DOM state never paints. “Latest-wins” state does not by itself establish that every intermediate notification or side effect may be discarded.
The opportunity is to coalesce eligible scheduled render work, without silently dropping required signal publications, actions, or ordering guarantees. We should test imperative subscribers, action previous-state threading and pending/error behavior, disposal/cancellation, and the lifecycle behavior around the final committed state. This does not mean retaining every existing intermediate commit: batching may intentionally change which intermediate states commit and run effects. Where the intended contract changes, make that decision explicit and update its tests and documentation.
2. A posted task establishes a scheduling opportunity, not a guaranteed paint or input delivery.
Moving work out of the microtask checkpoint is necessary for the proposed separation, but the browser still decides which task runs next and when rendering happens. A pre-armed MessageChannel marker proves event-loop progress; it does not alone prove that the urgent state painted before expensive deferred work, or that a newly arriving keystroke was handled promptly. The HTML event-loop model separates these concerns.
Keep the deterministic task-order tests, and pair them with trusted-input/Event Timing measurements and frame or trace evidence for the actual user-visible sequence. Also retain the stated limit: once an indivisible 40 ms render or commit starts, posting it as a task does not make it interruptible.
These qualifications support the proposed direction. They distinguish reducing unnecessary work, returning control to the host, and actually improving responsiveness—the implementation should demonstrate all three where applicable. I checked the source mechanism; the browser timings remain the measurements reported above, rather than an independent rerun on my side.
trueadm commentedon Oct 7, 2026
Step 1 of the split in the investigation comment, the deferred swap in a task, is up as #1867.
What changed
spawnDeferredSwapqueues its slots. From a microtask after the spawning commit, it posts one host task that swaps them all, throughscheduler.postTask, thenMessageChannel, thensetTimeout.core-apis.mdx, the playground example, anddifferences-from-react.mdnow describe this. That includes the remaining gap: there is no time-slicing, so a key that lands during a deferred render waits for it.Measured (Chromium 149, memo'd 40 ms
SlowList, Event Timing ≥ 16 ms):mainThe paced rows match the React 19.2.7 profile above.
Two notes for the later steps
MessageChannelmessages from different ports run in port-creation order, not post order. A shared poster therefore uses a fresh channel per post to keep tasks first-in, first-out. It lives inpackages/octane/src/host-task.ts.act()has to wait for posted work explicitly, becausehasPendingWork()stays synchronous-only for testing-library. The G1 transition and action-result step will need the same treatment.docs(skills): add perf-review and hot-path V8, DOM, and scheduling ru…
fix(octane): run useDeferredValue's deferred render in a later task (#…
fix(hydration): activate ready independent islands one per task (#1866)
trueadm commentedon Oct 7, 2026
Where the five-step split stands
3a94771e96)8fa3398c58)No open PR or active session owns steps 2, 3 or 5.
What landed
#1867, deferred swap (path 5)
useDeferredValuenow swaps in a posted host task. The task comes from a new shared poster,postHostTask, which triesscheduler.postTask, then a freshMessageChannelper post, thensetTimeout.SlowListand keys 120 ms apart: slow keys dropped from 6/6 to 1/6. In a 15 ms key burst, the worst key dropped from 264–272 ms to 32–40 ms. Both now match the React 19.2.7 profile.core-apis.mdxand the playground example now describe the new behavior, including its limit: without time-slicing, a key that lands during a deferred render waits for that render to finish.#1866, island activation (path 3)
registerIndependentHydrationIslandsends each activation through a per-document gate, so at most one island activates per task. Islands holding captured input go first. A waiting island still captures input into its replay.pause(), dispose and the generation check run after the wait. A back/forward-cache restore is paced the same way.IdleDeadlinewas dropped deliberately and moved to G3.Checklist coverage so far:
Loose ends from the two merges
independent-island.tskept a privatepostActivationTaskthat is identical topostHostTask. Step 2 should switch it to the shared helper.Next: step 2 (G1)
Goal. A render flush that contains only transition-priority work runs in a
postHostTasktask instead ofqueueMicrotask(flush). That coversuseActionStateresults, async action continuations, andstartTransitioncalled from async code. Urgent and discrete work stays on microtasks, andflushSyncstill drains both priorities.Action-result renders already schedule at transition priority, because the action's async transition is still counted when its result lands. The action chain itself stays on microtasks, so a backlog drains first and then commits once.
Target. 100 synchronous dispatches produce 2 commits (
0P, then100), as in React 19.2.7. A gated first action followed by 100 ready actions also produces 2 commits after the gate opens.Design points to settle in the PR:
runtime.tshas tenqueueMicrotask(flush)sites, not only the one inscheduleRender. Each needs the same priority decision, or a transition can still reach the microtask flush through another path.ASYNC_TRANSITION_COUNTtags every non-event, non-flushSyncupdate as transition while any async action is pending, so G1 would also defer unrelated updates in that window to a task. Decide whether that is acceptable or whether only the action's own work should move.act(). It has to wait for posted transition flushes, the same way fix(octane): run useDeferredValue's deferred render in a later task #1867 handlesDEFERRED_SWAPS.hasPendingWork()stays synchronous-only for testing-library.Must preserve:
pendingCountandisPending;isPendingacross the hold.Contract change. Dropping the intermediate action commits is intentional, per Codex's first qualification above. Update differences §Actions and §Scheduler, and update any test that pins intermediate states rather than silently weakening it.
Evidence:
MessageChanneltask armed before the burst runs before the final action commit;Then step 3. G2a for signal publications can reuse the task flush path from step 2. The G3 budget then adds a shared sentinel task, and stream pulls defer past it once about 5 ms have elapsed.
trueadm commentedon Oct 8, 2026
Step 2 (G1) is up as #1873. Its budget-only companion #1874 has to merge immediately before it: every byte budget moves, and the ratchet fails other PRs while only one of the two is on
main.What changed
TRANSITION_QUEUEfor onepostHostTasktask. That coversstartTransition, Action results, transitions afterawait, and the async-Action window.flushSyncandact()do, and an urgent update to a waiting component moves it onto the microtask flush (lane parity for mixed queues).useTransitionanduseActionStateraisingisPending, anduseOptimisticadding a value.isPending's falling edge and the transition's other finish work now follow the task's flush.postHostTask.Measured
useActionStatedispatches: 101 → 2 commits (0P,100), the same as React 19.2.7. A gated first action plus 100 ready ones andstartTransitionafterawaitcollapse the same way.Decisions and residuals (contract in differences §Actions and §Scheduler)
isPendingand the transition's own update live in the same component, both still render in the microtask flush, because Octane keeps one live tree. Parity there needs P1-style staging of the cells.main.For step 3: it can reuse
TRANSITION_QUEUE,afterTransitionFlushand the task driver.test(remix-router): commit the revalidation's loading state across a …
ci(bundle-size): raise budgets for the transition task flush (#1873) (#…
fix(octane): render transition-priority work in a later task (#1873)
trueadm commentedon Oct 8, 2026
The G1 gap #1873 left is up as #1888, with the budget-only companion #1887. As with #1873/#1874, the budget PR merges immediately before the feature PR.
The gap. When the component that raises
isPendingalso holds the transition's own update (the canonicaluseTransitionpattern), both rendered in the click's microtask flush. The cue showed the new state, and nothing painted until the whole transition render finished. In Chromium, the playground's Sort pattern (memoized 40 ms list) gave 5 of 5 slow clicks (40–80 ms of Event Timing latency), where React 19.2.7 gives 1 of 5 (the cold first click).What changed
addTransitionTypetypes.Residuals
isPending's falling edge still commits right after the transition render, in the same task, and never paints. That is one commit more than React, as in the cross-component case onmain.mainsince fix(octane): render transition-priority work in a later task #1873 landed.trueadm commentedon Oct 8, 2026
The issue body now opens with a Status section and marks the checklist against
mainat2f81266018. Five of the 19 items are ticked: the guarantee and its owners, the change to the microtask-only policy, the shared task poster, Action correctness, and deferred/Suspense correctness. The other items carry inline progress notes.Landed since the last note
c0192ec816), step 5: buffered RPC and custom renderer readers now share one host budget of about 5 ms (yieldForHostBudget). It landed ahead of step 3, which reuses the same budget.7540c3552e): an Action's pending cue no longer starts native View Transition capture on its own.2f81266018): the budget raises for fix: coalesce and pace ready signal producers #1875. fix: coalesce and pace ready signal producers #1875 should merge right after it.Still open
isPendingcue. ci(bundle-size): budget combined transition cues and native producers #1887 conflicts withmainand needs a rebase before the pair can merge.fix(octane): commit the pending cue apart from its component's transi…
fix(octane): render a pending cue at urgent priority (#1864) (#1899)
fix(octane): drop isPending in the transition's own render (#1864) (#…
trueadm commentedon Oct 13, 2026
Decision: hydration defers server-resolved Suspense arms (policy A)
@trueadm chose this on 2026-10-13 for yielding inside one large root's hydration.
Policy. Server-resolved Suspense arms always hydrate after the shell, outside the root hydration pass. This matches React 19.2, where react-dom 19.2.8 leaves every server-rendered boundary dehydrated at OffscreenLane.
yieldForHostBudget) is spent.Rejected alternative. Deferring arms only once the host budget is spent would keep today's timing for small trees. But which arms commit with the shell would then depend on device speed and CI load.
What changes for apps and tests
hydrateRootmust now awaitact().act()drains pending arms.Not covered. A root with no Suspense boundaries still hydrates in one task, as in React. An app benefits only once its sections sit in boundaries.
Implementation, tests and the
frame-boundariesbench will follow in a PR linked here.trueadm commentedon Oct 13, 2026
A reference implementation of policy A is #2040. It stays as a draft and won't merge on today's engine; the work folds into #2028 step 5 (see below).
hydrateRootcommits the shell in one task. Each server-resolved Suspense boundary then hydrates in a later host task, at least one per task, within the shared host budget. A boundary resumes directly in its parent's context, with no parent replay.Three paths hydrate a boundary before its turn:
act()drains waiting boundaries.On the app-frame
frame-boundariesbench (11 boundaries, Chromium at 4× CPU, 15 pairs againstmain):mainThe boundary-less
framescenario is unchanged. #2040's body breaks down the remaining +3.8% busy time.trueadm commentedon Oct 13, 2026
Update on hydrating Suspense boundaries after the shell: policy A stands. Per @trueadm, the implementation folds into #2028 step 5, on #2029's commit model.
perf(octane): hydrate server-resolved Suspense boundaries after the shell #2040 is a draft reference implementation. It won't merge on today's engine. On
frame-boundariesat 4× CPU it took the longest task from 87.7 to 20.5 ms, with busy total +3.8%.Step 5 rebuilds three of its pieces on Runtime: replace the nine render-deferral mechanisms with one commit model (transitions, Suspense, off-screen, ViewTransition, signal transitions) #2029: direct resume without a parent replay, root-node capture listeners for selective hydration, and hydrate-first on update.
The lessons are on the issues:
preserveRootCreatedDomcost appears when an arm commits outside a hydrating transaction;The full rules, numbers and lessons are on #2028 and #2029.
The
frame-boundariesscenario and its trace metrics land separately, on today's engine, as the gate step 5 must pass: longest task under 50 ms at 4× CPU with busy total flat. Onmainthat scenario hydrates in a single task of about 82 ms.