Skip to content

fix(hydration): keep a suspended @try arm's server content when its attempt rebuilt a mismatch - #1560

Merged
trueadm merged 10 commits into
mainfrom
fix/suspended-arm-structural-rollback
Oct 2, 2026
Merged

trueadm merged 10 commits into
mainfrom
fix/suspended-arm-structural-rollback

Conversation

@trueadm

@trueadm trueadm commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #1544, which has merged: main is merged in, so the diff is now this PR's own change.

Summary

A resolved @try arm (the server emitted oct-suspense:N) whose first hydrating attempt rebuilt a mismatched template clone and then suspended had three symptoms:

  • The mismatch was reported twice: two dev structural warnings and two onRecoverableError calls, in dev and prod.
  • The server content was blank while pending. The first attempt's adopt mismatch path removed the server node through discardCursor, and the attempt was then discarded.
  • The retry found only the range's close marker and reported again.

The same happened at every structural recovery site reached during a speculative attempt.

The contract, which matches the existing "suspended initial adoption leaves its real server arm untouched" design:

  • While a resolved arm's first attempt is suspended, its server content stays exactly as the server rendered it, including node identity, so user input in adopted nodes survives.
  • The attempt that commits rebuilds the mismatch and reports it once, the same as a hydration that never suspended.

Changes

This adds one mechanism that #1544's value repairs now share. It folds #1544's separate repairs log and heldWarnings into the single undo list and #1534's hold.

  • HydrationCapability.speculative keeps one undo list:
  • Shared helpers: collectRootRange/restoreRootRange are factored out of journalRootRange, so the root journal and the arm undo restore ranges the same way.
  • renderInitialSuspenseHydration: on success it runs class writes, then text warnings, then settle. Any failure rolls back, and releaseDiagnostics(diagnostics, failed) drops the attempt's held diagnostics. The attempt that commits, or the catch arm adopted over the restored server arm, reports instead.
  • Removed: fix(hydration): keep server values in a suspended @try arm and report once at commit #1544's heldWarnings, warnHeldHydrationMismatch, the repairs triples and the text-warning merge. Value warnings and onRecoverableError ride fix(octane): drop hydration diagnostics from try bodies caught by their catch arm #1534's module hold, which composes with fix(hydration): keep a suspended root's server values and report value mismatches once #1556's root awaitsCommit.
  • Stale islands: InitialSuspenseHydration.stale carries a dormant Hydrate island's staleServerValues to retries, which run outside the activation.
  • De-opt children: a speculative attempt removes stale de-opt children directly, so a deferred root removal cannot undo its rollback. It also records a server host before filling an empty one or inserting and moving children (Bugbot finding), with dev and prod regressions GateEmptyList and GateLongerList.
  • Tests:
    • New tests/hydration/suspended-clone-mismatch.test.ts and its fixture, compiled dev and prod. Cases: the reported repro; a clone inserted before the arm suspended, with an adopted input's identity and draft kept; and a nested arm that rebuilt and committed inside an enclosing arm that suspends. Each case compares against a non-suspending control hydration.
    • try-clone-thrower.test.ts: the @try+@pending variant of "reports a template clone that suspends" now asserts the commit-time contract, which fix(hydration): keep a suspended root's server values and report value mismatches once #1556 already gave the boundary-less variant.
  • Docs: one sentence in the Hydration section of docs/differences-from-react.md. Changeset: octane patch.

