fix(browser): auto-discover Desktop bridge on ephemeral ports - #98
Open
zzalancelot wants to merge 4 commits into
Open
zzalancelot wants to merge 4 commits into
zzalancelot wants to merge 4 commits into
Conversation
Follow DSH Desktop random ports when settings.bridgeUrl is empty via cached auto URL, known CLI ports, loopback tabs, and a bounded ephemeral scan, and rediscover after repeated probe failures without overriding manual addresses.
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.
Summary
Fixes #93 — users on DSH Desktop stay stuck on “Reconnecting…” because Desktop binds a random ephemeral port (
--port 0), while the extension only probed a fixed port list and never rediscovered after the first resolve.settings.bridgeUrlis empty: auto-cache → known CLI/Desktop ports → open loopback tabs → bounded ephemeral-port scan (49152–65535).BridgeClientrediscovers after 3 consecutive probe failures so Desktop restarts are followed without user action; a manualbridgeUrlalways wins and is never overwritten.dshBridgeAuto(separate from settings); debounce rediscovery on loopback navigations.close(4000)→stoppedis unchanged.Test plan
connected; SW log shows resolvedws://127.0.0.1:<port>/ext/bridge.dsh webon 3080 → still connects immediately (no ephemeral scan).pnpm --filter dsh-browser-extension run test|typecheck|buildclose(4000)) still leaves this clientstopped.