fix: clear pending edit operations when Start New Task is clicked (#7949) #7950
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.

Description
This PR fixes an issue where clicking "Start New Task" after completing a resumed task would reopen the previous task at the earlier cancel point instead of starting a fresh session.
Problem
When a user:
The UI would bring back the just-completed task and jump to where it was originally canceled, causing an inconsistent task history.
Solution
The fix ensures that pending edit operations are properly cleared when:
clearTask()method is called (when "Start New Task" is clicked)createTaskWithHistoryItem()This prevents stale pending operations from being processed and causing the UI to jump back to previous states.
Changes
clearTask()inClineProvider.tsto clear pending edit operations before removing the taskcreateTaskWithHistoryItem()to clear stale pending operationsClineProvider.clearTask.spec.tsTesting
Related Issue
Fixes #7949
Important
Fixes issue #7949 by clearing pending edit operations when starting a new task in
ClineProvider.ts.clearTask()andcreateTaskWithHistoryItem()inClineProvider.ts.clearTask()to clear pending operations before removing the task.createTaskWithHistoryItem()to clear stale pending operations.ClineProvider.clearTask.spec.tswith tests for clearing pending operations, handling no active tasks, and task removal failures.This description was created by
for d0b069c. You can customize this summary. It will automatically update as commits are pushed.