Validation

  • suspended-clone-mismatch: all cases fail on the base runtime and pass here.

  • Mutations of settle-merge, remember, fresh-node removal and the hold each turn a new or existing test red.

  • Targeted, octane + octane-prod: suspended-clone-mismatch, suspended-arm-value-mismatch, try-clone-thrower, mismatch-unadoptable-range, root-suspended-clone-mismatch, root-suspended-value-mismatch, initial-suspense-hydrate. 374/374 pass.

  • Full octane + octane-prod (--testTimeout=60000, load average ~90): 36,605 passed, 4 failed. All four were load timeouts in behavior-root, compiler/volar, compiler/typescript-text-inference, hydration-ssr-diagnostics and react-hosted/web3-island, and those files pass alone. The remaining behavior-root timeout ("attaches to existing DOM…") also times out on fix(hydration): keep server values in a suspended @try arm and report once at commit #1544's head runtime at the same load.

  • pnpm typecheck:files on the changed .ts/.tsrx files, and pnpm format:files:check on the changed files: clean.

  • Bundle bytes for the merged mechanism, measured before rebasing onto current main, vs main 5f354d23e:

    Bundle Raw Gzip
    hydrate-root +1,375 +361
    deferred-hydration +1,385 +399
    Client-only ≈0 ≈0

    The CI-gated budgets pass.

  • There is no wall-clock A/B: machine load average was 43–93. The happy path only gains a flag write and a settle call per resolved boundary.

Risk / follow-ups

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. Autofix is disabled.


Note

High Risk
Touches core hydration rollback, DOM restoration, and recoverable-error timing for Suspense arms—bugs could leave wrong markup visible or double-report mismatches.

Overview
Fixes resolved @try / Suspense arms whose first hydrating pass rebuilds a structural mismatch and then suspends: the pending UI now keeps the original server DOM (same nodes, including user input), and mismatch / onRecoverableError fire only once when the attempt that actually commits runs.

HydrationCapability replaces the separate repairs / heldWarnings path with a single undo stack for speculative attempts: save(parent) snapshots children before mismatch recovery or de-opt reconcile changes them; repaired() records value restores; rollback() replays undo newest-first on suspend/failure; settle() merges into an outer speculative pass. Shared collectRootRange / restoreRootRange align root journaling with arm rollback. De-opt child reconcile calls saveDeoptChildren and skips deferred root removals while speculative.

renderInitialSuspenseHydration rolls back recovery on failure, flushes text warnings before settle, and always releaseDiagnostics(diagnostics, failed) so discarded attempts do not publish. Docs and a patch changeset describe the React-aligned reporting contract; new suspended-clone-mismatch tests (dev/prod) cover clones, nested arms, de-opt lists, and torn arm bounds.

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

trueadm and others added 5 commits October 2, 2026 08:27
… once at commit

A resolved @Try arm (server emitted oct-suspense:N) hydrates speculatively:
when its first attempt suspends, the attempt is discarded and a later one
adopts the same server nodes. An attempt that repaired a text or attribute
value before suspending wrote the client value into the server's markup while
the arm was still pending, and queued the text warning on a capability that
the suspension dropped. The committing attempt then found the value already
matching, so the mismatch never reached onRecoverableError or the dev warning.

The arm's HydrationCapability is now speculative. Before it overwrites a
server text value, attribute, class or style, it records the server value, and
rollback() restores them when the attempt suspends or throws. Nodes cloned
fresh by structural recovery hold client template values and are skipped.
Value warnings (attribute, class, style, kept dangerouslySetInnerHTML) are held
until the attempt settles. A nested arm that commits inside an enclosing
speculative attempt hands its records and pending warnings to that attempt.

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

# Conflicts:
#	packages/octane/src/runtime.ts
… attempt

Move the speculative check and the server-value read into
HydrationCapability.repaired(), so each repair site is one call. A
non-speculative hydration no longer reads the class or style attribute at
all on the mismatch path, and hydrate-root / deferred-hydration shrink by
87 raw bytes.

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

# Conflicts:
#	docs/differences-from-react.md
#	packages/octane/src/runtime.ts
…ttempt rebuilt a mismatch

A resolved @Try arm (oct-suspense:N) whose first hydrating attempt rebuilt a
mismatched template clone and then suspended removed the server node while
the attempt was discarded, left the arm blank while pending, and reported the
structural mismatch twice (dev warning and onRecoverableError, dev and prod):
the retry found only the range's close marker and reported again.

