Repository navigation
Discard pauses autosave of the file in every workspace; read-only Markdown/CSV tabs can't overwrite unsaved edits (phase 1b-3) - #31413
Merged
Conversation
…ead-only markdown/CSV never pushes over edits (phase 1b-3) - A Source Control discard holds autosave (and waits for in-flight saves) for every tab of that file in every workspace, keyed by its model save key, until the discard finishes or fails; the quiesce now returns the release, called in a finally. Watcher notices don't release it. A 120 s backstop only shows the changed-on-disk banner on dirty tabs and never reopens autosave. This closes the race where the compare fallback on older hosts reads disk just before git restores it. - A read-only tab renders raw Monaco source whatever its type, so it counts as a code view: a clean read-only .md/.csv tab can no longer push disk text over a writable tab's unsaved edits. Only removes or delays writes. One autosave timer per model moves to 1b-4. Co-Authored-By: Claude <[email protected]>
…ed diffs, re-show an overdue banner (phase 1b-3) - A quiesce that throws (e.g. an unresolved CSV cell) releases its hold and rejects, so the discard reports the error instead of hanging with autosave off; a bulk discard frees the holds the other paths took. - Holds key on the physical file (host + path), so an unstaged diff tab of the file in another workspace is paused and drained too; save-queue keys are unchanged. - Past the backstop, a dirty held tab whose banner was dismissed gets it back, so the pause is never silent. Taking a hold no longer re-syncs; the save-time check already refuses. Co-Authored-By: Claude <[email protected]>
…not the client's URI rules (phase 1b-3) The hold key went through the Monaco model URI, which normalizes paths by the client platform, so on a Windows client `/repo/a\b.ts` and `/repo/a/b.ts` on a POSIX host shared a key. It now uses the owner key plus `editorBufferOwnerPathKey` (new, in editor-buffer-identity), which applies the 1b-1 rules: POSIX backslashes kept, separators folded only for proven-Windows paths, UNC server case, and WSL aliases on the local Windows client. Same on the tab and the discard-path side. Co-Authored-By: Claude <[email protected]>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 21, 2026
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.
ELI5
Two ways an editor could write the wrong text into a file are closed. (1) Discarding a file's changes in Source Control now stops autosave of that file in every workspace until git has finished, so another workspace's tab can't save its old edits back over the restored file. (2) A read-only Markdown or CSV tab can no longer push the file's disk text over a writable tab's unsaved edits on the same file.
What Changed
finallywhen git finishes or fails. If quiescing fails (e.g. an unresolved CSV cell), the pause is released and the discard reports the error. A 120 s backstop only shows the existing changed-on-disk banner on dirty tabs; it never resumes autosave while git might still be running. Manual, quit and restart saves are not paused.Why
Both were real on
main(reproduced with failing tests, now regression tests). The discard race was refused by the guarded write on current hosts but could overwrite git's restore on older hosts that compare-then-write; the read-only push could lose a writable tab's edits.A broader change — one autosave timer shared by all tabs of a file — was prototyped here and dropped: until tabs share one record of unsaved text (the next step), a shared timer can save an outdated copy held by a hidden tab. Reviews found several such cases; they are kept as test scenarios for that step. This PR only removes or delays writes.
Linked Issue
Follow-up to #31313.
Visual Proof
N/A: no new UI. The only visible effect is the existing changed-on-disk banner on a dirty tab when a Discard takes longer than 120 s.
Testing
Regression tests: cross-workspace discard (with and without a tab open in the discarding workspace), slow git restore, watcher notice alone doesn't release, failed discard and failed quiesce resume autosave, discard slower than the backstop (banner, no write, banner returns if dismissed), unstaged diff tab in another workspace, POSIX backslash path vs slash path from a Windows client, read-only
.md/.csv(and a.jsonlcontrol).Editor, store, hooks, runtime and right-sidebar suites pass;
pnpm tc,check:e2e-typecheck-ratchet,check:code-quality:changed,oxfmt --checkpass.Reviewed by GPT and Opus over several rounds.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
No wire or persisted-state change. A save hung in another workspace (e.g. a stuck SSH write) now delays a Discard here until it settles.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)