Repository navigation
fix(member): mountEdge recovers a page its ServiceWorker does not control (hard reload hang) - #5
Merged
Merged
Conversation
…Firefox
scripts/edge-reload.mjs (pnpm run test:reload) drives a tiny page that mounts a
dispatch on the edge through first visit, normal reload, hard reload, a second
tab and a hard reload with the reload guard spent. A hard reload is CDP
Page.reload({ignoreCache}) in Chromium and location.reload(true) in Firefox;
Playwright's keyboard cannot press the browser's own Ctrl+Shift+R.
Against the current mountEdge the hard reload hangs at "mounting" in both
browsers -- the llm-chat mesh.html bug.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…trol
A hard reload loads the page bypassing its ServiceWorker while the worker is
already active and claimed its clients long ago, so no controllerchange ever
fires and SwHttpAdapter.start() waited forever: llm-chat's mesh.html stuck at
"Joining... (mounting-edge)".
Before starting the adapter, mountEdge now reloads such a page once (an ordinary
reload comes back controlled in Chromium and Firefox; the stock worker offers no
way to be asked for another claim), guarded by a timestamped sessionStorage flag
so it cannot loop, and throws UncontrolledPageError ("close the tab and reopen
it") when the guard is spent or unusable. The whole wait is bounded
(controlTimeoutMs, default 30 s) so an unforeseen case fails loudly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
llm-chat's
mesh.htmlhangs forever at "Joining… (mounting-edge)" after a hard reload (Ctrl+Shift+R). A hard reload loads the page bypassing its ServiceWorker; the worker is already active and ranclients.claim()long ago, so nocontrollerchangeever fires, andSwHttpAdapter.start()(webrun-http-browser) waits fornavigator.serviceWorker.controllerwith no timeout.Fix (page side, works with the published webrun-http-browser 0.4.2)
mountEdgenow callsensureControlled(packages/httpeers-member/src/edge-control.ts) before starting the adapter:sessionStorageflag so it cannot loop;sessionStorageunusable → throwUncontrolledPageError("…close the tab and reopen it"), which the join widget shows as "Could not join".The adapter's wait is also bounded (
controlTimeoutMs, default 30 s), so an unforeseen case fails with a message instead of hanging.Why a reload and not a claim: I measured that
clients.claim()from the worker does take over a hard-reloaded page in Chromium, but the stocksw-workeronly claims onactivateand gives a page no way to ask again (a byte-identicalregister()/update()installs nothing). An ordinary reload comes back controlled in both Chromium and Firefox.Tests
tests/edge-control.test.ts: 15 unit tests for the decision, including "a sequence of loads can never reload twice in a row" and storage that is missing or throws.packages/httpeers-browser-conformance/scripts/edge-reload.mjs(pnpm run test:reload): real Chromium and Firefox. First visit, normal reload, hard reload, a second tab, a spent guard (must show the error), then a normal reload. The hard reload is CDPPage.reload({ignoreCache:true})in Chromium andlocation.reload(true)in Firefox; Playwright's keyboard can't press the browser's own Ctrl+Shift+R. Before the fix: 6 FAIL (hard reload stays at "mounting" in both browsers). After: all pass.Connected (direct). The pre-fix bundle, which is the one currently live, stays atJoining… (mounting-edge)after the hard reload in both browsers.test:browsersuite.🤖 Generated with Claude Code