A speculative attempt now keeps one undo list. save(parent) snapshots a
parent's children once before structural recovery changes them (the same
sites #1556 journals for roots, plus the de-opt reconcile); remember() makes
HYDRATION_REBUILT marks undoable; #1544's value repairs push restore steps
onto the same list. settle() hands the list to an enclosing speculative
attempt and rollback() replays it newest first. Any failed attempt rolls back
and drops its held diagnostics, so the attempt that commits reports each
mismatch once. #1544's heldWarnings/repairs log fold into this list and
#1534's hold. collectRootRange/restoreRootRange are shared with
journalRootRange, and a dormant island's staleServerValues now carries to
retries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 2, 2026
@trueadm
trueadm marked this pull request as ready for review October 2, 2026 11:42

@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.ts Resolved
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 36 value(s) increased
  • 🔴 bundle-reachability: 69 value(s) increased

Compares acb4e0361 with d578cf6e9 on the same runner. Timing verdicts require a change beyond the combined margin of error (at least 5%) and one 0.1ms timer tick, with the fastest sample also moving beyond that margin. Workflow run

js-framework: 1k/10k row operations (ms, lower is better)

All 20 timed operations (20 within noise)
target operation base head Δ noise
octane-tsrx run 4.03 3.99 −1.0% ±38% ⚪ within noise
octane-tsrx replace 8.97 7.89 −12.0% ±30% ⚪ within noise
octane-tsrx add 4.19 3.99 −4.8% ±45% ⚪ within noise
octane-tsrx update 0.56 0.45 −19.6% ±58% ⚪ within noise
octane-tsrx select 0.25 0.20 −20.0% ±74% ⚪ within noise
octane-tsrx swap 0.46 0.43 −6.5% ±38% ⚪ within noise
octane-tsrx remove 0.53 0.41 −22.6% ±73% ⚪ within noise
octane-tsrx runlots 35.24 34.84 −1.1% ±29% ⚪ within noise
octane-tsrx select_lots 0.28 0.30 +7.1% ±40% ⚪ within noise
octane-tsrx clear 46.47 45.86 −1.3% ±20% ⚪ within noise
octane-jsx run 4.10 4.28 +4.4% ±30% ⚪ within noise
octane-jsx replace 8.90 9.91 +11.3% ±29% ⚪ within noise
octane-jsx add 3.90 3.69 −5.4% ±36% ⚪ within noise
octane-jsx update 0.75 0.77 +2.7% ±69% ⚪ within noise
octane-jsx select 0.57 0.52 −8.8% ±52% ⚪ within noise
octane-jsx swap 0.87 0.73 −16.1% ±58% ⚪ within noise
octane-jsx remove 0.80 0.73 −8.8% ±55% ⚪ within noise
octane-jsx runlots 31.71 34.30 +8.2% ±17% ⚪ within noise
octane-jsx select_lots 2.76 2.66 −3.6% ±36% ⚪ within noise
octane-jsx clear 47.23 47.28 +0.1% ±12% ⚪ within noise

Application bundle size (bytes)

