Skip to content

feat(octane): commit unrelated transitions independently - #2165

Merged
trueadm merged 4 commits into
nextfrom
test/parallel-transitions
Oct 20, 2026
Merged

trueadm merged 4 commits into
nextfrom
test/parallel-transitions

Conversation

@trueadm

@trueadm trueadm commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Parallel transitions, matching React 19.3 (react/react#35392, enabled in OSS by #37290). Unrelated transitions now commit independently: a transition that suspends holds only its own work. Before this PR, Octane held every pending transition until all of their data had arrived, then committed them together.

Refs #2053. This is the parallel-transitions half; Trusted Types landed in #2162.

Why

The tests ported from React showed three separate causes. A throwaway probe confirmed each one:

  1. Global reveal barrier (runtime/suspense.ts): a held boundary whose data settled waited until every boundary in HELD_TRANSITIONS was staged, across all transitions.
  2. useOptimistic revert (runtime/actions.ts): it cleared only when the global TRANSITION_PENDING_COUNT reached 0, so B's optimistic value waited for unrelated A.
  3. Shared boundary wake-up: a boundary holding A and B listened on one pendingThenable. Re-rendering B's drain re-attached A's thenable, and B's settle then hit the "superseded by a fresher suspend" guard and was dropped.

Changes

  • transitions.ts: stagedRevealGroup() groups held boundaries that hold a common root batch, transitively. A group reveals once all its members are staged. A held boundary with no batch hold joins every group, which keeps the old barrier when no hook work was folded.
  • suspense.ts:
    • flushStagedRevealsIfReady and flushStagedReveals(group) flush only the ready group. Other staged boundaries stay staged.
    • attachResume's retry still drops a superseded thenable, except for a boundary in HELD_TRANSITIONS.
  • actions.ts, types.ts and transitions.ts:
    • each optimistic value records the batch it was dispatched in (transitionActionBatchForUpdate);
    • the slot registers a revert on the batch (batch.optimistic, initialized null in the single batch literal);
    • finishTransitionHookBatch runs those reverts;
    • the global count-hits-0 clear stays as the fallback for untagged values.
  • Docs:
    • a "parallel transitions" paragraph in the docs/differences-from-react.md Scheduler section. It also notes that Octane has no 10-lane reuse, so it never entangles transitions that way.
    • a note on audit item Add changeset for the vyre→octane rename release #1 in SUSPENSE_DIVERGENCE.md.
  • Changeset: octane minor.

Validation

  • pnpm format:files:check
  • pnpm typecheck:files on every changed source, test, and fixture file
  • pnpm test: not run locally (machine load rule). Left to CI.
  • targeted tests:
    • New tests/conformance/parallel-transitions.test.ts, 11 cases. Seven are ported from ReactTransition-test.js:

      • an unrelated transition commits while another is suspended, with separate boundaries and with one shared boundary;
      • reversed resolution order;
      • the same queue stays entangled, with only the latest value rendered;
      • per-hook isPending;
      • per-transition useOptimistic revert;
      • a single-transition control.

      Four more are regressions for the Bugbot findings:

      • a fallback-hidden boundary reveals when an unrelated group commits in the same flush (second commit);
      • a superseded thenable keeps the boundary's fallback deadline (second commit);
      • every ready group starts its reveal while a view transition defers one of them (third commit);
      • a waiting transition stays pending when a superseded thenable settles behind its fallback (third commit).

      The independence cases failed before this PR, and each Bugbot case failed on the commit before its fix. All 11 now pass in both octane and octane-prod.

    • Neighbour behavior: conformance/entangled-commit.test.ts, where one transition fanning out to two boundaries still reveals them together, passes.

    • 64 related test files (transitions, suspense, optimistic, actions, entanglement, view transitions) in octane and octane-prod: 126 files, 2,706 tests passed.

  • Review fixes (second to fourth commits):
    • stagedRevealGroup returns one group, and flushStagedRevealsIfReady flushes each in turn.
    • A superseded settle on a held boundary only retries that boundary's held batches, so the boundary keeps its current thenable and timeout.
    • Every ready group flushes once per call, even when a view transition defers one, and a deferred run commits only members still staged.
    • The superseded-settle retry applies only to a held boundary still on screen. Behind a fallback, the hidden primary waits for its current thenable.
    • Fourth commit: a group still waiting is scanned again on the next pass of the reveal loop, and a deferred reveal with nothing left to commit returns without committing effects. Neither has a dedicated test: each is reachable only mid-loop (a boundary abandoned during another group's reveal, or a repeated flush during an in-flight view transition), and public behavior doesn't expose either.
  • perf-review: scan of the diff against origin/next → 1 candidate, dismissed. actions.ts:638 scheduleRender is the existing optimistic revert moved into a shared revert(). It runs once per finished batch per optimistic slot.
    • Hot paths: none per render or per node.
      • stagedRevealGroup runs when a boundary stages, on thenable settle, over a handful of boundaries.
      • The attachResume change adds a HELD_TRANSITIONS.has check only on the superseded branch.
      • Optimistic tagging is per dispatch.
      • finishTransitionHookBatch gains one null check per batch.
    • Shapes: the batch record gains optimistic in its single literal.
    • needs-evidence: a held boundary now retries its held batches when a superseded thenable settles. That costs one extra render attempt, which holds again if the latest data is not ready. No benchmark covers this path; it is correctness-neutral.
  • concise-code:
    • runtime +106 −32, no new files in src.
    • Alternatives rejected:
      • Per-batch render passes in the drain: unnecessary, since dropTransitionRender already holds only the drained origin's batches and re-renders the others.
      • Recording a thenable per batch on each hold: needs new holder bookkeeping. The held-boundary guard reuses the existing retry path.
      • Dropping the global barrier: would break entangled-commit.

Risk / follow-ups

  • Not ported: React's two ReactDeferredValue sibling-suspend interleaving tests (the "prewarm" log changes).
  • Async Actions are unchanged: a transition started while an async Action is in flight joins that Action, as React's entangled action lane does.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

High Risk
Changes core transition/Suspense commit ordering, optimistic revert timing, and held-boundary resume behavior—areas that affect concurrent UI updates and perceived loading state.

Overview
Parallel transitions (React 19.3): unrelated startTransition work no longer waits on a global Suspense reveal barrier. Each transition commits when its own async data is ready—separate or shared @try boundaries—while isPending and useOptimistic settle per transition, not when every held boundary finishes.

Suspense coordination replaces the old “all of HELD_TRANSITIONS must stage together” rule with stagedRevealGroup: boundaries that share the same root transition batch reveal as one group; unrelated groups flush independently via flushStagedReveals(group). A superseded thenable on an on-screen held boundary can retry that boundary’s batches so another transition’s settle is not dropped.

useOptimistic tags each queued value with its dispatch batch and registers revertBatch on TransitionActionBatch.optimistic, cleared in finishTransitionHookBatch instead of only when global transition pending hits zero.

Docs/changeset note Octane tracks transitions separately (no React 10-lane reuse). New parallel-transitions conformance tests cover independence, same-queue entanglement, fallback timeout, and view-transition deferral.

Reviewed by Cursor Bugbot for commit 174e70f. Bugbot is set up for automated code reviews on this repo. Configure here.

React 19.3 renders each transition lane on its own, so a suspended
transition no longer holds back an unrelated one. Octane held every
pending transition until all of their data arrived:

- The reveal barrier was global across held boundaries. It now groups
  boundaries that hold a common batch (stagedRevealGroup), so one
  transition's boundaries still reveal together while unrelated groups
  commit on their own.
- useOptimistic reverted only when the global pending count reached 0.
  Each value now records its batch and reverts when that batch finishes.
- A boundary holding several transitions woke only on its latest
  thenable. A held boundary now retries on any thenable it suspended on.

Refs #2053.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 20, 2026 16:27
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability labels Oct 20, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/octane/src/runtime/suspense.ts Resolved
Comment thread packages/octane/src/runtime/suspense.ts Resolved
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 35 value(s) increased
  • 🔴 bundle-reachability: 33 value(s) increased

Compares 424e5cc1f, the merge commit's first parent with 20a4ea4f7 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.075 2.850 +3.1% −3.8% … +7.0% ⚪ within noise
octane-tsrx replace 6.367 6.692 +5.0% −2.3% … +9.0% ⚪ within noise
octane-tsrx add 2.742 2.800 −3.7% −8.9% … +3.2% ⚪ within noise
octane-tsrx update 0.081 0.088 +3.2% −0.9% … +5.5% ⚪ within noise
octane-tsrx select 0.006 0.006 −1.8% −4.5% … +1.7% ⚪ within noise
octane-tsrx swap 0.018 0.018 +0.5% −4.9% … +2.2% ⚪ within noise
octane-tsrx remove 0.017 0.017 −2.2% −4.1% … +7.0% ⚪ within noise
octane-tsrx runlots 23.667 22.675 −4.1% −11.2% … +3.1% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 −0.3% −1.8% … +5.3% ⚪ within noise
octane-tsrx clear 52.533 52.900 +3.4% −4.1% … +9.6% ⚪ within noise
octane-jsx run 6.400 5.550 −10.1% −21.2% … +5.4% ⚪ within noise
octane-jsx replace 15.425 14.092 −1.0% −18.6% … +16.0% ⚪ within noise
octane-jsx add 6.900 6.842 +0.0% −9.8% … +11.8% ⚪ within noise
octane-jsx update 0.309 0.328 +6.5% −3.7% … +15.6% ⚪ within noise
octane-jsx select 0.178 0.175 +0.4% −9.2% … +8.0% ⚪ within noise
octane-jsx swap 0.211 0.225 +1.8% −3.6% … +9.6% ⚪ within noise
octane-jsx remove 0.135 0.133 +3.5% −1.3% … +7.7% ⚪ within noise
octane-jsx runlots 30.383 30.450 +3.5% −2.0% … +6.4% ⚪ within noise
octane-jsx select_lots 1.475 1.303 −6.4% −19.8% … −0.6% ⚪ within noise
octane-jsx clear 63.308 64.350 −0.1% −6.8% … +6.7% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx bindings_js_raw 683,563 683,664 +101 (+0.0%) 🔴
octane-tsrx bindings_js_gzip 226,329 226,360 +31 (+0.0%) 🔴
octane-tsrx bindings_js_brotli 192,866 192,840 −26 (−0.0%) 🟢
octane-tsrx bindings_app_gzip 116,559 116,558 −1 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 96,788 96,755 −33 (−0.0%) 🟢
octane-tsrx bindings_fw_raw 331,761 331,862 +101 (+0.0%) 🔴
octane-tsrx bindings_fw_gzip 109,770 109,802 +32 (+0.0%) 🔴
octane-tsrx bindings_fw_brotli 96,078 96,085 +7 (+0.0%) 🔴
octane-tsrx wayfinder_js_raw 437,753 438,367 +614 (+0.1%) 🔴
octane-tsrx wayfinder_js_gzip 144,694 144,851 +157 (+0.1%) 🔴
octane-tsrx wayfinder_js_brotli 126,372 126,450 +78 (+0.1%) 🔴
octane-tsrx pagecraft_oxc_js_raw 544,795 545,409 +614 (+0.1%) 🔴
octane-tsrx pagecraft_oxc_js_gzip 171,427 171,602 +175 (+0.1%) 🔴
octane-tsrx pagecraft_oxc_js_brotli 145,539 145,628 +89 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_raw 577,228 577,876 +648 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_gzip 186,781 187,022 +241 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_brotli 158,869 159,122 +253 (+0.2%) 🔴
octane-tsrx full_fw_raw 523,448 524,378 +930 (+0.2%) 🔴
octane-tsrx full_fw_gzip 163,487 163,773 +286 (+0.2%) 🔴
octane-tsrx full_fw_brotli 139,150 139,367 +217 (+0.2%) 🔴
octane-jsx shell_js_raw 327,763 328,371 +608 (+0.2%) 🔴
octane-jsx shell_js_gzip 106,840 107,003 +163 (+0.2%) 🔴
octane-jsx shell_js_brotli 92,663 92,834 +171 (+0.2%) 🔴
octane-jsx shell_app_gzip 763 762 −1 (−0.1%) 🟢
octane-jsx shell_app_brotli 654 665 +11 (+1.7%) 🔴
octane-jsx shell_fw_raw 326,670 327,278 +608 (+0.2%) 🔴
octane-jsx shell_fw_gzip 106,077 106,241 +164 (+0.2%) 🔴
octane-jsx shell_fw_brotli 92,009 92,169 +160 (+0.2%) 🔴
octane-jsx shell_client_js_raw 279,156 279,764 +608 (+0.2%) 🔴
octane-jsx shell_client_js_gzip 90,454 90,593 +139 (+0.2%) 🔴
octane-jsx shell_client_js_brotli 79,099 79,300 +201 (+0.3%) 🔴
octane-jsx shell_client_app_gzip 771 773 +2 (+0.3%) 🔴
octane-jsx shell_client_app_brotli 654 669 +15 (+2.3%) 🔴
octane-jsx shell_client_fw_raw 278,055 278,663 +608 (+0.2%) 🔴
octane-jsx shell_client_fw_gzip 89,683 89,820 +137 (+0.2%) 🔴
octane-jsx shell_client_fw_brotli 78,445 78,631 +186 (+0.2%) 🔴
octane-jsx full_fw_raw 523,448 524,378 +930 (+0.2%) 🔴
octane-jsx full_fw_gzip 163,487 163,773 +286 (+0.2%) 🔴
octane-jsx full_fw_brotli 139,150 139,367 +217 (+0.2%) 🔴

54 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
deferred-hydration raw 180,466 180,998 +532 (+0.3%) 🔴
deferred-hydration gzip 58,879 59,018 +139 (+0.2%) 🔴
deferred-hydration brotli 51,445 51,529 +84 (+0.2%) 🔴
hydrate-frame raw 340,968 341,496 +528 (+0.2%) 🔴
hydrate-frame gzip 109,507 109,646 +139 (+0.1%) 🔴
hydrate-frame brotli 95,159 95,323 +164 (+0.2%) 🔴
suspense-transition raw 115,601 116,215 +614 (+0.5%) 🔴
suspense-transition gzip 37,813 37,994 +181 (+0.5%) 🔴
suspense-transition brotli 33,604 33,796 +192 (+0.6%) 🔴
descriptor-children raw 160,051 160,152 +101 (+0.1%) 🔴
descriptor-children gzip 52,015 52,050 +35 (+0.1%) 🔴
descriptor-children brotli 46,311 46,328 +17 (+0.0%) 🔴
split-shell raw 391,792 392,406 +614 (+0.2%) 🔴
split-shell gzip 127,625 127,799 +174 (+0.1%) 🔴
split-shell brotli 111,289 111,304 +15 (+0.0%) 🔴
split-shell-runtime raw 316,694 317,308 +614 (+0.2%) 🔴
split-shell-runtime gzip 101,911 102,089 +178 (+0.2%) 🔴
split-shell-runtime brotli 88,153 88,182 +29 (+0.0%) 🔴
binding-base-ui-vite raw 170,559 170,660 +101 (+0.1%) 🔴
binding-base-ui-vite gzip 55,647 55,679 +32 (+0.1%) 🔴
binding-base-ui-vite brotli 49,439 49,459 +20 (+0.0%) 🔴
binding-base-ui-esbuild raw 198,760 198,861 +101 (+0.1%) 🔴
binding-base-ui-esbuild gzip 66,788 66,810 +22 (+0.0%) 🔴
binding-base-ui-esbuild brotli 59,092 59,030 −62 (−0.1%) 🟢
binding-radix-vite raw 170,003 170,104 +101 (+0.1%) 🔴
binding-radix-vite gzip 55,332 55,369 +37 (+0.1%) 🔴
binding-radix-vite brotli 49,108 49,084 −24 (−0.0%) 🟢
binding-radix-esbuild raw 198,248 198,349 +101 (+0.1%) 🔴
binding-radix-esbuild gzip 66,466 66,492 +26 (+0.0%) 🔴
binding-radix-esbuild brotli 58,671 58,812 +141 (+0.2%) 🔴
binding-apollo-client-vite raw 315,471 315,572 +101 (+0.0%) 🔴
binding-apollo-client-vite gzip 98,660 98,697 +37 (+0.0%) 🔴
binding-apollo-client-vite brotli 87,349 87,394 +45 (+0.1%) 🔴
binding-apollo-client-esbuild raw 350,872 350,973 +101 (+0.0%) 🔴
binding-apollo-client-esbuild gzip 113,852 113,892 +40 (+0.0%) 🔴
binding-apollo-client-esbuild brotli 100,562 100,483 −79 (−0.1%) 🟢
binding-usehooks-ts-esbuild gzip 27,910 27,908 −2 (−0.0%) 🟢
binding-usehooks-ts-esbuild brotli 25,216 25,163 −53 (−0.2%) 🟢

85 other measured values are unchanged.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 10d0168 Commit Preview URL

Branch Preview URL
Oct 20 2026, 04:46 PM

…dline

Two review findings on parallel transitions:

- stagedRevealGroup returned every ready group as one list, so a visible
  member's retry dropped an unrelated fallback-hidden member from
  STAGED_REVEALS without revealing it. It now returns one group, and
  flushStagedRevealsIfReady flushes each in turn.
- A superseded thenable settling on a held boundary ran the resume path,
  which cleared the boundary's fallback timeout and pendingThenable. It
  now only retries the boundary's held batches, so the fresher thenable
  keeps its resume and its deadline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 174e70f Commit Preview URL

Branch Preview URL
Oct 20 2026, 05:13 PM

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/octane/src/runtime/suspense.ts Resolved
Comment thread packages/octane/src/runtime/suspense.ts Resolved
… their thenable

Two more review findings on parallel transitions:

- flushStagedRevealsIfReady stopped at the first group whose reveal a
  view transition deferred, so later ready groups waited behind it. It
  now flushes each ready group once per call, and a deferred run commits
  only the members still staged, so a repeated flush is a no-op.
- After a fallback timeout a hold no longer suspends, so retrying it on
  a superseded settle finished every batch the boundary held: a still
  waiting transition dropped isPending behind the fallback. Only a held
  boundary still on screen retries on a superseded settle now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Unready groups stay excluded from flush
    • Moved the seen.add loop inside the readiness check so only ready (returned) groups are persisted in seen, allowing incomplete groups to be rediscovered on later iterations when a sibling flush makes them ready.
  • ✅ Fixed: Empty reveal still commits effects
    • Added an early return when the filtered batch is empty, preventing the vacuous-truth [].every(...) from setting deferEffects true and firing a spurious commitEffects() call.

Create PR

Or push these changes by commenting:

@cursor push 2a4566a243
Preview (2a4566a243)
diff --git a/packages/octane/src/runtime/suspense.ts b/packages/octane/src/runtime/suspense.ts
--- a/packages/octane/src/runtime/suspense.ts
+++ b/packages/octane/src/runtime/suspense.ts
@@ -2928,6 +2928,7 @@
 			// A deferred run commits only the members still staged: another flush may
 			// have revealed them first.
 			const batch = group.filter((state) => STAGED_REVEALS.has(state));
+			if (batch.length === 0) return;
 			for (const state of batch) STAGED_REVEALS.delete(state);
 			// Only fallback-hidden members have completed rollback-safe render
 			// captures. A pre-timeout visible hold remains within Octane's documented

diff --git a/packages/octane/src/runtime/transitions.ts b/packages/octane/src/runtime/transitions.ts
--- a/packages/octane/src/runtime/transitions.ts
+++ b/packages/octane/src/runtime/transitions.ts
@@ -478,8 +478,10 @@
 				if (shares) group.push(other);
 			}
 		}
