Skip to content

fix: retain pending query owners for unchanged parent inputs - #1221

Merged
trueadm merged 6 commits into
octanejs:mainfrom
openai-oss-forks:codex/fix-pending-stream-query-owner
Sep 21, 2026
Merged

trueadm merged 6 commits into
octanejs:mainfrom
openai-oss-forks:codex/fix-pending-stream-query-owner

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Pending @try primaries now retain their native query owners when a parent rerenders with the same body and captured inputs. Previously those renders restarted an uncommitted primary, aborting its pending producer or starting a duplicate browser producer for an adopted server stream. Changed inputs still replace the primary, and the pending fallback continues to receive current inputs.

The input comparison stays on pending or retained-owner paths, preserving the comparison-free resolved/catch fast path. Adds a patch changeset for octane.

Fixes #1219.

Validation

  • New regression suite: vitest run packages/octane/tests/signals-pending-stream.test.ts --project=octane-signals --project=octane-signals-prod --project=octane-signals-strong — 15 passed. Covers repeated unchanged inputs, changed selection, obsolete values, rejection, removal and streamed hydration; all five development cases failed before the fix.
  • Five adjacent signals suites across development, production and Strong compilation — 15 files / 168 tests passed.
  • 18 surrounding Suspense, transition, Activity, differential and hydration suites in octane and octane-prod — 36 files / 1,042 tests passed.
  • Latest main’s streamed-query hydration regression — 2 files / 28 tests passed.
  • Latest main integration: 196 compiler/keyed-list tests, 10 dormant-render tests and 46 Effect Event conformance tests passed. All 1,505 targeted tests passed on signed head 7231bbe. Latest head 2355c3b adds only main’s three Base UI type annotations; Octane source, tests, compiler, tooling and executed artifacts are unchanged. Scoped checks and pnpm sync pass again on this head.
  • Scoped formatting and typecheck of runtime, test and fixture; changeset and release-plan checks; pnpm sync.
  • Exact issue browser reproduction with Node 26.2.0 / Chromium 151.0.7922.34 and matching Strong SSR/client builds: slow browser starts 2 → 0 for unchanged inputs and 2 → 1 for changed selection, with correct final text and zero browser/SSR/compiler diagnostics. SSR output is byte-identical. After incorporating main’s separate root namespace fix (fix: preserve streamed root signal namespaces during hydration #1222), fast browser starts are also zero in both flows.
  • Matched production work control at 128 and 1,024 pending updates removes one primary restart/remount per unchanged update; settled-update comparison and render counts stay unchanged. Matched against latest main, existing minimal Suspense fixture: raw 157,362 → 157,428, gzip-9 51,044 → 51,078, Brotli-11 44,627 → 44,707 bytes. No timing or heap claim.

Repository-wide pnpm format:check, pnpm typecheck and pnpm test were not run locally; the targeted commands above were run. The PR is ready for review; all 26 jobs in current-head CI passed on signed head 2355c3b. Cursor Bugbot completed successfully with no findings. The branch contains live main and is conflict-free; branch protection requires one approving review before merge. Final pnpm sync leaves the worktree clean.

Risk / follow-ups

Retention uses the existing shared try/pending/catch capture tuple. Changing those inputs still takes the replacement path; teardown, reset and error ownership rules remain in force.

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 core @try/@pending reveal and signal-retry teardown in the runtime; behavior change is scoped to pending primaries but affects Suspense hydration and native query streams.

Overview
Fixes pending @try boundaries so parent rerenders with the same captured body/env no longer tear down an uncommitted primary or its native query$ stream owners. The runtime now tracks supersedesInputs and only clears retry signal owners when inputs actually change; for a hidden pending primary it calls attemptHiddenReveal with 'update' instead of always using 'parent', so preserved producers are not aborted and hydration does not spawn duplicate browser loaders.

Changed inputs still take the replacement path ('parent'), and the pending fallback continues to refresh from the latest helpers/env. Adds a patch changeset and regression coverage (client + streamed SSR/hydration) for pending stream ownership across same-input updates, selection changes, errors, and removal.

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

@domgan-oai
domgan-oai marked this pull request as ready for review September 21, 2026 19:23
@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
@trueadm
trueadm merged commit db35ac1 into octanejs:main Sep 21, 2026
31 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.

Pending streamed query restarts on unchanged parent inputs

2 participants