target metric base head Δ
octane-tsrx js_raw 126,052 126,446 +394 (+0.3%) 🔴
octane-tsrx js_gzip 41,685 41,844 +159 (+0.4%) 🔴
octane-tsrx js_brotli 36,731 36,825 +94 (+0.3%) 🔴
octane-tsrx fw_raw 118,540 118,934 +394 (+0.3%) 🔴
octane-tsrx fw_gzip 39,122 39,281 +159 (+0.4%) 🔴
octane-tsrx fw_brotli 34,509 34,603 +94 (+0.3%) 🔴
octane-tsrx todo_js_raw 140,401 140,796 +395 (+0.3%) 🔴
octane-tsrx todo_js_gzip 46,327 46,494 +167 (+0.4%) 🔴
octane-tsrx todo_js_brotli 40,584 40,701 +117 (+0.3%) 🔴
octane-tsrx todo_app_gzip 2,476 2,477 +1 (+0.0%) 🔴
octane-tsrx todo_app_brotli 2,118 2,121 +3 (+0.1%) 🔴
octane-tsrx todo_fw_raw 135,291 135,686 +395 (+0.3%) 🔴
octane-tsrx todo_fw_gzip 43,851 44,017 +166 (+0.4%) 🔴
octane-tsrx todo_fw_brotli 38,466 38,580 +114 (+0.3%) 🔴
octane-tsrx chat_js_raw 139,646 140,041 +395 (+0.3%) 🔴
octane-tsrx chat_js_gzip 46,280 46,431 +151 (+0.3%) 🔴
octane-tsrx chat_js_brotli 40,616 40,788 +172 (+0.4%) 🔴
octane-tsrx chat_app_gzip 2,976 2,980 +4 (+0.1%) 🔴
octane-tsrx chat_app_brotli 2,634 2,639 +5 (+0.2%) 🔴
octane-tsrx chat_fw_raw 132,993 133,388 +395 (+0.3%) 🔴
octane-tsrx chat_fw_gzip 43,304 43,451 +147 (+0.3%) 🔴
octane-tsrx chat_fw_brotli 37,982 38,149 +167 (+0.4%) 🔴
octane-tsrx weather_js_raw 175,886 176,282 +396 (+0.2%) 🔴
octane-tsrx weather_js_gzip 57,427 57,603 +176 (+0.3%) 🔴
octane-tsrx weather_js_brotli 49,941 50,091 +150 (+0.3%) 🔴
octane-tsrx weather_app_gzip 9,044 9,043 −1 (−0.0%) 🟢
octane-tsrx weather_app_brotli 7,606 7,601 −5 (−0.1%) 🟢
octane-tsrx weather_fw_raw 149,151 149,547 +396 (+0.3%) 🔴
octane-tsrx weather_fw_gzip 48,383 48,560 +177 (+0.4%) 🔴
octane-tsrx weather_fw_brotli 42,335 42,490 +155 (+0.4%) 🔴
octane-jsx js_raw 224,338 224,843 +505 (+0.2%) 🔴
octane-jsx js_gzip 71,476 71,670 +194 (+0.3%) 🔴
octane-jsx js_brotli 61,858 62,033 +175 (+0.3%) 🔴
octane-jsx app_gzip 2,943 2,944 +1 (+0.0%) 🔴
octane-jsx app_brotli 2,501 2,502 +1 (+0.0%) 🔴
octane-jsx fw_raw 215,871 216,376 +505 (+0.2%) 🔴
octane-jsx fw_gzip 68,533 68,726 +193 (+0.3%) 🔴
octane-jsx fw_brotli 59,357 59,531 +174 (+0.3%) 🔴

