Repository navigation
Conversation
…ason The phone close reason from #30607 now rides the close frame of the 4404 a cell sends when the desktop's data leg misses the attach deadline, so OTA phones can redial the same cell once instead of waiting out the host-offline delay. The failed relay-hello frame is unchanged, and old phones ignore the reason.
8 tasks done
Contributor
Author
|
Included in #30666 (merged). |
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.
ELI5
Sometimes a phone reaches the right relay cell and the desktop is connected there, but the desktop's data link for this phone never arrives in time. Today the phone hears "host offline" and waits 5 to 15 seconds before trying again. Phones on the latest app update (#30607) already know a more specific reason, "attach-timeout", and redial the same cell once after about a second. This PR makes the cell actually send that reason.
What Changed
HostSessionRegistry.acceptClientUnfenced, the phone socket is closed with code 4404 and reasonattach-timeout(RELAY_PHONE_CLOSE_REASON.HOST_ATTACH_TIMEOUT, added to the contract in fix(mobile): faster relay recovery after an app switch and on a late desktop data link #30607) instead of the genericrelay connection rejected.rejectClient's reason parameter is widened to accept a phone close reason.RELAY_HOST_CLOSE_REASON(the set the desktop mirrors for its own control socket) is not touched.RelayPhoneCloseReasontype.relay-helloframe is byte-for-byte the same: shipped phones parse it with a strict schema and would reject an extra field.Every other 4404 (the host is genuinely absent) keeps its existing reason.
Why
The phone cannot tell the two 4404s apart today, so it treats a transient desktop data-dial failure like a desktop that has gone away. Putting the reason on the close frame reaches only phones that read it (old phones read close reasons only to look up known ones, and ignore this one), so it is safe to send from every cell. Deliberately not behind the step-6 switch: Jinwoo approved this for the next cell image on all cells ("also in J"), and old phones ignore an unknown close reason (verified in the #30607 review). The "switch off = today's behaviour" rule covers the phone path, not this all-cell change.
Linked Issue
N/A (step 6 of the relay redesign, internal; phone half merged in #30607)
Visual Proof
N/A: relay close reason, no UI.
Testing
host-session-client-accept.test.ts: an attach deadline closes with 4404 +attach-timeout, and the relay-hello frame is exactly{ type: 'relay-hello', ok: false, code: 4404 }.--maxWorkers=2: 1221 passed; relay-contract tests 41 passed. Relay typecheck clean. Postgres-backed tests not run locally (no test database).Review
Stacked on #30656 (logs and metrics), which records the same deadline.
Agent skill upstream boundary
Notes
Mobile compatibility: old phones throw on the failed hello before the close arrives and ignore unknown reasons; OTA phones from #30607 redial once.
Checklist
N/Afor visual proof with reason