-		for (const member of group) seen.add(member);
-		if (group.every((member) => STAGED_REVEALS.has(member))) return group;
+		if (group.every((member) => STAGED_REVEALS.has(member))) {
+			for (const member of group) seen.add(member);
+			return group;
+		}
 	}
 	return null;
 }

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 7fafcb2. Configure here.

Comment thread packages/octane/src/runtime/suspense.ts Resolved
@cursor

cursor Bot commented Oct 20, 2026

Copy link
Copy Markdown

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Independent ready groups strand hidden reveals
    • Changed stagedRevealGroup to return only the first ready group instead of concatenating all groups, and added a loop in flushStagedRevealsIfReady to process each group independently, preventing a visible member's retry from removing unrelated hidden boundaries from STAGED_REVEALS.
  • ✅ Fixed: Stale settle clears active fallback timeout
    • Guarded the pendingThenable and transitionTimeoutId cleanup in attachResume's retry closure with an isCurrent check, so a stale thenable settling on a held boundary no longer clears the timeout armed for the fresher thenable.

Create PR

Or push these changes by commenting:

@cursor push 8458a4cec5
Preview (8458a4cec5)
diff --git a/packages/octane/src/runtime/suspense.ts b/packages/octane/src/runtime/suspense.ts
--- a/packages/octane/src/runtime/suspense.ts
+++ b/packages/octane/src/runtime/suspense.ts
@@ -2889,8 +2889,12 @@
 	for (const state of STAGED_REVEALS) {
 		if (!HELD_TRANSITIONS.has(state)) STAGED_REVEALS.delete(state);
 	}