7 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
cli-spa-starter raw 115,861 116,134 +273 (+0.2%) 🔴
cli-spa-starter gzip 39,101 39,204 +103 (+0.3%) 🔴
cli-spa-starter brotli 34,179 34,249 +70 (+0.2%) 🔴
root-static-specialized raw 76,671 76,775 +104 (+0.1%) 🔴
root-static-specialized gzip 25,397 25,459 +62 (+0.2%) 🔴
root-static-specialized brotli 22,602 22,679 +77 (+0.3%) 🔴
root-chained-jsx raw 85,537 85,641 +104 (+0.1%) 🔴
root-chained-jsx gzip 28,324 28,399 +75 (+0.3%) 🔴
root-chained-jsx brotli 25,143 25,258 +115 (+0.5%) 🔴
root-static raw 200,661 201,166 +505 (+0.3%) 🔴
root-static gzip 63,645 63,838 +193 (+0.3%) 🔴
root-static brotli 55,276 55,334 +58 (+0.1%) 🔴
root-static-local raw 76,674 76,778 +104 (+0.1%) 🔴
root-static-local gzip 25,385 25,449 +64 (+0.3%) 🔴
root-static-local brotli 22,641 22,709 +68 (+0.3%) 🔴
hooks-state raw 88,719 88,943 +224 (+0.3%) 🔴
hooks-state gzip 29,429 29,528 +99 (+0.3%) 🔴
hooks-state brotli 26,221 26,321 +100 (+0.4%) 🔴
prop-attributes raw 96,873 97,097 +224 (+0.2%) 🔴
prop-attributes gzip 32,156 32,246 +90 (+0.3%) 🔴
prop-attributes brotli 28,523 28,624 +101 (+0.4%) 🔴
context raw 109,419 109,642 +223 (+0.2%) 🔴
context gzip 36,195 36,258 +63 (+0.2%) 🔴
context brotli 31,977 32,054 +77 (+0.2%) 🔴
hydrate-root raw 160,598 160,787 +189 (+0.1%) 🔴
hydrate-root gzip 51,436 51,554 +118 (+0.2%) 🔴
hydrate-root brotli 44,808 44,868 +60 (+0.1%) 🔴
deferred-hydration raw 222,853 223,164 +311 (+0.1%) 🔴
deferred-hydration gzip 70,885 71,004 +119 (+0.2%) 🔴
deferred-hydration brotli 61,229 61,280 +51 (+0.1%) 🔴
suspense-transition raw 165,924 166,148 +224 (+0.1%) 🔴
suspense-transition gzip 53,281 53,362 +81 (+0.2%) 🔴
suspense-transition brotli 46,495 46,558 +63 (+0.1%) 🔴
component-owned-effects raw 81,167 81,391 +224 (+0.3%) 🔴
component-owned-effects gzip 26,732 26,817 +85 (+0.3%) 🔴
component-owned-effects brotli 23,834 23,908 +74 (+0.3%) 🔴
binding-hooks raw 87,231 87,456 +225 (+0.3%) 🔴
binding-hooks gzip 29,191 29,267 +76 (+0.3%) 🔴
binding-hooks brotli 25,993 26,083 +90 (+0.3%) 🔴
binding-base-ui-vite raw 210,855 211,360 +505 (+0.2%) 🔴
binding-base-ui-vite gzip 67,201 67,383 +182 (+0.3%) 🔴
binding-base-ui-vite brotli 58,282 58,430 +148 (+0.3%) 🔴
binding-base-ui-esbuild raw 208,838 209,335 +497 (+0.2%) 🔴
binding-base-ui-esbuild gzip 67,194 67,396 +202 (+0.3%) 🔴
binding-base-ui-esbuild brotli 58,335 58,539 +204 (+0.3%) 🔴
binding-radix-vite raw 212,784 213,289 +505 (+0.2%) 🔴
binding-radix-vite gzip 67,771 67,960 +189 (+0.3%) 🔴
binding-radix-vite brotli 58,830 58,947 +117 (+0.2%) 🔴
binding-radix-esbuild raw 210,726 211,223 +497 (+0.2%) 🔴
binding-radix-esbuild gzip 67,773 67,956 +183 (+0.3%) 🔴
binding-radix-esbuild brotli 58,791 58,950 +159 (+0.3%) 🔴
binding-mantine-hooks-vite raw 97,507 97,732 +225 (+0.2%) 🔴
binding-mantine-hooks-vite gzip 32,387 32,470 +83 (+0.3%) 🔴
binding-mantine-hooks-vite brotli 28,765 28,838 +73 (+0.3%) 🔴
binding-mantine-hooks-esbuild raw 97,101 97,324 +223 (+0.2%) 🔴
binding-mantine-hooks-esbuild gzip 32,568 32,647 +79 (+0.2%) 🔴
binding-mantine-hooks-esbuild brotli 28,920 29,003 +83 (+0.3%) 🔴
binding-apollo-client-vite raw 355,904 356,409 +505 (+0.1%) 🔴
binding-apollo-client-vite gzip 111,322 111,518 +196 (+0.2%) 🔴
binding-apollo-client-vite brotli 97,188 97,342 +154 (+0.2%) 🔴
binding-apollo-client-esbuild raw 358,891 359,390 +499 (+0.1%) 🔴
binding-apollo-client-esbuild gzip 113,553 113,764 +211 (+0.2%) 🔴
binding-apollo-client-esbuild brotli 98,873 99,080 +207 (+0.2%) 🔴
binding-usehooks-ts-vite raw 98,140 98,365 +225 (+0.2%) 🔴
binding-usehooks-ts-vite gzip 32,549 32,637 +88 (+0.3%) 🔴
binding-usehooks-ts-vite brotli 28,910 28,995 +85 (+0.3%) 🔴
binding-usehooks-ts-esbuild raw 97,723 97,946 +223 (+0.2%) 🔴
binding-usehooks-ts-esbuild gzip 32,720 32,807 +87 (+0.3%) 🔴
binding-usehooks-ts-esbuild brotli 29,081 29,191 +110 (+0.4%) 🔴

36 other measured values are unchanged.

CI job durations

  • 🟡 9 job(s) slower than every recent main run: test shard (Node 24, 2/4), test shard (Node 24, 3/4), test shard (Node 24, 1/4), test shard (Node 24, 4/4), lint checks, validate publishable packages, website integration suite, example apps (3/3), example apps (1/3)
  • 🟢 2 job(s) faster than every recent main run: typecheck checks, React parity checks

Compares the CI run for 7e8e8eece (run) with the last 3 successful main push runs. A job is only slower or faster outside the whole main range, by at least 10% and 15s. Job time excludes runner setup.

job main median main range this PR Δ
wall clock (first job start to last job end) 8m 39s 7m 39s–8m 45s 13m 54s +5m 15s (+61%) ⚪ partial run
total job time 87m 11s 86m 21s–91m 45s 148m 09s +60m 58s (+70%) ⚪ partial run
test shard (Node 24, 2/4) 5m 23s 5m 21s–5m 35s 13m 20s +7m 57s (+148%) 🟡 slower
test shard (Node 24, 3/4) 5m 28s 5m 17s–5m 35s 11m 15s +5m 47s (+106%) 🟡 slower
test shard (Node 24, 1/4) 6m 09s 6m 05s–6m 09s 11m 47s +5m 38s (+92%) 🟡 slower
test shard (Node 24, 4/4) 5m 45s 4m 34s–6m 08s 11m 20s +5m 35s (+97%) 🟡 slower
lint checks 3m 17s 2m 50s–3m 26s 8m 50s +5m 33s (+169%) 🟡 slower
validate publishable packages 2m 22s 2m 21s–2m 30s 4m 31s +2m 09s (+91%) 🟡 slower
website integration suite 3m 49s 3m 44s–4m 00s 5m 55s +2m 06s (+55%) 🟡 slower
example apps (3/3) 2m 57s 2m 54s–2m 59s 3m 35s +38s (+21%) 🟡 slower
example apps (1/3) 2m 59s 2m 54s–3m 00s 3m 32s +33s (+18%) 🟡 slower
typecheck checks 4m 32s 3m 54s–4m 33s 2m 04s −2m 28s (−54%) 🟢 faster
React parity checks 2m 45s 2m 44s–2m 46s 10s −2m 35s (−94%) 🟢 faster

Not compared (skipped, failed, or not run on this pull request): Lynx compatibility (minimum), heavy integration (runtime-loaders), Three compatibility (minimum r156), Three compatibility (current), heavy integration (browser), heavy integration (eval-corpus), Lynx compatibility (current), test shard (Node 22.22.2, 1/4), heavy integration (package-builds), heavy integration (astro), test shard (Node 22.22.2, 2/4), test shard (Node 22.22.2, 3/4), test shard (Node 22.22.2, 4/4), test (22).

