Repository navigation
Start a reload from its page's copy of each draft, taken or still waiting - #6428
Merged
Merged
Conversation
…ting A reload asks for its document before the page it replaces goes away. Where that page then heard the server take its last draft write, it held the draft as durable and left the reload nothing, since #6399 leaves only words still waiting. The reload showed the generation it was served, older than the one the server now held, until its first look. Words typed on arrival went over that older generation, and the server's answer replaced them with the departing page's words, which the reload took for another tab's. test_held_keys_stand_beside_a_saved_draft read "H" for "Half a thought" in 2 of 13 runs of its selection at -n 3 on a loaded Mac (2026-11-18), with #6399 in. The page now leaves its durable copies too, still marked durable so the reload doesn't write them again, and a served generation older than a copy gives way to it by version, as any reading does. A store that went back as the page reloaded, as one restarting from an older copy of its page does, isn't heard by the reload: a durable copy shows words the server lost and isn't written back. Main drops those words at the reload. Taking the copies' versions as the store version the reload has heard would catch it, but a review found that suppresses reads of other drafts a copy's version says nothing about, so this change leaves it. Tests: test_words_typed_on_a_reload_stand_over_a_write_taken_as_it_was_served serves the reload a document fetched before the write lands, and fails on main ("K" for "Kept"). test_held_keys_stand_beside_a_saved_draft no longer waits for the save before it reloads (#6416's step); its selection passed 8 of 8 runs at -n 3. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 18, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The red test job (run) fails in pnpm run check at savedAt in browser/runtime/anchor-placement.js (placement() / reads(placement), undefined names). That code is on current main from #6417, which this PR doesn't touch, so it doesn't withhold approval. Locally, the new reload test fails against the base drafts.js and passes on head; the other reload tests in test_shared_drafts.py and test_held_keys_stand_beside_a_saved_draft pass on head too.
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 reload asks for its document before the page it replaces goes away. Where that page then hears the server take its last draft write, it holds the draft as durable, and #6399's handoff leaves the reload only drafts still waiting, so the reload shows the older generation it was served until its first look. Words typed on arrival go over that older generation and are replaced by the departing page's words. This is the flake in
test_held_keys_stand_beside_a_saved_draft("H" for "Half a thought", 2 of 13 runs under-n 3on a loaded Mac, with #6399 in).The page now leaves its durable copies in the tab too, still marked durable so the reload doesn't write them again; a served generation older than a copy gives way to it by version in
hearReading, as for any reading.test_words_typed_on_a_reload_stand_over_a_write_taken_as_it_was_servedserves the reload a document fetched before the write lands and fails on main. The saved-draft test drops the wait-for-save step #6416 added; its selection passed 8 of 8 runs.To weigh: a store that went back as the page reloaded (a server restarting from an older copy) isn't heard by the reload, so a durable copy shows words the server lost and isn't written back; main drops them. A Codex review found that taking the copies' versions as the reload's heard store version, which would catch that, suppresses reads of other drafts, so it's left out. Codex also confirmed a pre-existing flaw this doesn't touch: recovery after a rollback writes the tab's words over a generation another device wrote after the rollback.
pnpm run checkandpnpm run test:runtimefail on main at the moment inanchor-placement.js, from #6417; this change doesn't touch it.Found while following up the saved-draft flake from #6383.