Repository navigation
fix(mobile): a scope refusal is not a missing method on the Relay pairing probes - #19952
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Shared
isPairingRelayRpcUnavailablepredicate — a newpairing-relay-rpc-unavailable.tsreplaces the two duplicated localisMethodNotFoundpredicates and accepts eithermethod_not_foundorforbidden. - Coordinator + direct-upgrade fallback rewired —
pre-profile-pairing-coordinator.tsandmobile-relay-direct-upgrade.tsroute their "too old for Relay, stay on LAN" fallback through the shared helper, so a scope-refusing desktop now commits a direct-only/LAN host instead of throwing. - Regression coverage — two new mobile cases for the
forbiddenarm, plus a desktop-side test pinning the gate mechanism (mobile-scoped →forbidden, runtime-scoped →method_not_found, allowlist covers both probes).
The fix is sound. forbidden on the two pairing probes can only originate from the mobile allowlist gate (src/main/runtime/runtime-rpc/runtime-rpc-websocket-dispatch.ts:76); handler throws map through mapRuntimeError in src/main/runtime/rpc/errors.ts to a closed passthrough set or runtime_error, never forbidden, so treating it as "this desktop will not expose Relay pairing" is safe in both directions. The tests assert exact values and, per the description, fail without either arm.
ℹ️ Third divergent copy of the "mobile method unavailable" predicate
The new isPairingRelayRpcUnavailable matches method_not_found or forbidden, but the two pre-existing sibling predicates — isMobileMethodUnavailableError (mobile/src/files/file-list-fallback.ts) and isMobileGitUnavailable (mobile/src/source-control/mobile-git-status.ts) — additionally match message.includes('not available to mobile clients'). All three detect the same gate's scope refusal, so this is a mild divergence worth reconciling at some point: either the message arm is redundant and the older helpers can be simplified, or it is load-bearing and this helper should match. Not blocking.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between b425aca9e517b8fbc0972af218d6da8af7b1a5f0 and b2da61f. 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe change adds a shared predicate for Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The compatibility fallback correctly handles older desktops without masking current Relay pairing failures. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the mechanism, failure mode, fix, rollout constraint, and verification in detail. However, it does not follow the required template and omits the required Linked Issue, Visual Proof or explicit N/A, checklist, notes, review, and agent-skill-boundary sections. Resolution Reformat the description using the repository template. Add a Linked Issue entry with
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3d66c57 to
c831443
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Rebase onto
main+ conflict resolution —mainhad since extracted the two hand-rolled helpers out of the call sites intorpc-acceptance-policies.tsasrequireRpcResultOrThrowCodedErrorandisMethodNotFoundRefusal. The rebase keptmain'srequireRpcResultOrThrowCodedErrorat every success site and kept this PR's widenedisPairingRelayRpcUnavailableat the two refusal sites, so no localrequireSuccesscopy returned. - Narrow-predicate import dropped from the call sites —
isMethodNotFoundRefusalis no longer imported bymobile-relay-direct-upgrade.tsorpre-profile-pairing-coordinator.ts; it remains in use byterminal-viewport-refit-state.ts, sorpc-acceptance-policies.tsstays fully populated.
The rebase preserved the fix intact: the refusal sites still widen on forbidden via isPairingRelayRpcUnavailable, and the safety argument holds on the new main — the allowlist gate (runtime-rpc-websocket-dispatch.ts:76) is still the sole forbidden source for the two probes, and MOBILE_RPC_METHOD_ALLOWLIST still lists pairing.getEndpoints / pairing.provisionRelay (asserted by the desktop test). The mutation check in the rebase record (dropping the forbidden arm kills exactly the two new cases) confirms the widened predicate is still wired in.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
0d2d23c to
e8304d1
Compare
There was a problem hiding this comment.
Important
The rebase reverted main's typed pairing operations at all four probe call sites, which fails the mobile raw-RPC ratchet — Mobile Checks / verify is red on this head.
Reviewed changes
Since the prior pullfrog review (c8314439), the branch was rebased onto current main (e7206f62) and one lint commit was added:
- Rebased onto
main@e7206f62— the fix commit was replayed onto a newer base. fix(lint)in the desktop test only —runtime-rpc-mobile-unknown-method-scope-refusal.test.tsnow reads the refusal code through a typederrorCodehelper instead ofascasts, satisfyingconsistent-type-assertions: never. The three cases still pinforbiddenvsmethod_not_foundand both probes' allowlist membership; test-only and sound.relayCredentialProvision/relayPairingEndpointsReaddropped at all four pairing call sites — the conflict resolution kept the pre-refactor rawclient.sendRequestcalls instead ofmain's typed operations. This is the regression and what turns the ratchet red.
The core fix — treating forbidden as "too old for Relay, stay on LAN" via isPairingRelayRpcUnavailable — is otherwise sound, and the new tests assert exact codes.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
dfd31b2 to
d3ba834
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review (5216409534, on e8304d144b), the branch was rebased/squashed onto current main (b5a99462bc) and its content changed:
- Typed pairing operations restored — the previous head's raw
client.sendRequestfallback at all four probe call sites is gone;mobile-relay-direct-upgrade.tsandpre-profile-pairing-coordinator.tssend both probes throughrelayCredentialProvision/relayPairingEndpointsReadagain. This clears the raw-port regression, andunvalidated-rpc-request-port-boundary.test.tsnow passes (verified: mobile transport suite 24/24 green). - Widened refusal predicate remains the only behavioral delta —
isPairingRelayRpcUnavailableis applied at both refusal sites, with.interpreton the success path. The concern from both open threads onmobile-relay-direct-upgrade.ts:80andpre-profile-pairing-coordinator.ts:220is fully addressed, so both were resolved this run.
Also re-verified on this head: desktop runtime-rpc-mobile-unknown-method-scope-refusal.test.ts 3/3, mobile tsc --noEmit clean, and check:code-quality:changed 0 findings. An independent mutation check (dropping the forbidden arm) fails exactly the two new mobile cases and nothing else, so the new tests have teeth.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ring probes The desktop's mobile allowlist gate runs before its RPC dispatcher, so a method an older desktop predates is absent from both and the phone is answered `forbidden`, never `method_not_found`. Keying the "too old for Relay, stay on LAN" fallback on `method_not_found` alone therefore never fired against the exact desktop it exists for: first-time pairing threw instead of committing a LAN host. `isPairingRelayRpcUnavailable` accepts both codes at the three pairing probe sites. It is pairing-scoped on purpose - `isMethodNotFoundRefusal` has four other consumers that must keep reading `forbidden` as a refusal, not as absence. The main-side test pins the claim the fallback rests on: the dispatcher really does answer `forbidden` to a mobile-scoped device and `method_not_found` to a runtime one, and this build allowlists both probes, so `forbidden` on either can only mean an older desktop.
The LAN fallback now commits a host instead of throwing, so the refusal code was the only record of why a phone ended up without a relay endpoint and nothing wrote it down. Log it on the path that swallows it. Narrow `isPairingRelayRpcUnavailable` to the two codes it matches rather than to `RpcFailure`: a plain failure guard would collapse the *false* branch to `RpcSuccess`, which a refusal carrying any other code still reaches. Rename the `'method-not-found'` sentinel in the direct-upgrade reader, which stopped describing what it covers, and correct two comments that named a `method_not_found` mechanism the desktop cannot produce for these methods: both probes have been allowlisted and registered by the same commit since Relay landed, and an unwired pairing provider answers `runtime_error`.
b425aca to
b2da61f
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review (5216956525, on d3ba834074), the branch was rebased onto current main (357c9780f8) and three adversarial-review fixes landed:
- Refusal predicate narrowed to a sound type guard —
isPairingRelayRpcUnavailablenow returnsresponse is RpcFailure & { error: { code: 'method_not_found' | 'forbidden' } }instead ofboolean. A plainRpcFailureguard would have narrowed the false branch toRpcSuccesseven though a refusal carrying any other code reaches it. - Breadcrumb on the LAN fallback — the coordinator logs
Relay: desktop will not serve relay pairingwith the refusal code before committing a direct-only host; the new mobile case asserts both the message and the code. - Comment corrections — the JSDoc no longer claims
method_not_foundmeans "Relay compiled out / provider not wired" (unreachable; an unwired provider answersruntime_error), and the direct-upgrade sentinel was renamed'method-not-found'→'relay-pairing-unavailable'to match the widened predicate.
Also verified on this head: mobile pre-profile-pairing-coordinator.test.ts + mobile-relay-direct-upgrade.test.ts 16/16 and desktop runtime-rpc-mobile-unknown-method-scope-refusal.test.ts 3/3. An independent mutation check (dropping the forbidden arm) fails exactly the two new cases (2 failed / 14 passed), then restored — the new tests have teeth.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…bsence Two comments cited this page for "a scope refusal is not a missing method" and the page did not say it — the only nearby statement says the opposite, because it describes the runtime-scoped surface, where the dispatcher does answer `method_not_found`. The allowlist gate makes the mobile surface the exception, and the harness does not run that surface, so this note is the only record.
The comments and the wire-compat note said this fixed first-time QR pairing. It cannot: the `relay` block on the pairing offer, both RPC handlers and both allowlist entries all landed in 77b154d, so a desktop old enough to refuse the probe also omits the offer block, and that flow commits a LAN host without ever probing. The site that reached is `upgradeDirectMobileRelay`, which re-probes every LAN-only host on reconnect: the refusal threw into the controller's swallowing catch, so the write-once journal it had just written — and the pending resume secret in it — was never retired. Also drop two overclaims: the phone's Files and Git fallbacks have read both codes since they shipped, so this is settled practice rather than a new rule, and the reason the allowlisted-but-unregistered case cannot ship is mobile-rpc-allowlist.test.ts, not a convention about what lands together.
057b29b to
5fd36f1
Compare
…ring probes (stablyai#19952) * fix(mobile): a scope refusal is not a missing method on the Relay pairing probes The desktop's mobile allowlist gate runs before its RPC dispatcher, so a method an older desktop predates is absent from both and the phone is answered `forbidden`, never `method_not_found`. Keying the "too old for Relay, stay on LAN" fallback on `method_not_found` alone therefore never fired against the exact desktop it exists for: first-time pairing threw instead of committing a LAN host. `isPairingRelayRpcUnavailable` accepts both codes at the three pairing probe sites. It is pairing-scoped on purpose - `isMethodNotFoundRefusal` has four other consumers that must keep reading `forbidden` as a refusal, not as absence. The main-side test pins the claim the fallback rests on: the dispatcher really does answer `forbidden` to a mobile-scoped device and `method_not_found` to a runtime one, and this build allowlists both probes, so `forbidden` on either can only mean an older desktop. * fix(mobile): leave a breadcrumb when a desktop refuses relay pairing The LAN fallback now commits a host instead of throwing, so the refusal code was the only record of why a phone ended up without a relay endpoint and nothing wrote it down. Log it on the path that swallows it. Narrow `isPairingRelayRpcUnavailable` to the two codes it matches rather than to `RpcFailure`: a plain failure guard would collapse the *false* branch to `RpcSuccess`, which a refusal carrying any other code still reaches. Rename the `'method-not-found'` sentinel in the direct-upgrade reader, which stopped describing what it covers, and correct two comments that named a `method_not_found` mechanism the desktop cannot produce for these methods: both probes have been allowlisted and registered by the same commit since Relay landed, and an unwired pairing provider answers `runtime_error`. * docs(wire): record that the mobile surface refuses by scope, not by absence Two comments cited this page for "a scope refusal is not a missing method" and the page did not say it — the only nearby statement says the opposite, because it describes the runtime-scoped surface, where the dispatcher does answer `method_not_found`. The allowlist gate makes the mobile surface the exception, and the harness does not run that surface, so this note is the only record. * docs(mobile): name the pairing site the scope refusal actually reached The comments and the wire-compat note said this fixed first-time QR pairing. It cannot: the `relay` block on the pairing offer, both RPC handlers and both allowlist entries all landed in 77b154d, so a desktop old enough to refuse the probe also omits the offer block, and that flow commits a LAN host without ever probing. The site that reached is `upgradeDirectMobileRelay`, which re-probes every LAN-only host on reconnect: the refusal threw into the controller's swallowing catch, so the write-once journal it had just written — and the pending resume secret in it — was never retired. Also drop two overclaims: the phone's Files and Git fallbacks have read both codes since they shipped, so this is settled practice rather than a new rule, and the reason the allowlisted-but-unregistered case cannot ship is mobile-rpc-allowlist.test.ts, not a convention about what lands together.

The mechanism
runtime-rpc-websocket-dispatch.ts:76runs the mobile allowlist gate before the RPC dispatcher. So for a mobile-scoped device,method_not_foundis reachable only for a method that IS allowlisted but unregistered. A method an older desktop predates is absent from both lists, so the phone is refused withforbidden, nevermethod_not_found.Both phone-side Relay pairing probes —
pairing.getEndpointsandpairing.provisionRelay— keyed their "this desktop is too old for Relay, stay on LAN" fallback onmethod_not_foundalone. That fallback could never fire against the exact desktop it exists for.What breaks today
upgradeDirectMobileRelayre-probes every LAN-only host on every reconnect (MobileRelayDirectUpgradeControllerfires on eachconnectedtransition). Against a desktop too old for Relay,pairing.getEndpointsis refusedforbidden, the absence-only predicate let it fall through tointerpret, which threw, and the controller'scatch {}swallowed it — so the upgrade journal written moments earlier, holding a 32-byte pending resume secret, was never cleared. That journal is write-once, so it was then re-read, never used and never retired, for the life of the pairing. The "too old for Relay, stay on LAN" fallback never fired against the one desktop it exists for.Which site actually reached
pre-profile-pairing-coordinator.tscannot hit this against an old desktop, and the earlier claim that it did was wrong. The offer'srelayblock, both RPC handlers, and both mobile-allowlist entries all landed in the same commit (77b154d5dd7). A desktop old enough to refuse the probe therefore also omitsoffer.relay, so the coordinator builds no journal and returns a LAN host at itsif (!journal)early exit — without ever sendingpairing.provisionRelay.That arm is still worth having, and its test still earns its place: it covers the skew that does remain reachable — a desktop that offers relay but does not allowlist the probe to a phone. That shape is not hypothetical; it is exactly what the Files and Git fallbacks below were written for.
Not a new rule — the pairing probes were the outlier
The phone already reads both codes as absence in two places, with the same mechanism written in the comment:
isMobileMethodUnavailableError—mobile/src/files/file-list-fallback.tsisMobileGitUnavailable—mobile/src/source-control/mobile-git-status.tsBoth predate this PR. The Relay pairing probes were simply the pair that never caught up. Those two take
(code, message)and also match on the gate's message text; this one takes anRpcResponseand is code-only. Collapsing all three onto one transport-level predicate is a reasonable follow-up and is deliberately not done here — it would touch three unrelated subsystems for a bug fix.The fix
One shared
isPairingRelayRpcUnavailablereplaces the two duplicated localisMethodNotFoundpredicates and accepts either code.Safe in both directions: a desktop that does serve the probes allowlists them (asserted in the new desktop test), so
forbiddenon one can only ever mean "this desktop will not expose Relay pairing to a phone" — which is exactly what the caller falls back for. Perdocs/reference/remote-wire-compatibility.md: a scope refusal is not a missing method.The desktop-side test pins the mechanism rather than restating it — a mobile-scoped device gets
forbiddenfor an unregistered method while a runtime-scoped peer getsmethod_not_foundfor the same one.Rollout constraint
The related unreadable-cloud-session fix is 100% desktop-side, and the two cases are byte-identical on the wire. A new phone paired to an old desktop still latches "Desktop signed out — sign in to Orca on your desktop to reconnect" for a transient file error (EPERM/EACCES/EBUSY/EMFILE/ENFILE/EIO) — with no retry armed on that path, cleared only by a successful connect. Desktop rollout must lead or match the phone, never lag.
A phone that predates the close-reason reading ignores it entirely and has no such failure mode, so shipping the phone ahead of the desktop creates this window rather than narrowing it.
Verification
mobile: vitest run src/transport→ 98 files, 723 passed, 3 skipped, 0 failed (log grepped forFAIL|ELIFECYCLE; exit codes are not trusted in this repo).mobile: tsc --noEmitclean; desktoppnpm tcclean.forbiddenarm → both new cases failmethod_not_foundarm → both pre-existing cases fail (confirms the old contract was not widened away)method_not_found→ the new desktop case failsWhy this is not waiting behind the SSH remote integration stack
Mobile-side, independent of everything in that stack, and it fixes a first-time pairing flow that currently throws outright. The one sibling commit from the same review depends on a module that only exists on the stack branch and stays there (
nwparker/adv2-skew-fixes).Rebase record (2026-09-11)
Rebased onto
mainat5fa62feda7c264c6eda99ba4788ffebab9aae26c.3d66c575ca2206be777b62966828639a25b28cf4c831443988c0c19f42afb87dd204acbd5b7c4deaConflict in both mobile call sites.
mainhad meanwhile extracted the two hand-rolled helpers (requireSuccess,isMethodNotFound) out ofmobile-relay-direct-upgrade.tsandpre-profile-pairing-coordinator.tsinto a sharedmobile/src/transport/rpc-acceptance-policies.tsasrequireRpcResultOrThrowCodedErrorandisMethodNotFoundRefusal. Resolved by keepingmains sharedrequireRpcResultOrThrowCodedErrorat every success site, and keeping this PR sisPairingRelayRpcUnavailableat the two refusal sites it widens — so no localrequireSuccesscopy came back.Reviewer note.
pairing-relay-rpc-unavailable.ts(added by this PR) andrpc-acceptance-policies.ts(now onmain) are two modules in the same directory holding namedRpcResponserefusal predicates. The rebase kept them separate rather than relocating this PR s module, becauserpc-acceptance-policies.tsexplicitly warns "Do not merge two policies without proving every caller of both tolerates the wider or narrower set" and the widened predicate is pairing-specific. FoldingisPairingRelayRpcUnavailableintorpc-acceptance-policies.tsas a fourth named policy is a reasonable follow-up; it was left as an author call rather than made during a rebase.Gates on the rebased head
c831443988c0c19f42afb87dd204acbd5b7c4deaVerified against the pushed head — the tested tree and
origin/nwparker/mobile-pairing-scope-refusal-fallbackare the same SHA.Desktop side
run-typecheck-projects-in-parallel.mjs) exit 0. Proven failable first: injectedconst x: number = "nope"reportedTS2322, exit 1.vitest run --config config/vitest.config.ts src/main/runtime/runtime-rpc-mobile-unknown-method-scope-refusal.test.ts— 1 file / 3 tests passed, log grepped forFAIL(0).Mobile side — previously reported as not run; now run.
mobile/is a separate pnpm workspace with its own lockfile, so it was installed in isolation inside a throwaway/tmpworktree (pnpm install --frozen-lockfile --ignore-scripts, 1380 packages all reused from the local store, 0 downloaded). A before/after fingerprint of the shared repo —node_moduleslisting hash and entry count,.modules.yaml, rootpnpm-lock.yaml, rootpackage.json, and all native.nodebinaries — was byte-identical across the install; the only delta anywhere outsidemobile/wasmobile/node_modulesappearing. No tracked file changed.tsc --noEmit(mobile) — exit 0, 0 errors. Proven failable first: injected a type error intopairing-relay-rpc-unavailable.tsand it reportedTS2322, exit 2. That run also surfaced two pre-existingTS2307errors for*.generated.tsmodules, which are products of mobile's ownpostinstallcodegen that--ignore-scriptshad skipped; both generator scripts write only undermobile/, so they were run, and the clean result above is with them present.vitest run src/transport(mobile) — 99 files / 760 passed, 3 skipped, log grepped forFAIL(0). Proven failable first: a deliberateexpect(1).toBe(2)gaveTest Files 1 failed, exit 1.Mutation-checked, because this PR's fix is exactly what the rebase conflict put at risk. The conflict resolution changed which predicate is called at both refusal sites, so a passing suite alone would not prove the widened predicate is actually wired in. Dropping the
'forbidden'arm fromisPairingRelayRpcUnavailablekills precisely the two new cases and nothing else —cleans pending state and leaves direct access unchanged for a scope-refusing old desktopandtolerates an old desktop scope refusal and commits a direct-only host— 2 failed / 14 passed. Restored, suite green again at 99/760. The fix survived the rebase intact and the tests have teeth.Rebased onto
main@caa465d1da886b2697c85c18bf36f79f2d3b9e68(2026-09-15).c831443988c0c19f42afb87dd204acbd5b7c4dea0d2d23ce3665abc0edda6474447fd41dce143958Content unchanged apart from one added commit,
fix(lint): read the refusal code without casting the reply. The casting gate is changed-lines-only and reads its rule config from the merge base, so this branch's old base skipped it entirely and its previous green did not cover these 4 sites. Verified withgit range-diff; prior CI results predate this rebase.Review round (2026-09-15) — rebased off the merge commit, plus three review fixes
Head
b425acawas a merge commit fromupdate-branch, the same mechanism that silently revertedmainon this branch once before. Replaced with a real rebase ontoorigin/main@357c9780f8bffa10a21d004449d8d6d9846a9310, so the branch is now linear and its merge base isorigin/main.b425aca9e517b8fbc0972af218d6da8af7b1a5f0(merge commit)b2da61f0bec173795d6f664ac4f5c21c41fc7390Revert audit, line by line.
git diff origin/main..HEADis 7 files / +172 / −12, and every one of the 12 removed lines is intended: the twoisMethodNotFoundRefusalimports, the three refusal call sites they fed, the three'method-not-found'sentinel occurrences, and one corrected comment.main'sRpcOperationplumbing is untouched at all four sites — no-line removes arelayCredentialProvision.request/.interpretorrelayPairingEndpointsRead.request/.interpret, andrpc-acceptance-policies.tshas a zero-byte diff, so its other consumers are unaffected by construction.Three fixes from adversarial review
response is RpcFailure, which narrows the false branch toRpcSuccess— but a refusal carrying any other code still reaches that branch. Narrowed toRpcFailure & { error: { code: 'method_not_found' | 'forbidden' } }. Proven both ways: a probe readingprovision.error.codeafter theifcompiles under the intersection and failsTS2339: Property 'error' does not exist on type 'never'under the plain guard.log('info', …, provision.error.code)on that path, asserted in the test.method_not_foundmeant "Relay compiled out, or the provider not wired". Neither is reachable:PAIRING_METHODSis spread unconditionally intoALL_RPC_METHODS, both probes were allowlisted and registered by the same commit (77b154d5dd7), and an unwired provider throwspairing_context_unavailable, which maps toruntime_error. Themethod_not_foundarm is kept — it is the pre-existing contract and it is what keeps the fallback right if the gate ever stops answering first — but the comment now says so instead of inventing a cause. The'method-not-found'sentinel in the direct-upgrade reader was renamed for the same reason.The dispatcher claim, proven by mutation
runtime-rpc-websocket-dispatch.ts:76returnsforbiddenandreturns beforedispatchStreamingis ever called, so a mobile-scoped device cannot reachmethod_not_foundfor a method the build does not register. Two mutations on the real dispatch path:method_not_foundinstead offorbidden→ the mobile case fails;method_not_found(AssertionError: expected 'method_not_found' to be 'forbidden'), which is the ordering itself, not a string.Why
forbiddencannot mean a real authorization failure hereExactly two places in
src/mainemit the RPC codeforbidden: the mobile allowlist gate, andbrowser.tab.create. The pairing handlers cannot:pairing.tsthrowspairing_context_unavailable, which is in no passthrough set and flattens toruntime_error.DeviceRegistryhas no scope mutator, so a device cannot be re-scoped mid-life into the gate. A revoked or unknown token answersunauthorized. The relay cell speaks close codes, never RPC envelopes, and the E2EE link throwsRelayOuterError. On the only path whose behaviour changes —winner.path === 'direct'— there is no relay in the middle at all. The committed LAN host keeps the samedeviceTokenandpublicKeyB64and still runs the pinned E2EE handshake; it is less capable, not less authenticated. And it is not terminal:MobileRelayDirectUpgradeControllerdoes not unsubscribe on anullupgrade, so it re-probes on every reconnect and foreground.Gates, measured on the pushed head
The mobile workspace lockfile is written in pnpm 12's flat
patchedDependenciesformat, butpnpmresolves to 10.24.0 insidemobile/(nopackageManagerfield there), and pnpm 10 reads that format as a config mismatch — that is the wholeERR_PNPM_LOCKFILE_CONFIG_MISMATCH. Invoking pnpm 12 explicitly installs--frozen-lockfilecleanly with no lockfile change.vitest run(full)vitest run src/transportunvalidated-rpc-request-port-boundaryruntime-rpc-mobile-unknown-method-scope-refusaltsc --noEmitTS2322, exit 2)pnpm tccheck:code-quality:changedoxlint,oxfmt --checkPredicate mutations, on the rebased tree: dropping the
forbiddenarm fails precisely the two new cases (2 failed / 14 passed); dropping themethod_not_foundarm fails precisely the two pre-existing cases (2 failed / 14 passed); dropping the refusal code from the new log fails only the new log assertion. No survivors.Confirming round — the doc citation was not true
The predicate comment and the desktop test both ended with "See
docs/reference/remote-wire-compatibility.md— a scope refusal is not a missing method", and that page did not say it. The only nearby statement said the opposite, because it describes the runtime-scoped surface, where the dispatcher really does answermethod_not_foundfor an unregistered method. Rather than delete the attribution, the rule is now written down where AGENTS.md sends people to look (Known hazard: on the mobile surface a scope refusal is not a missing method), including the condition under which widening toforbiddenis not safe — a probe whose handler can refuse by authorization. The cross-version harness does not run the mobile surface, so that note is the only record.Final head:
ec98c06e8b0, three commits onorigin/main@357c9780f8bf, linear.Closing round — the headline claim was wrong and is corrected
A last adversarial pass found that the story this PR told about itself did not hold. "First-time QR pairing threw instead of committing a LAN host" is unreachable: the offer's
relayblock ships in the same commit as the two RPC handlers and their allowlist entries, so a desktop that refuses the probe never offered relay in the first place and the coordinator exits before probing. The reachable damage was inupgradeDirectMobileRelay— an orphaned direct-upgrade journal, rewritten on every reconnect, against exactly the desktops the fallback was meant to cover.Two further overclaims went with it. The phone's Files and Git fallbacks have read
forbiddenas absence since they shipped, so this is settled practice in this codebase rather than a newly found rule; and the reason an allowlisted-but-unregistered method cannot ship issrc/main/runtime/mobile-rpc-allowlist.test.ts, which requires every method the phone calls to be both — not a convention about what lands together. Corrected in the two call-site comments, the predicate's doc, the wire-compat note, and this description.The code is unchanged by this round. Only the claims about it moved. Re-verified after: mobile
tsc --noEmitexit 0,vitest run src/transport108 files / 860 passed, 3 skipped,oxfmt --checkclean,check:code-quality:changed0 new findings.Final head:
5fd36f1e76d.