All 26 timed jobs
job main median main range this PR Δ
heavy integration (browser - chromium) – – 12m 06s – 🆕 new
heavy integration (package builds, eval corpus, runtime loaders, Astro) – – 5m 45s – 🆕 new
React parity shard (3/4) – – 11m 24s – 🆕 new
React parity shard (2/4) – – 10m 44s – 🆕 new
Lynx compatibility – – 1m 46s – 🆕 new
Three compatibility – – 3m 06s – 🆕 new
React parity shard (1/4) – – 11m 04s – 🆕 new
React parity shard (4/4) – – 11m 47s – 🆕 new
test shard (Node 24, 2/4) 5m 23s 5m 21s–5m 35s 13m 20s +7m 57s (+148%) 🟡 slower
test shard (Node 24, 3/4) 5m 28s 5m 17s–5m 35s 11m 15s +5m 47s (+106%) 🟡 slower
test shard (Node 24, 1/4) 6m 09s 6m 05s–6m 09s 11m 47s +5m 38s (+92%) 🟡 slower
test shard (Node 24, 4/4) 5m 45s 4m 34s–6m 08s 11m 20s +5m 35s (+97%) 🟡 slower
lint checks 3m 17s 2m 50s–3m 26s 8m 50s +5m 33s (+169%) 🟡 slower
validate publishable packages 2m 22s 2m 21s–2m 30s 4m 31s +2m 09s (+91%) 🟡 slower
website integration suite 3m 49s 3m 44s–4m 00s 5m 55s +2m 06s (+55%) 🟡 slower
example apps (3/3) 2m 57s 2m 54s–2m 59s 3m 35s +38s (+21%) 🟡 slower
example apps (1/3) 2m 59s 2m 54s–3m 00s 3m 32s +33s (+18%) 🟡 slower
example apps (2/3) 3m 16s 3m 16s–5m 23s 3m 38s +22s (+11%) ⚪ within noise
classify changeset release 9s 8s–10s 15s +6s (+67%) ⚪ within noise
typecheck 2s 2s–3s 3s +1s (+50%) ⚪ within noise
lint 2s 2s–2s 3s +1s (+50%) ⚪ within noise
test (24) 2s 1s–3s 3s +1s (+50%) ⚪ within noise
examples 3s 2s–3s 3s ±0s (±0%) ⚪ within noise
CI provenance 3s 2s–3s 3s ±0s (±0%) ⚪ within noise
typecheck checks 4m 32s 3m 54s–4m 33s 2m 04s −2m 28s (−54%) 🟢 faster
React parity checks 2m 45s 2m 44s–2m 46s 10s −2m 35s (−94%) 🟢 faster

… moved

reconcileDeoptChildren recorded a speculative snapshot of a server host only
when it removed a child. Filling an empty server host, or inserting and moving
children in its ordering pass, journaled only for the root, so a resolved @Try
arm that hit those paths and then suspended left client-built children in the
server markup while pending. Record the host before both, through a cold
helper that does nothing outside a hydrating attempt or for a fresh host.

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

trueadm commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

On the bench report: most of the hydrate-root and deferred-hydration growth (+953 raw / +310–324 gzip vs main) comes from #1544, whose commits this branch carries until it merges.

Measured with benchmarks/bundle-size/run-minimal.mjs, #1544's runtime (e9a3a8a) vs this head (4dcceb0):

Bundle Raw Gzip Brotli
hydrate-root +75 +38 −5
deferred-hydration +75 +23 +12
cli-spa-starter −12 −14 0
context −12 −22 −23
suspense-transition −12 −7 +18

The client-only and application bundles in the report move by a few bytes in either direction. The js-framework timings are all within noise.

🤖 Addressed by Claude Code

