Repository navigation
Description
Summary
Investigate whether a later task can save unapproved streamed content after a prior task's rollback fails and the prior task is disposed.
The earlier review found that a rollback failure could leave a dirty document open, and that a later DiffViewProvider.open() could save a dirty document. This cross-task risk predates PR #1930; it has not been verified with a two-task test. PR #1930 does not contain the disposal release discussed below.
The requester identifies the later stacked unit, PR #2435, as the relevant place to assess the disposal drop. At commit 4baf005673f482d9d911de87ff0890644765193a, src/core/task/Task.ts calls writeToFileTool.releaseTaskRollbackFailure(this) during disposal, and src/core/tools/WriteToFileTool.ts defines the release. src/integrations/editor/DiffViewProvider.ts manages the editor buffer and its opening and rollback behavior.
Required work
- Add a test with two distinct tasks that share a document. Make task A's rollback fail or be refused, keep the document dirty, and dispose task A. Then have task B open the same path.
- Check whether task B saves the unapproved streamed content before approval. Use a document double or extension-host coverage that preserves the dirty state across task disposal.
- If the test confirms the risk, add protection at the appropriate cross-task boundary and a regression test. Do not retain a disposed task solely to keep a per-task marker alive. Keep protection until safe recovery or an explicit user decision makes it unnecessary.
Acceptance criteria
- The test records the buffer and persisted contents before and after task B opens the path, and distinguishes unapproved streamed content from the original content.
- The test demonstrates that task B cannot silently persist unapproved content before approval, or documents why the scenario cannot occur with the real document lifecycle.
- If a fix is required, tests cover recovery and cleanup of its protection without retaining disposed task state.
Context
- Requester: @easonLiangWorldedtech
- Original PR: U5a of the split of this pull: rollback recovery context and the report of whether a revert ran #1930
- Review discussion: U5a of the split of this pull: rollback recovery context and the report of whether a revert ran #1930 (comment)
- Later stacked unit identified by the requester: U5b of the split of pull 1930: per-task stream state, captured once and released once #2435
- Referenced later-unit revision: 4baf005
Activity