-	const group = STAGED_REVEALS.size === 0 ? null : stagedRevealGroup();
-	if (group !== null) flushStagedReveals(group);
+	// Process one group at a time: each flush removes its members from
+	// STAGED_REVEALS, so independent groups never share a single batch.
+	let group: TrySlot[] | null;
+	while ((group = STAGED_REVEALS.size === 0 ? null : stagedRevealGroup()) !== null) {
+		flushStagedReveals(group);
+	}
 }
 
 function compareStagedRevealDomOrder(a: TrySlot, b: TrySlot): number {
@@ -2979,16 +2983,18 @@
 		// A fresher suspend supersedes this one, unless the boundary holds
 		// transitions: each holds its own batches (Transition holds), so any
 		// thenable they suspended on may let one of them commit.
-		if (state.pendingThenable !== thenable && !HELD_TRANSITIONS.has(state)) return;
+		const isCurrent = state.pendingThenable === thenable;
+		if (!isCurrent && !HELD_TRANSITIONS.has(state)) return;
 		if (typeof __OCTANE_PROFILE_ENABLED__ !== 'undefined' && __OCTANE_PROFILE_ENABLED__)
 			__profileCount(ProfileCounter.BOUNDARY_RETRY);
-		state.pendingThenable = null;
-		// Cancel any pending transition-fallback timeout — the promise resolved
-		// before the timeout would have swapped to @pending, so the prior DOM
-		// stays put and the just-resolved render commits over it directly.
-		if (state.transitionTimeoutId !== null) {
-			clearTimeout(state.transitionTimeoutId);
-			state.transitionTimeoutId = null;
+		// Only clear tracking state when the current thenable resolves. A stale
+		// settle on a held boundary must not disarm the fresher thenable's timeout.
+		if (isCurrent) {
+			state.pendingThenable = null;
+			if (state.transitionTimeoutId !== null) {
+				clearTimeout(state.transitionTimeoutId);
+				state.transitionTimeoutId = null;
+			}
 		}
 		const persistent = state.tryBlock;
 		if (persistent !== null && !persistent.disposed) {

diff --git a/packages/octane/src/runtime/transitions.ts b/packages/octane/src/runtime/transitions.ts
--- a/packages/octane/src/runtime/transitions.ts
+++ b/packages/octane/src/runtime/transitions.ts
@@ -458,7 +458,6 @@
  * parallel transitions. Runs when a boundary stages, on a handful of boundaries.
  */
 export function stagedRevealGroup(): TrySlot[] | null {
-	let ready: TrySlot[] | null = null;
 	const seen = new Set<TrySlot>();
 	for (const start of STAGED_REVEALS) {
 		if (seen.has(start)) continue;
@@ -480,9 +479,9 @@
 			}
 		}
 		for (const member of group) seen.add(member);
-		if (group.every((member) => STAGED_REVEALS.has(member))) (ready ??= []).push(...group);
+		if (group.every((member) => STAGED_REVEALS.has(member))) return group;
 	}
-	return ready;
+	return null;
 }
 
 // ─────────────────────────────────────────────────────────────────────────────

You can send follow-ups to the cloud agent here.

…eals

Two more review findings on the reveal-group loop:

- stagedRevealGroup added the members of a group still waiting to the
  caller's set, so a group that flushing another made ready was skipped
  for the rest of the loop. Only flushed groups are skipped now; a
  waiting group is scanned again on the next pass.
- A deferred reveal whose members another flush already revealed still
  committed effects, since every() is true for an empty list. It now
  returns without committing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit 2af686e into next Oct 20, 2026
35 checks passed
@trueadm
trueadm deleted the test/parallel-transitions branch October 20, 2026 17:37
trueadm added a commit that referenced this pull request Oct 23, 2026
* fix(runtime): scope optimistic cleanup to transition batches

* fix(runtime): keep optimistic reverts out of cross-render diagnosis

A transition batch can finish while a Suspense boundary renders: an urgent
update that supersedes a held transition releases the hold inside the
boundary's render (releaseHeldTransition -> releaseTransitionHookHolder ->
finishTransitionHookBatch). The batch-scoped useOptimistic revert then
scheduled its block while another component was on the stack, so dev logged
"Cannot update a component while rendering a different component" and the
block was flagged as a cross-render update. The global listener this
replaced ran under the publish-depth guard; schedule the revert under it
again via scheduleHookPublication.

