Repository navigation
Keep a view-through-host guest in the room when it reconnects - #45
Merged
Merged
Conversation
The guest asks the host for pictures every 400 ms while offline, and RoomClient.open was true as soon as a new socket opened. A request could reach the relay before the handshake, the relay closed with 4400 "bad handshake", and the guest left the room with "Can't reach the room server". Nothing is sent now until welcome arrives on the socket that is open. A member closed with 4400 "handshake timed out" reconnects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A view-through-host guest whose connection dropped could leave the room on reconnecting instead of coming back. It showed the start screen and "Can't reach the room server. Check your network and try again in a minute." This was seen once on
main, in CI run 45433928289 (e2e/room.spec.ts:516, Web job). It is already in 0.1.3.Cause
guestEnterinsrc/session.ts).RoomClient.openwas true as soon as a new socket opened, beforehelloand the handshake. So that request could be the first message on the new connection.helloas the handshake.first_textgets a binary frame there, and the relay closes with 4400bad handshake.afterClosetreats 4400 as final, andcloseMessagefalls back to the "Can't reach the room server" text.routeWebSocket,helloreaches the page through a Node round trip, which widens the window. That is why it failed only now and then.Fix
RoomClientkeeps asignedInflag for the socket that is open now. It is set onwelcomeand cleared on connect, close, misfit andclose().openrequires it, sosend,requestandsendFramehold off until then. The handshake still goes out onhello.handshake timed outnow reconnects, because that is a slow network. Any other 4400, and every code that ends a membership, keeps its behaviour and its message.ROOMS-PROTOCOL.md§3 (send nothing beforewelcome, on every reconnect) and the §11 row for 4400, aDECISIONS.mdrow, and a CHANGELOG entry under Unreleased.Tests, written first and seen to fail
e2e/helpers.ts:cuttable(page).restore(ms)brings the network back slow. On new connections, what the room server says reaches the pagemslate.e2e/room.spec.ts: new test "a view-through-host guest comes back over a slow connection instead of leaving the room". On the old code it failed like CI:guest-bannernot found, with the start screen and the same toast.src/collab/client.test.ts: a fake socket drivesRoomClient. After a reconnect, nothing is sent andsendFramereturns false until the nextwelcome, andrequestwaits for it too.afterCloseretries 4400handshake timed outfor a welcomed member only.Checks (Windows 11, Edge, local)
pnpm lintandpnpm typecheck: clean.pnpm test: 1126 passed, 2 failed. The 2 failures are the timing checks insrc/collab/hardening.test.ts, which fail the same way on unchangedmainon this PC and pass when that file runs alone. They are unrelated to this change.operations.spec.ts:147,report.spec.ts:100).cargo test --workspace: all passed, none ignored. No Rust changed.GOAL.mdandLOOP.mdwere not updated: this is a bug fix outside a loop iteration.No UI or copy changed.
🤖 Generated with Claude Code