Repository navigation
Conversation
|
Thanks for your PR, @surya3655. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
🟡 Changes recommended
Old-connection teardown can detach the replacement renderer and break event dispatch, while pause deferrals on retired managers can block automatic pausing.
2 open issues
What changed in this PR
Addresses #69869 by retiring automatic-pause state when a Blazor Server circuit is disposed, preventing obsolete resume operations after enhanced navigation to static SSR.
Changes:
- Adds synchronous retirement notifications and clears pending automatic-pause work.
- Guards pause/resume during disposal and drains in-flight resumes before teardown.
- Extends lifecycle unit tests and enhanced-navigation browser coverage.
| File | Description |
|---|---|
src/Components/Web.JS/test/Platform/Circuits/CircuitManagerServerPause.test.ts |
Adds disposal, resume-race, and pause-UI cleanup tests. |
src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts |
Adds retirement guards, reentrant-safe disposal, and resume draining. |
src/Components/Web.JS/src/GlobalExports.ts |
Initializes the internal circuit event target. |
src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PersistentState/ServerPauseTest.razor |
Adds navigation to the static test page. |
src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor |
Allows tests to configure circuit inactivity timeout. |
src/Components/test/E2ETest/ServerExecutionTests/AutoPauseEnhancedNavigationTests.cs |
Adds browser scenarios for retirement and replacement circuits. |
src/Components/Server.AutoPause/src/js/test/AutoPauseManager.test.ts |
Tests cancellation and obsolete completion handling. |
src/Components/Server.AutoPause/src/js/test/AutoPauseInitializer.test.ts |
Tests resume retries after normal circuit-closed callbacks. |
src/Components/Server.AutoPause/src/js/AutoPauseManager.ts |
Tracks circuit retirement and invalidates obsolete pause/resume work. |
Review effort: Balanced
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head 1ab8baaaa902c9151ab0c07ab711f9dbda4ab0c4 (merge base 9ea8a84d9c7c1a63256d2256969d5a6c66103d83, base tip and guidance commit fd8f5ac70418da5a5be89f0441734c0db71b28dd).
Validated new finding
- P2 question: whether disposal should suppress a throwing custom
ReconnectionHandler.onConnectionUp()cleanup callback. The behavior and fulfilled disposal are proven by frozen source; the binding failure policy is not specified.
Existing-feedback coverage
discussion_r4548264842already covers the source-supported risk that stopping an old resumed connection can detach a replacement renderer. This is deduplication only, not endorsement or a new finding.discussion_r4548264925already covers the source-supported fact thatpauseCircuit()can run application deferrals before its disposed-state guard. This is deduplication only, not endorsement or a new finding.- Feedback posted after bundle preparation was not observable.
Guide completion
docs/CrossCuttingGuidance.md: complete for lifecycle/disposal, async races, shared state, diagnostics, configuration, compatibility, and source-level test assessment.docs/BlazorComponentsGuidance.md: complete for circuit lifetime, pause/resume, enhanced navigation, browser integration, reconnection UI, cancellation, and source-level test assessment.- Uncovered materially changed areas: none.
Unresolved candidates: none beyond the intent question published inline.
Discarded checks: frozen source disproved stale pause/resume completion mutating replacement state, resume reopening after disposal, listener leakage, and ordinary connection loss incorrectly owning pause-UI cleanup.
Test boundary: no target code, tests, CI, or browser workflows were executed. Jest and Selenium changes were assessed from source for trigger coverage and false-pass risk.
Limitations: proof is source-only and limited to tracked frozen Git bytes. Symlinks, submodules, and LFS targets are inert; security assessment was excluded by the trusted review guidance.
Generated by ASP.NET Core Pull Request Review for #70497 · copilot · gpt56 · 217.6 AIC · ⌖ 12.5 AIC · ⊞ 18.8K
Comment /review to run again
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head 85c375ba5e454bb09dd9a6b8b09652597aa3131e found one validated P2: a continuously hidden replacement circuit can remain connected after disposal invalidates an in-flight pause and suppresses its timer rearm.
Both routed guides completed: docs/CrossCuttingGuidance.md assessed cross-cutting lifecycle, compatibility, cleanup, configuration, and test concerns; docs/BlazorComponentsGuidance.md assessed Blazor lifecycle, async flow, circuit ownership, navigation, JS interop, cleanup, diagnostics, and source-level test coverage. Security assessment and execution of tests, CI, browser workflows, samples, or target code were excluded by the trusted source-only policy.
Existing feedback was assessed neutrally. Review 5872205880 already covers the unresolved question of whether exceptions from custom ReconnectionHandler.onConnectionUp() cleanup may be suppressed; the frozen source contains no binding callback/disposal failure-policy contract, so it was not republished. Inline threads 4539159080/4547394209 cover the distinct fresh-visibility-transition timer deferral, while 4548264842 and 4548264925 cover renderer detachment and late pause deferrals.
Provenance: merge base fd8f5ac70418da5a5be89f0441734c0db71b28dd; base tip and immutable reviewer guidance commit 5b17720d700658e104d9962c1898fc0e6df15b03. Proof is frozen-source-only. Material changed areas without a routed specialist guide remain uncovered beyond the cross-cutting review. Runtime behavior, test execution, CI state, browser results, live post-bundle feedback, and security were not independently validated.
Generated by ASP.NET Core Pull Request Review for #70497 · copilot · gpt56 · 266.3 AIC · ⌖ 12.5 AIC · ⊞ 18.8K
Comment /review to run again
PureWeen
left a comment
There was a problem hiding this comment.
Reviewed commit 85c375ba5e454bb09dd9a6b8b09652597aa3131e (Round 2). One teardown edge case is noted inline on CircuitManager.ts when disposal overlaps startConnection() during resume before a renderer is attached.
|
/review |
PureWeen
left a comment
There was a problem hiding this comment.
Reviewed commit 74accaa13353d998f052815d29cc183debed1628 (Round 3). Prior agent review feedback from Rounds 1 and 2 (discussion_r4548699168, the in-flight pause case in discussion_r4552604532, and discussion_r4555790862) is addressed. One remaining automatic-pause timer edge case is noted inline on src/Components/Server.AutoPause/src/js/AutoPauseManager.ts for when a circuit is disposed while hidden before HiddenDelay elapses (_pauseInFlight === false) and a replacement circuit starts while the tab stays hidden.
Informational verifier-rejected ([DISCARDED]) and unproven ([UNRESOLVED]) items
Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.
[UNRESOLVED]src/Components/Web.JS/src/Boot.Server.Common.ts:161(throwingCircuitHandler.onCircuitClosedcallback during disposal): BecausestartCircuitCore()now awaitsawait circuit.dispose(), a throwing customcircuitHandlers[].onCircuitClosedcallback (CircuitManager.ts:722-724) would reject the cached_disposePromiseand block replacement startup. Left unresolved/non-blocking becauseonCircuitClosedinvocation is unchanged from base and no base contract requires fault isolation for throwingCircuitHandlercallbacks.[UNRESOLVED]src/Components/Server.AutoPause/src/js/test/AutoPauseInitializer.test.ts:121(circuitHandlersarray in'retries a rejected resume after normal circuit-closed callbacks'):autopause.lib.module.tsdoes not populatecircuitHandlers, socircuitHandlers.forEach(...)at line 125 is a no-op unless initializer wiring changes in the future. Left unresolved/non-blocking because it acts as a negative design guard and causes no production defect.[UNRESOLVED]src/Components/test/E2ETest/ServerExecutionTests/AutoPauseEnhancedNavigationTests.cs:222(swallowed 3-secondWebDriverWaitbefore releasing gate):CircuitReplacement_RemainsInteractiveAfterOldResumeTransportCloseswaits up to 3 seconds fortransportProbe.opened > 1and catchesWebDriverTimeoutExceptionbefore releasing the gate infinally. Left unresolved/non-blocking because it pairs with an explicit test-controlled promise gate and final end-to-end interactivity assertions.[UNRESOLVED]src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts:225(unit-only coverage for!this.isDisposedOrDisposing()inconnection.onclose): SuppressingonConnectionDownwhiledispose()awaits_startPromiseor_resumingStatebefore_disposed = trueis exercised via Jest (CircuitManagerServerPause.test.ts:431-447) rather than a separate Selenium test. Left unresolved/non-blocking because no in-repo browser producer closes the transport inside that narrow pre-_disposedwindow.[DISCARDED]Routine checks disproven against frozen source:await this._connection?.stop()cannot reject (HttpConnection.stop()catches transport stop errors);Blazor._internal.circuitEventsis a single globalEventTarget(GlobalExports.ts:115) with optional-chaining fallback for version skew; and moving_resumingState.complete(...)afteronCircuitOpened/onConnectionUpfixesfail()recovery when a callback throws.
Human-directed and GitHub Copilot-generated.
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head 59cd5bddfcc4c34d2acd5e76a3c3ba369f1df49f against merge base/base tip d7870e7ec8da214eb96f96f5512aad0d89bfef11.
Two worker-proposed candidates are surfaced inline with their validated dispositions: the E2E cleanup callback mismatch remains unresolved because the required version-bound Selenium/WebDriver execution evidence is unavailable, and the replacement-startup candidate is discarded because the exact frozen source path returns the existing startup promise before reaching the changed teardown await.
Existing feedback coverage: cleanup-callback exception suppression is already discussed in thread 4548699168 with author reply 4560539415; deduplication is neutral and does not establish the failure policy. The concern remains unresolved because head-only best-effort documentation is not a binding base-tip contract.
Per-guide completion: docs/CrossCuttingGuidance.md completed its source-applicable checks with browser/test execution excluded and the cleanup failure-policy question unresolved; docs/BlazorComponentsGuidance.md completed its source-applicable lifecycle, circuit, reconnection, and changed-test checks with browser/test execution excluded. Material changed areas without a routed specialist guide remain uncovered rather than fully domain-reviewed.
Provenance: version-2 frozen bundle, trusted workflow guidance at d7870e7ec8da214eb96f96f5512aad0d89bfef11, one independent gpt-5.6-sol worker per routed guide, followed by coordinator source adjudication and a separate gpt-5.6-sol candidate verifier. No target code, tests, CI, Selenium, or browser workflow was executed; security review was excluded. Conclusions are source-only and do not constitute runtime proof. Frozen feedback cannot observe comments posted after bundle preparation.
Generated by ASP.NET Core Pull Request Review for #70497 · copilot · gpt56 · 301.9 AIC · ⌖ 11.4 AIC · ⊞ 18.8K
Comment /review to run again
|
|
||
| if (circuit && circuit.isDisposedOrDisposing()) { | ||
| // The old connection's close callback detaches the shared Server renderer interop. | ||
| await circuit.dispose(); |
There was a problem hiding this comment.
[P3][DISCARDED] Replacement startup is not blocked by this teardown await
Why discarded: For the proposed sequence, startCircuit() returns the existing circuitStarting promise at Boot.Server.Common.ts:139-140 while the first startup is pending, before execution can reach changed line 161. The base implementation likewise retained a rejected startup promise while awaiting cleanup, so the claimed old/new replacement-startup regression is not established.
Minimal repro: Start a circuit, invoke startCircuit() again while the first start remains pending, and compare merge-base with head. Both calls share the existing startup promise; no replacement start reaches this await.
What goes wrong: Nothing on this sequence; frozen source directly refutes the proposed causal path.
Fix: none
|
The local G/S/O panel completed at commit The existing cleanup-hook mismatch remains unaddressed, so R6 uses the dedicated cleanup-hook name requested in the R5 review. This comment does not resolve threads or establish API approval. Informational discarded checks and untested coveragePosted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block [DISCARDED] Additional browser-test request: One worker proposed more Selenium coverage for the races in Other discarded checks: No additional finding survived the stale-generation, listener-lifetime, resume-settlement, disposal/reentry, optional-hook compatibility, or internal-event fallback checks. The already-paused hidden-timer behavior and initial-start failure caching also exist on the base side. These are negative checks, not requested changes. Already-covered unresolved items: The current-head hosted review already records the cleanup-hook mismatch and callback-failure policy. Round 3 records the throwing Untested coverage gaps, separate from discarded checks: The arms produced no browser red/green results, individual parameterized-row results, or timing-repeatability results. Server-reply/new-circuit-ID retirement, callback-driven disposal, and renderer-unattached close ordering have mocked unit coverage rather than observed real-server/browser evidence. Continuous-hidden ordering and callback-failure behavior remain unexecuted. Whole-PR reversion also removes instrumentation used by added browser scenarios. Frozen source does not establish API-approval metadata. Validation boundary: all three arms reviewed frozen source only. No target build, tests, or browser workflow ran. Human-directed and GitHub Copilot-generated. |
|
/review |
There was a problem hiding this comment.
🔵 Needs a closer look
Browser/SignalR lifecycle race tests could not be run in the source-only environment, and the new public reconnection-handler callback still requires human API review (#70655).
No open issues 🎉
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
Source-only review of frozen head 7a2955b9cf265441869c5bcd88f542b156d7d13a.
The two routed guides completed their in-scope source checks. The sole worker-raised code candidate was directly disproven by the exact SignalR stop return path and is retained inline as a discarded disposition; there are no verified actionable findings. Frozen feedback supplied no additional supported true positive requiring publication. Formal API-review approval for the new optional ReconnectionHandler.onPausedCircuitDisposed callback was not available in the bundle and remains unresolved process metadata, not a source-proven defect.
Guides: docs/CrossCuttingGuidance.md complete; docs/BlazorComponentsGuidance.md complete. Runtime, CI, browser, and security validation were excluded by the supplied source-only boundary. Materially changed test/browser behavior and formal API-governance approval were not independently covered. Provenance: version-2 trusted bundle, merge base d7870e7ec8da214eb96f96f5512aad0d89bfef11, base tip and guidance commit fa10021db581bdb7dc44e84953842ac9ccb34009. No target code was executed.
Generated by ASP.NET Core Pull Request Review for #70497 · copilot · gpt56 · 329.2 AIC · ⌖ 8.4 AIC · ⊞ 20.1K
Comment /review to run again
|
|
||
| this._disposed = true; | ||
| this._connection?.stop(); | ||
| await this._connection?.stop(); |
There was a problem hiding this comment.
[DISCARDED] Awaiting transport shutdown can reject and skip later disposal cleanup
Why discarded: The actual call resolves through HubConnection.stop() into HttpConnection.stop(). Frozen HttpConnection.ts:217-234 catches transport.stop() failures, logs them, calls _stopConnection(), and allows the stop promise to resolve, so the proposed rejection path cannot bypass the disconnect request or onCircuitClosed callbacks.
Minimal repro: Use a connected HubConnection whose low-level transport stop() rejects, then call await circuit.dispose(). SignalR catches the transport error; disposal continues to fetch('_blazor/disconnect', ...) and the circuit-closed callbacks.
What goes wrong: Nothing on this path; awaiting the real stop overload only waits for its best-effort cleanup to settle.
Fix: none
|
Copilot's local review panel found no issues to raise at this commit. The G/S/O panel reviewed The callback naming/lifetime question is also addressed. The PR links API proposal #70655. This review does not establish API approval. Informational checks and untested coveragePosted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block Existing hidden-replacement concern: Earlier feedback already describes the already-paused, continuously hidden replacement case at Other discarded checks: No new finding remains from callback-driven disposal, resume-error propagation, optional event fallback, listener lifetime, repeated teardown, or stale completion checks. The current-head hosted review already records the discarded transport-stop rejection concern. Previously recorded unresolved items: Round 3 records the throwing Untested coverage gaps, separate from discarded checks: The arms do not establish browser red/green results, individual parameterized-row results, or timing repeatability. Continuous-hidden ordering, server-response/new-circuit-ID retirement, startup-close ordering, and callback-failure paths remain unexecuted. Reverting the whole PR also removes instrumentation used by browser scenarios. Validation boundary: all three arms and both publication checks used frozen source only. No target build, tests, or browser workflow ran. Human-directed and GitHub Copilot-generated. |
|
The fix addresses the race in #69869, but it introduces |
|
I updated the fix so it no longer introduces ReconnectionHandler.onPausedCircuitDisposed() or any other new public ReconnectionHandler API. Paused-circuit cleanup is now handled internally. It clears the outstanding default reconnection UI without calling onConnectionUp(), since disposal does not represent a successful reconnection. Custom reconnection handlers therefore keep the existing contract unchanged. I also verified the circuit replacement ordering and listener lifetime. The disposal listener is removed on both successful resume and disposal, and replacement startup waits for the previous circuit disposal. The AutoPause circuit-version checks additionally prevent stale pause/resume completions from affecting the replacement circuit. Validation passed with 336 Web.JS tests, 41 AutoPause tests, and 9 targeted Selenium cases, including handler reuse, no false custom onConnectionUp(), replacement interactivity, and overlapping old-resume teardown. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved lifecycle issues leave custom-handler pause UI displayed, prevent replacement circuits from auto-pausing while hidden, and block subsequent reconnection UI when cleanup throws.
3 open issues
Review effort: Balanced
| // The hidden timer belongs to the document and must survive circuit replacement. | ||
| this._hiddenTimerPending = this._pauseInFlight && document.visibilityState === 'hidden'; | ||
| this._activeAbortController?.abort(); | ||
| this.onActivityChanged(false); |
| try { | ||
| this.clearReconnectionProcess(); | ||
| } catch (error) { | ||
| this._logger.log(LogLevel.Error, `Failed to clean up the paused circuit UI: ${error}`); |
|
/review |
There was a problem hiding this comment.
One new P2 finding at frozen head 938a57d181e76cd04f9e21f69efc3832317e044a: local circuit retirement can make the built-in Resume button reload the document even though no resume request reached the server. The finding was independently verified from source, not reproduced in a browser.
Existing feedback — not republished: Review 5888021083 already describes the throwing close callback that blocks replacement startup and the initializer test’s empty callback loop. Reviews 5888021083, 5915103656, and 5918173218 cover the replacement E2E test’s overlap and baseline-instrumentation gaps. discussion_r4699526803 covers the missing timer rearm after retirement of an already-paused circuit while hidden; the same input did not establish a new merge-base-to-head regression. discussion_r4699526905 concerns a proposed public callback absent from both merge base and head, not a binding API requirement. Deduplication does not endorse prior feedback.
Unresolved: No binding exception-isolation policy was found for a throwing application onCircuitClosed callback. The initializer test does not establish normal-close behavior through the real producer. The replacement browser test’s selective-revert behavior and expected-reason red/green results were not established; reverting the entire PR also removes the probe’s event target.
DISCARDED
The injected hide() throw in the reconnection-handler test does not establish a shipping exception-suppression defect (discussion_r4699526860). Boot does not supply the test’s display override, and the concrete displays use DOM style/class operations or event dispatch.
Guide completion: Cross-cutting and Blazor Components source reviews complete; no materially changed area lacked a routed specialist guide. Merge base c0565677136f7882d797268d9aef8f3ea8875784; base tip and trusted guidance f94a0ab8c744cb2d4c2b54cdb6ff2b9664f2edd8.
Boundary and limitations: Source-only proof from frozen tracked files. Security assessment was excluded. No target execution, tests, builds, CI, browser workflows, or samples were run. The manager test checks the boolean and the browser test calls the API directly; neither asserts the built-in button’s document reload. Feedback posted after bundle preparation was not observable.
Generated by ASP.NET Core Pull Request Review for #70497 · copilot · gpt62 · 196.2 AIC · ⌖ 8.29 AIC · ⊞ 18.4K
Comment /review to run again
| } | ||
|
|
||
| if (this.isDisposedOrDisposing()) { | ||
| this._resumingState.complete(false); |
There was a problem hiding this comment.
P2 · verified — Retiring a circuit can make the built-in Resume button reload the page without a server rejection.
Repro (source-only): In a per-page Interactive Server app with the built-in reconnect display and a circuit-scoped service with a persistent value, enhanced-navigate to a static page. Wait for the last Server root removal to be acknowledged so the inactivity timer is armed. Before it expires, pause with valid client-carried state, click Resume, and delay the new connection’s negotiation until retirement starts. Then let negotiation succeed.
Effect: This guard resolves the attempt with false before sending ResumeCircuit. The already-running button handler treats false as server rejection and calls location.reload(), even though retirement hid the dialog. On the merge base, the same valid snapshot can be resumed without reloading the document.
Suggested fix: Invalidate the pending Resume UI action on retirement and check that invalidation before calling rejected(). Keep the reload behavior for a genuine rejection.
|
Hosted CI Human-directed and GitHub Copilot-generated. |


Description
Fixes a circuit-lifetime race reported in #69869. After enhanced navigation from an Interactive Server page to a static SSR page, hiding and showing the tab can resume a circuit that has already been disposed. Subsequent navigation to an interactive page can leave it without a working circuit and report:
Root cause
Automatic pause retained state belonging to a retired circuit. Entry-point checks alone also missed resumes already waiting for connection startup or a
ResumeCircuitreply.Disposal could stop the old connection and disconnect the old circuit ID before resume assigned a new connection or received a newly created server circuit ID. The continuation could then publish circuit-opened, connection-up, and component-reload notifications on a retired manager.
API proposal
This PR adds an optional
onPausedCircuitDisposed()callback to the publicBlazor.startreconnection-handler contract.interface ReconnectionHandler { onConnectionDown(...): void; onConnectionUp(): void; + onPausedCircuitDisposed?(): void; }The callback clears pause UI when a paused circuit is disposed, without signaling a successful reconnection. The handler remains reusable by replacement circuits.
This addition requires API review. See #70655 for the API proposal. There are no server protocol changes.
Changes
onPausedCircuitDisposed()callback to the publicBlazor.startreconnection-handler contract. It clears pause UI without signaling reconnection; the handler remains reusable. This addition requires API review. No server protocol changes.Output
Before:

After:
Fixes: #69869