Also update the TRANSITION_PENDING_COUNT comment: optimistic lifetimes no
longer subscribe to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(octane): commit unrelated transitions independently

Re-lands #2165 on main. It merged into `next` on 2026-10-20, after
#2103 had already integrated `next` into `main`, and `next` was then
deleted, so the change never reached `main`.

This is the #2165 squash commit (2af686e) without its useOptimistic
fix: #2218 scopes optimistic reverts to their transition batch, so this
change builds on it rather than adding a second mechanism.

React 19.3 renders each transition lane on its own, so a suspended
transition no longer holds back an unrelated one:

- The reveal barrier groups held boundaries that hold a common batch
  (stagedRevealGroup), so one transition's boundaries still reveal
  together while unrelated groups commit on their own, each once per
  flush.
- A held boundary still on screen retries its batches when any thenable
  it suspended on settles, keeping the fresher thenable's resume and
  fallback timeout.

Refs #2053.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): give boundaries without a batch hold their own reveal group

stagedRevealGroup put every held boundary without a batch hold into
every group. That one rule covered three different cases: a transition
that folded no hook work (`root.render` in startTransition), a holder
released during its retry, and members of a view-transition-deferred
reveal. So unrelated groups were pulled together: a hook transition
waited behind an unrelated root.render transition, and a deferred group
could be absorbed into another flush.

