Skip to content

fix: preserve streamed root signal namespaces during hydration - #1222

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/fix-root-streamed-signal-hydration
Sep 21, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:codex/fix-root-streamed-signal-hydration

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Root queries consumed directly inside a streamed @try now join their server result stream during hydration. Both completed-arm and pending-template adoption retain the inherited signal namespace while keeping their DOM ID prefix and counter.

Fixes #1220.

Validation

  • Dev/prod regressions for completed and announced pending queries, default/explicit prefixes, nested boundaries, adopted DOM, preserved input drafts, working events, and hydration diagnostics. Each missing namespace copy was verified against a failing regression.
  • 198 scoped dev/prod hydration tests and changed-file tsrx-tsc typechecking.
  • Scoped formatting and pnpm sync.
  • The issue's unchanged six-case Chromium reproduction: four affected baseline cases start a browser producer; all six patched cases start zero browser producers, complete one server producer, render Fast 2, and produce zero compile/browser/SSR diagnostics. All six also pass with production browser runtime branches enabled.
  • Matched deterministic Suspense benchmark: all 36 guards pass, with identical work counts, ratios, and semantic hashes.

Full local pnpm test, repo-wide formatting, and repo-wide typechecking were not run; CI covers the wider repository.

Risk / follow-ups

Two shared-reference assignments are added only when adopting streamed Suspense arm ID state. Fresh/recovery namespaces and streamed identity validation keep their existing behavior. No compiler or server source changes. Against the issue's original 37b756e78 baseline, paired reproduction SSR output is byte-identical and the development browser bundle grows by 109 raw bytes / 15 gzip bytes / 35 Brotli bytes. No hydration latency, paint, or GC performance claim is made.

Provenance

  • An agent produced this diff (agent-authored)

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


Note

Medium Risk
Touches hydration ID/signal namespace wiring for streamed Suspense arms; scope is narrow (two field copies) but incorrect matching could still cause duplicate fetches or hydration issues.

Overview
Streamed Suspense hydration now keeps the parent’s signalState when arms get a boundary-scoped DOM ID prefix, so root query$ streams can attach to server results instead of spinning up duplicate browser producers.

The runtime change is two assignments in runtime.ts when building idState for streamed boundaries; DOM prefix / next behavior is unchanged. A changeset, fixture, and hydration tests cover completed and still-pending root queries (streamed/buffered delivery, nested boundaries, optional ID prefixes), including adopted DOM, preserved inputs, and no hydration diagnostics.

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Sep 21, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review September 21, 2026 19:33
@domgan-oai
domgan-oai merged commit f209f7c into octanejs:main Sep 21, 2026
49 checks passed
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.

Streamed root suspense arm loses signal namespace during hydration

1 participant