You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
id: browser reconnect resume retains its baseline; host restores viewport from the retained baseline #12648
Browser reconnect resume is degraded end to end, on v1 today and independent of the binary transport (#12242):
Browser discards its baseline but keeps the token.web/src/world.tsconnect() clears renderedSurface/renderedViewRevision while retaining the resume token (Codex P2 finding on PR feat(id): negotiate binary screen patches #12246, world.ts:648). If the host answers the reconnect with a catch-up patch, the browser has no base to apply it to and falls back to a full view — the patch round-trip is wasted.
The host does not restore the viewport on resume.joined() initializes every connection's viewport to None; neither the join frame nor the resume-token lookup restores it (Codex P2 finding on PR feat(id): negotiate binary screen patches #12246, world.ts:665). The first resumed view renders at the program's default size, so a retained baseline recorded at the browser's real viewport does not match, and views stay default-sized until the pane changes size.
Prior work
PR #12246 (superseded by the #12242 lane-T2 implementation for the transport itself) implemented both halves: the browser retains the matching screen/revision with the token and sends the token on reconnect, and the host restores the participant-bound viewport from the retained baseline before rendering the first resumed view (its head commit 3751be8). That head's regression test — reconnect at a non-default viewport, apply a catch-up patch — was never run (no CI on the head, per the PR body), so the fix needs verification, not just porting.
Scope
Browser: retain token + surface + revision as one unit across reconnects; send the token on rejoin; drop all three together when the viewport actually changes.
Host: when a join presents a resume token whose retained baseline matches, restore the session viewport from the baseline before the first send_view.
No token semantics change: a token stays a cursor, not a credential; misses still get a full view; join authorization unchanged.
Coverage: the non-default-viewport reconnect regression (from feat(id): negotiate binary screen patches #12246) run and green, plus a browser-side test that a catch-up patch applies after reconnect without an intervening resize.
Filed from lane T2's reconciliation of PR #12246 into the #12242 slice; the transport slice deliberately did not absorb this because it changes resume behavior beyond negotiation and its only test was never executed.
Lane AQ pickup (archer). Premise check against current main (a7af4b7):
Browser half — present, in stronger form. The browser has no resume-token handling at all on main: web/src/world.ts never reads resume_token from view frames (the WorldFrame type doesn't declare it), never sends one in the join frame, receiveBinary decodes it via screen-codec.ts and ignores it, and connect() clears renderedSurface/renderedViewRevision. Every reconnect is a full view today.
Host half — present.joined() in crates/id-worlds/src/world_session/mod.rs initializes viewport = None and sets pending_resume, but never restores the viewport from the retained baseline; BaselineCache has no non-consuming peek. send_view only honors the token when the screen fitted at the current viewport matches the baseline shape, so a baseline retained at a non-default viewport always misses — exactly what the existing test a_wrong_viewport_resume_token_falls_back_to_a_full_view pins.
Slice: port the two #12246 fix commits (2b9428d browser, 3751be8 host) adapted to main's post-#12242 shape (screen_msgpack negotiation, no v2 route):
Host: BaselineCache::viewport_for peek (participant-bound, non-consuming) + joined() restores the viewport from the retained baseline before the first send_view; the wrong-viewport test is replaced by the feat(id): negotiate binary screen patches #12246 regression a_resume_token_restores_the_viewport_before_catching_up, plus a unit test pinning that the peek does not consume.
Browser: retain token + surface + revision as one unit across reconnects, send the token on rejoin, adopt the token issued with each applied view, drop all three together on a real viewport change or a forced resync, and don't let a same-size resize reset the host's retained baseline on a resumable reconnect. New world-resume.test.ts carries the coverage the issue names: a catch-up patch applies after reconnect with no intervening resize, and a viewport change drops the unit.
Done — both findings discharged by PR #12704, merged as dee25f7dbf67b8ca9add2eea2b76072eeb5ebbfb (commits a5a3d39353d host, eaea23ead94 browser). This issue auto-closed via the PR's Closes #12648.
What landed (the #12246 fix pair, ported to the post-#12242 screen_msgpack shape and verified this time):
Host: BaselineCache::viewport_for — participant-bound, non-consuming peek; joined() restores the connection viewport from the retained baseline before the first send_view consumes the one-shot token. Token semantics unchanged: still a cursor, misses still get a full view, join authorization untouched.
Browser: token + surface + revision are retained as one unit across reconnects, adopted together from every applied view (JSON patch, JSON full screen, MessagePack patch), and offered in the join frame when the unit is complete. A same-size resize no longer goes out on a resumable reconnect; a real viewport change or a forced resync drops all three together. The read-only host view clears the token with the surface.
Coverage, as the issue required:
Host regression a_resume_token_restores_the_viewport_before_catching_up (reconnect at a non-default viewport → catch-up patch against the retained base) — run and green; it replaces a_wrong_viewport_resume_token_falls_back_to_a_full_view, whose premise is exactly the defect. Plus viewport_for_peeks_without_consuming for the peek's contract.
Browser web/src/world-resume.test.ts: a catch-up patch applies after reconnect with no intervening resize, and a viewport change drops the unit — run and green.
Verification (laptop, pkgs/id nix dev shell, branch head eaea23ead94):
Failing first: with tests only, the host test failed at the catch-up-patch assertion and the browser test failed on the missing join resume_token.
bun run test (full web unit) — 881 passed, 9 skipped (879 baseline + 2 new). bun run typecheck clean; biome format/lint clean on touched files; cargo fmt --check clean for touched files; no clippy warnings at touched locations.
No remainder: both scope bullets and both coverage items are in the merged PR.
Activity
developing-today commentedon Nov 22, 2026
CODE-4651
dezren39 commentedon Nov 22, 2026
Lane AQ pickup (archer). Premise check against current main (a7af4b7):
web/src/world.tsnever readsresume_tokenfrom view frames (theWorldFrametype doesn't declare it), never sends one in the join frame,receiveBinarydecodes it viascreen-codec.tsand ignores it, andconnect()clearsrenderedSurface/renderedViewRevision. Every reconnect is a full view today.joined()incrates/id-worlds/src/world_session/mod.rsinitializesviewport = Noneand setspending_resume, but never restores the viewport from the retained baseline;BaselineCachehas no non-consuming peek.send_viewonly honors the token when the screen fitted at the current viewport matches the baseline shape, so a baseline retained at a non-default viewport always misses — exactly what the existing testa_wrong_viewport_resume_token_falls_back_to_a_full_viewpins.Slice: port the two #12246 fix commits (2b9428d browser, 3751be8 host) adapted to main's post-#12242 shape (screen_msgpack negotiation, no v2 route):
BaselineCache::viewport_forpeek (participant-bound, non-consuming) +joined()restores the viewport from the retained baseline before the firstsend_view; the wrong-viewport test is replaced by the feat(id): negotiate binary screen patches #12246 regressiona_resume_token_restores_the_viewport_before_catching_up, plus a unit test pinning that the peek does not consume.world-resume.test.tscarries the coverage the issue names: a catch-up patch applies after reconnect with no intervening resize, and a viewport change drops the unit.fix(id): restore the viewport from the retained baseline on resume
fix(id): browser retains its resume unit across reconnects
Merge pull request #12704 from developing-today/archer-lane-aq/12648-…
dezren39 commentedon Nov 22, 2026
Done — both findings discharged by PR #12704, merged as
dee25f7dbf67b8ca9add2eea2b76072eeb5ebbfb(commitsa5a3d39353dhost,eaea23ead94browser). This issue auto-closed via the PR'sCloses #12648.What landed (the #12246 fix pair, ported to the post-#12242 screen_msgpack shape and verified this time):
BaselineCache::viewport_for— participant-bound, non-consuming peek;joined()restores the connection viewport from the retained baseline before the firstsend_viewconsumes the one-shot token. Token semantics unchanged: still a cursor, misses still get a full view, join authorization untouched.Coverage, as the issue required:
a_resume_token_restores_the_viewport_before_catching_up(reconnect at a non-default viewport → catch-up patch against the retained base) — run and green; it replacesa_wrong_viewport_resume_token_falls_back_to_a_full_view, whose premise is exactly the defect. Plusviewport_for_peeks_without_consumingfor the peek's contract.web/src/world-resume.test.ts: a catch-up patch applies after reconnect with no intervening resize, and a viewport change drops the unit — run and green.Verification (laptop, pkgs/id nix dev shell, branch head
eaea23ead94):resume_token.cargo test -p id-worlds --lib resume— 14 passed. Fullcargo test -p id-worlds --lib— 910 passed, 1 failed: theshell_contractjoin.device_inputdisagreement, reproduced identically on pristine main and filed as id: shell contract test fails on main — join.device_input null disagreement between contract and host #12703 (unrelated; not a remainder of this issue).bun run test(full web unit) — 881 passed, 9 skipped (879 baseline + 2 new).bun run typecheckclean; biome format/lint clean on touched files;cargo fmt --checkclean for touched files; no clippy warnings at touched locations.No remainder: both scope bullets and both coverage items are in the merged PR.