Boundaries without a batch hold now form one group of their own, the
barrier before parallel transitions, and never join a batch's group.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): render a deferred value's final attempt while a root holds its first render (#2223)

* fix(octane): render a deferred value's final attempt while a root holds its first render

When a root with no Suspense boundary suspends on its first render, a
useDeferredValue mounted with an initialValue spawned its swap, but the
rollback disposed the slot and the swap was dropped. The final value
never rendered until the preview fully loaded.

The swap now renders the root again as a deferred pass in its host task.
Its suspension keeps the original attempt's wakeable live, so whichever
attempt is ready first commits, as in React 19.3 (react/react#35392).

Ports the two React 19.3.0 ReactDeferredValue-test.js sibling cases into
parallel-transitions.test.ts, and :407 and :526 into deferred-value.test.ts,
asserting committed DOM.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(octane): retry a held root's deferred attempt once per swap task

Each disposed useDeferredValue slot from a rolled-back root render called
owner.retry(true) on its own. With two such hooks, the second deferred
attempt rolled back the first and unioned only its wakeable, so the
original attempt's data no longer retried the root and the initial
values never committed. Collect held roots and retry each once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* test(octane): reveal a parked hydration boundary while an unrelated transition holds

The sibling case from #2193 expected Gate's ready reveal to wait for
Later's unrelated transition, the global barrier from before parallel
transitions. Gate's root.render transition and Later's setLater
transition are separate, so Gate now reveals once its own data lands
while Later keeps holding; the primary, listener and event assertions
run at that point.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: dannyward630 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant