fix(serve): honor explicit --port over persisted mobile-ws fallback (#8535) - #8602
Closed
LesleyMurfin wants to merge 1 commit into
Closed
fix(serve): honor explicit --port over persisted mobile-ws fallback (#8535)#8602LesleyMurfin wants to merge 1 commit into
LesleyMurfin wants to merge 1 commit into
Conversation
…tablyai#8535) The explicit-pin signal was erased at the wsPort = DEFAULT_WS_PORT constructor default, so a pinned --port was indistinguishable from the default and got pre-empted by the persisted mobile-ws fallback (STA-1511). Thread wsPortExplicit through index.ts -> runtime-rpc so an explicit pin skips (and never writes) the fallback. Default and E2E (wsPort 0) paths unchanged. Refs stablyai#8535.
Contributor
|
Thanks for identifying the explicit-pin vs STA-1511 fallback root cause and the integration tests. Merged #9005 instead (non-draft, Closing this draft as a duplicate for #8535. |
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
An explicitly pinned
orca serve --port <P>now deterministically binds<P>. Previously a persisted mobile-ws fallback port (STA-1511, written to<userData>/mobile-ws-fallback-port.json) was bound before the pinned port (candidatePorts = [fallback, pinned]). Once that file recorded a stale port, every laterservebound the stale port and never attempted<P>— stranding already-paired clients that dial the pinned port, and breaking any health check or SSH tunnel targeting it. There was no CLI way to force the pinned port.Screenshots
No visual change — headless
serveWebSocket transport behavior only.Testing
pnpm lintpnpm typecheckpnpm test— added#8535regression tests (2 passed, Node 24)pnpm build—build:desktoppassed (typecheck + relay + cli + electron-vite + web);build:nativenot run locally (no native code touched by this change)--portbinds the pinned port; the default/unpinned case still honors the persisted fallback. Verified load-bearing — reverting only the fallback guard flips the first test to bind the fallback (expected <pinned> to be <fallback>).AI Review Report
Root cause: the "was the port set explicitly?" signal is erased before the transport sees it.
getServeOptionsleaveswsPortundefinedwhen--portis absent, but theOrcaRuntimeRpcServerconstructor applieswsPort = DEFAULT_WS_PORT(6768) — so by the timews-transport.start()runs, an explicit--port 6768is indistinguishable from the default and the persisted fallback pre-empts it.Fix: thread a
wsPortExplicitboolean (serveOptions?.wsPort !== undefined) fromindex.tsthroughOrcaRuntimeRpcServerOptionsto the runtime. For an explicit pin the runtime does not read/pass the persisted fallback (candidatePorts = [pinned]) and does not persist a fallback on divergence. Default/unpinned behavior and thewsPort === 0E2E path are unchanged, so STA-1511 paired-device stability is preserved.Review explicitly checked:
path/shell/shortcut/Electron-accelerator surface touched. The Windows/Hyper-VEACCESfallback path and the0.0.0.0bind host inws-transport.tsare untouched; behavior is identical on all three platforms.orca serve --portis the remote-host case (operators pin the port for firewall rules and SSH tunnels). The fix makes the pin deterministic across relaunches; local and E2E paths unchanged.Security Audit
0.0.0.0exactly as before — not widened. Per-device tokens and E2EE are untouched.Notes
<userData>/mobile-ws-fallback-port.jsonbefore starting a pinnedserve.Closes #8535