Say you edit a file while an earlier autosave is still in flight, then close the editor. If the save of your newest edit then fails once, it was never retried, so the file on disk kept the older version until you reopened it. The save coordinator now keeps its close-time retry until a write of the newest draft finishes, and clears it whenever a save pass settles, so the newest draft is retried once and a later ordinary autosave never gets an extra retry.
Related: #33998
Reproduction on main#
Commit cc19795ea7 (main). The file on disk contains only the first edit. The latest draft is left pending until the editor is opened again. Expected: The close-time save retries the newest draft, and the file on disk contains the second edit.
- Open a text file in the workspace editor.
- Make an edit on a connection where the first save is slow.
- Make a second edit while the first save is pending.
- Close the last editor for the file.
- Let the first write succeed.
- Let the write for the second edit fail once.
- Read the file from disk without reopening it in T3 Code.
The cause is at apps/web/src/components/files/fileSaveCoordinator.ts:91. Ran pnpm scenarios:prove scripts/scenarios/closing-editor-retries-latest-autosave.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean checkout, with expect.poll(...).toBe(...) timed out after 15000 ms in the output.
Evidence#
Environment: The web app in Chromium on Linux x64, a fresh checkout.
Proven: the repro fails at the test commit e0a9e0b066 and passes on the head c067f287b6, both on main 450925de8a.
| Before | After |
|---|
| Commit | e0a9e0b066 | c067f287b6 |
| Result | ASSERTION_FAILED: expect.poll(...).toBe(...) timed out after 15000 ms | passed |
| saved notes in working tree diff |  The file on disk contains only the first edit. The latest draft is left pending until the editor is opened again. |  The close-time save retries the newest draft, and the file on disk contains the second edit. |
| failure |  | |
| Recording | Before: recording | After: recording |
Tests#
- e0a9e0b066 adds the failing test, alone, before the fix.
pnpm exec vp run check:changed 450925de8a674dec21afdf94b9e661ca116b7932 passed on head.
Not in this change#
- A newest-draft write that fails twice after close still stays pending until the file is reopened (one retry, as before).
- The scenario's diff capture waits for any added line rather than one scoped to the notes.txt patch; notes.txt is the only changed file in that project.
Who did the work#
- Repro written by GPT 6.2 Sol, in Codex
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
- Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5
Evidence#
Scenario: Closing an editor retries the newest draft if its first write fails#
Proven: the scenario fails on base
9a08ffb840and passes on headee03aecd21.9a08ffb840ee03aecd21First draftand the assertion timed outFinal draftwithout reopening the editorDriver: closing-editor-retries-latest-autosave.e2e.ts