Repository navigation
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
FreshCloudSessionResultgains anunreadablearm —readFreshOrcaCloudSessionnow surfaces the session store'sunreadablestatus instead of collapsing it intoreconnect-required.readRelayAuthContextthrows onunreadable— landing it on the coordinator's retryableauth_unavailablepath rather than the terminalSIGNED_OUTbranch.- Coordinator comment corrected — documents that
null-means-gone is a contractreadRelayAuthContextowes the branch, not something it verifies. - Tests — a new suite pins the throw, the
reconnect-required → nullbehavior, and theauth_unavailableclassification.
The core fix is correct and well-scoped. I traced the throw through shouldRetryRelayConnectionError (a plain Error is retryable) and relayOfflineReasonForOpenFailure (reachedRelay === undefined → 'auth_unavailable'), so the unreadable session now arms a retry instead of publishing SIGNED_OUT. Other consumers (runWithFreshOrcaCloudSession) test status !== 'found', so their behavior is unchanged as claimed.
ℹ️ Nitpicks
readFreshOrcaCloudSession's newunreadablebranch (profile-cloud-session-refresh.ts:235-237) is only exercised indirectly — the relay test mocksreadFreshOrcaCloudSession, so the propagation fromreadOrcaCloudSession'sunreadableto the new result arm has no direct unit coverage. A one-line assertion inprofile-cloud-session-refresh.test.tswould pin the load-bearing mapping.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| expect(result).toEqual({ broker: null, offlineReason: 'auth_unavailable' }) | ||
| expect(result.broker).toBeNull() | ||
| // The wire close reason is what the phone latches on; it must not be spent here. | ||
| expect(broker.closeNow).not.toHaveBeenCalledWith(RELAY_HOST_CLOSE_REASON.SIGNED_OUT) |
There was a problem hiding this comment.
This assertion is vacuous: readContext throws before openBroker runs, so broker is never opened and closeNow is never invoked regardless of whether the fix is present. The comment "must not be spent here" describes a scenario (an existing paired broker) this test doesn't construct. The offlineReason: 'auth_unavailable' assertion is what actually pins the regression — and that classification is already covered by relay-auth-coordinator-offline-reason.test.ts:72. If the goal is to prove SIGNED_OUT is never spent on a live broker, establish a registered broker first, then reconcile with readFreshOrcaCloudSession returning unreadable and assert closeNow wasn't called with SIGNED_OUT.
9ce1902 to
13eee7e
Compare
The coordinator's own comment states the contract: readContext "throws on transient failures and returns null solely when the cloud session is gone (absent, or cleared by a 401)". The implementation did not honour it. readFreshOrcaCloudSession collapsed readOrcaCloudSession's `unreadable` status into `reconnect-required`, so readRelayAuthContext returned null and the coordinator published RELAY_HOST_CLOSE_REASON.SIGNED_OUT, closed the broker with that wire reason, and armed no retry because a terminal cause arms none. `unreadable` fires on EPERM/EACCES/EBUSY/EMFILE/ENFILE/EIO — descriptor exhaustion on a busy machine, a Windows AV file lock. The phone latches setHostSignedOut and shows "Desktop signed out — sign in to Orca on your desktop to reconnect" for a failure the next read would have cleared. The contrast is the argument: `unreadable` is the one status the session store's own doc says "licenses nothing", and clearCloudSessionIfUnchanged already refuses to delete a session because of it — "a session we were denied is not a session we may delete". The relay taxonomy was the single place treating it as evidence the user signed out. Give it its own arm on FreshCloudSessionResult and throw for it in readRelayAuthContext, which lands it on the retryable auth_unavailable path the coordinator already has. Every other caller tests `status !== 'found'`, so their behaviour is unchanged. Correct the coordinator comment to say what it actually depends on: null-means-gone is a contract readRelayAuthContext owes it, not something that branch can verify. Measured before the fix: offlineReason "signed-out", mint code relay_signed_out. After: auth_unavailable. Not fixed here, and worth a separate look: `decrypt-failed` when safeStorage.isEncryptionAvailable() is false (a Linux keyring still locked at login) takes the same route to SIGNED_OUT, but reclassifying it changes sign-in semantics well beyond the relay.
aff7b40 to
0dc273f
Compare
Clean auto-merge; the result differs from the base only in this branch's files.
Four of the eleven findings were removable rather than suppressible: annotate the variable instead of asserting the literal. The rest carry a line-specific SAFETY rationale on the line that opens the cast expression, which is where the diagnostic points -- not the `} as Foo` that closes it. Measured: gate exit 0, tc exit 0, relay 32 files / 251 tests passed.
|
Closing as superseded by #22122, which explicitly replaces this PR and carries its unreadable-session fix forward. I compared the complete four-file patch here with replacement head #22122 is still open, so this is consolidation onto the replacement, not a claim that the fix has merged. The decrypt-failed case remains outside this PR’s scope. |

What breaks
The coordinator's own comment states the contract:
readContext"throws on transient failures and returns null solely when the cloud session is gone (absent, or cleared by a 401)". The implementation did not honour it.readFreshOrcaCloudSessioncollapsedreadOrcaCloudSession'sunreadablestatus intoreconnect-required. SoreadRelayAuthContextreturnednull, and the coordinator publishedRELAY_HOST_CLOSE_REASON.SIGNED_OUT, closed the broker with that wire reason, and armed no retry — because a terminal cause arms none.unreadablefires onEPERM/EACCES/EBUSY/EMFILE/ENFILE/EIO— descriptor exhaustion on a busy machine, a Windows AV file lock. The phone latchessetHostSignedOutand shows "Desktop signed out — sign in to Orca on your desktop to reconnect" for a failure the next read would have cleared.Why
unreadablein particularIt is the one status the session store's own doc says "licenses nothing", and
clearCloudSessionIfUnchangedalready refuses to delete a session because of it — "a session we were denied is not a session we may delete." The relay taxonomy was the single place treating it as evidence the user signed out.The fix
Give it its own arm on
FreshCloudSessionResultand throw for it inreadRelayAuthContext, which lands it on the retryableauth_unavailablepath the coordinator already has.Every other caller tests
status !== 'found', so their behaviour is unchanged.The coordinator comment is corrected to say what it actually depends on: null-means-gone is a contract
readRelayAuthContextowes it, not something that branch can verify.Measured before:
offlineReason: "signed-out", mint coderelay_signed_out. After:auth_unavailable.Not fixed here, deliberately
decrypt-failedwhensafeStorage.isEncryptionAvailable()is false — a Linux keyring still locked at login — takes the same route toSIGNED_OUT. Reclassifying it changes sign-in semantics well beyond the relay and needs its own change.Why this has its own PR
It is the sibling of the fix in #19963 (
fix(relay): stop a mid-read profile switch reporting as a sign-out) — the same taxonomy error in the othernullexit of the same function. #19963's commit cites this one by SHA and its code comment reads "same argument as the unreadable session above", which only resolves once this lands. #19963 is stacked directly on this branch for that reason.Until now this commit lived only on the un-PR'd integration branch
nwparker/relay-taxonomy-fixes, so a reviewer merging #19963 would have silently missed it.Verification
tsc --noEmit -p config/tsconfig.node.jsonclean ·src/main/runtime/relay+src/main/startup— 76 files / 661 tests passed, 2 files / 8 tests skipped, 0 failures ·oxlintclean.Rebase record (2026-09-11)
Stack preserved: base stays
fix/18211-lan-mode-applies-to-paired-devices(#19870), which was rebased ontomainat5fa62feda7c264c6eda99ba4788ffebab9aae26cfirst. This branch was replayed withgit rebase --onto 13eee7eacf8a6fcd4bb77ff680d18f727fca1171 9ce190247edbdb508b452e8c62a63c4c2cdd0089.aff7b40fff5112e9806a0a7f9c297f01cef779360dc273fd9090210d41ea50af66c7edfdca32a57c13eee7eacf8a6fcd4bb77ff680d18f727fca1171No conflicts. The PR is still the single top commit above its base.