@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 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Detached arm bounds skip rollback guard
    • Added the same parentNode guard from journalRootRange to the speculative save() undo closure, so rollback skips restoreRootRange when the arm's start or end marker has been detached from parent by removeHydrationRange.

Create PR

Or push these changes by commenting:

@cursor push 9ffe9fa95f
Preview (9ffe9fa95f)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -18729,7 +18729,14 @@
 		const before = ranged ? arm.startMarker : null;
 		const after = ranged ? arm.endMarker : null;
 		const nodes = collectRootRange(parent, before, after);
-		(this.undo ??= []).push(() => restoreRootRange(parent, before, after, nodes));
+		(this.undo ??= []).push(() => {
+			if (
+				(before !== null && (STAGED_DOM?.view(before) ?? before).parentNode !== parent) ||
+				(after !== null && (STAGED_DOM?.view(after) ?? after).parentNode !== parent)
+			)
+				return;
+			restoreRootRange(parent, before, after, nodes);
+		});
 	}
 
 	/**

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

Reviewed by Cursor Bugbot for commit 85f67f3. Configure here.

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

cursor Bot commented Oct 2, 2026

Copy link
Copy Markdown

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: De-opt inserts skip speculative undo
    • Added hydration.save(el) calls before the empty-host append path and the survivor reorder path in reconcileDeoptChildren, so speculative attempts record those mutations in the arm's undo list for proper rollback on suspension.

Create PR

Or push these changes by commenting:

@cursor push 217d9c548e
Preview (217d9c548e)
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -33090,6 +33090,10 @@
 	// so just build + append each child. Skips the keyed-match Map / Set / reorder
 	// bookkeeping below, which is the hot path for large initial mounts.
 	if (firstChild === null) {
+		{
+			const hydration = activeHydration();
+			if (hydration !== null && !hydration.isFresh(el)) hydration.save(el);
+		}
 		for (let i = 0; i < next.length; i++) {
 			const node = reconcileDeoptNode(null, next[i], ownerBlock, childNs);
 			if (node !== null) {
@@ -33194,6 +33198,10 @@
 	// Advance through owned live children once. Indexed childNodes reads restart
 	// native list walks after each insertion; foreign ranges also must not make
 	// every survivor rescan the preceding siblings.
+	{
+		const hydration = activeHydration();
+		if (hydration !== null && !hydration.isFresh(el)) hydration.save(el);
+	}
 	let cursor: Node | null = getFirstChild(el);
 	for (let i = 0; i < result.length; i++) {
 		const want = result[i];

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

The speculative arm's undo called restoreRootRange without the check that
journalRootRange makes first: when either bound is no longer in the parent,
the snapshot owns no range there, and walking to a bound that is gone sweeps
the parent's later siblings and then inserts before a detached anchor. Move
the check into restoreRootRange so both callers share it. Recovery cannot
detach an arm's own bounds in balanced markup; the regression simulates an
outside mutation during the suspended attempt.

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

trueadm commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

The Bugbot Autofix branch (cursor/bc-b0d5f0d4-…, 217d9c5) is superseded: 4dcceb0 already records the host before the empty-host fill and before each move in reconcileDeoptChildren (saveDeoptChildren), with dev+prod regressions (GateEmptyList, GateLongerList). That branch is based on fd98909 and adds nothing beyond it, so it does not need merging.

🤖 Addressed by Claude Code

@trueadm
trueadm merged commit 54ff59e into main Oct 2, 2026
31 checks passed
@trueadm
trueadm deleted the fix/suspended-arm-structural-rollback branch October 2, 2026 13:10
trueadm added a commit that referenced this pull request Oct 2, 2026
…ition

#1560 rolls back a speculative Suspense attempt's structural recovery, so a
suspended attempt's rebuilt root no longer survives into the next attempt.
Take main's InitialSuspenseHydration.stale, and drop this branch's set of
client-built nodes shared across attempts, which is now unused.

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 fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant