Skip to content

test: wait for the file editor to take the save's answer before reloading - #6859

Merged
leaf-agent merged 1 commit into
mainfrom
fix/file-retry-reload-race
Nov 23, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/file-retry-reload-race

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_a_retry_after_a_save_with_no_answer_keeps_the_typing_after_it[on] reloaded the page as soon as Playwright saw the retried save's 200. The editor treats the save as in flight until its own await takes that answer, so a reload in that gap correctly asked before leaving, and the test read ['beforeunload'] == []. This is the prompt #6787 added for a save the editor has no answer for, so the product is right and the test needed the fix. Before it reloads, the test now waits until the editor clears its record of the file's unsettled work in this tab (tabStore key file:notes-file:notes). That record is null exactly when the editor's beforeUnload finds nothing unsettled.

Evidence

  • The failure is in ci run 45123246324 on main at 39ee727dd: assert ['beforeunload'] == [], plus the teardown error that follows, because the test ended before consuming its expected ERR_FAILED and 409.
  • leaf-dev suite flake --copies 12 on main failed 1 of 12 copies with the same assertion.
  • To force the order, a temporary probe delayed the page's handling of each fetch answer by 500 ms. With it, the old test fails every run with CI's message and teardown error, and the new test passes both cases.
  • Unforced, the new test passed 48 of 48 copies under --cpu-throttle 6. tests/model/test_suite_source.py passes.

Refs #6858 — automated triage

…ding

`test_a_retry_after_a_save_with_no_answer_keeps_the_typing_after_it[on]` reloaded as soon as Playwright saw the retried save's 200. The editor marks the save as settled only once its own `await` takes that answer, so a reload in between still found the save in flight, and the page asked before leaving. That prompt is the behavior #6787 intends for a save without an answer, so the test is what was wrong. It now waits until the editor clears its record of the file's unsettled work in this tab, the record that decides whether leaving asks, before it reloads.

Refs #6858
@leaf-agent
leaf-agent merged commit e5b23b8 into main Nov 23, 2026
7 of 8 checks passed
@leaf-agent
leaf-agent deleted the fix/file-retry-reload-race branch November 23, 2026 08:43
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Merged at 396f782 with test red. Its only failure, tests/model/test_interact_layer.py::test_every_skill_file_reads_in_one_command, comes from main, not from this PR: at the merge base fe783d778 (main), skills/leaf/references/module-input.md is 30,002 characters, over the test's 30,000-character limit. #6816 pushed it over, and #6826 brings it back under. This PR only edits tests/browser/test_render_files.py. Both params of the test it fixes, test_a_retry_after_a_save_with_no_answer_keeps_the_typing_after_it[on] and [back], passed in that run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant