sessions: Avoid resolving canceled Changes editor inputs - #333647
Conversation
A canceled setInput operation can outlive editor cleanup and try to resolve an already disposed SessionChangesEditorInput. Stop before model resolution and cover the race with a regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: None
What changed in this PR
Prevents canceled Sessions Changes editor operations from resolving disposed inputs.
Changes:
- Adds a cancellation check after the base input setup.
- Adds regression coverage ensuring canceled inputs do not request view models.
| File | Description |
|---|---|
sessionChangesEditor.ts |
Stops processing canceled input operations. |
sessionChangesEditorInput.test.ts |
Tests canceled-input behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Is this related? |
|
Yes—related, but complementary rather than duplicates. #333541 stops This PR covers a later, editor-pane-owned cancellation boundary: The regression test here exercises that cancellation directly and is independent of the coordinator. So #333541 prevents one producer of stale editor work, while this check makes the Changes editor correctly honor the editor framework's cancellation token for that and other producers. |
3e33b21
into
main
A canceled setInput operation can outlive editor cleanup and try to resolve an already disposed SessionChangesEditorInput. Stop before model resolution and cover the race with a regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Root cause
A newer editor operation can cancel an in-flight
SessionChangesEditor.setInputwhile it is yielding in the basesetInputcall. Cleanup can then clear and dispose the oldSessionChangesEditorInput. When the canceled continuation resumed, it attempted to lazily create an inner multi-diff input through an already disposedMutableDisposable, then crashed while readinggetViewModelfrom the rejected value.Validation
npm run transpile-client.\scripts\test.bat --run src\vs\sessions\contrib\changes\test\browser\sessionChangesEditorInput.test.ts(5 passing)