Previously, canceling a running task could lead to the loss of the most recent chat history if it hadn't been saved immediately prior to cancellation.
This commit addresses the issue by ensuring that both the Cline messages (user-facing chat) and the API conversation history are explicitly saved at the beginning of the `abortTask` method in `src/core/task/Task.ts`. This guarantees that the latest state of the conversation is persisted before the task is fully terminated and its resources are released.
An automated E2E test has been added to `e2e/src/suite/task.test.ts` to specifically verify this fix. The test simulates starting a task, sending messages, canceling the task, and then resuming it to assert that the chat history remains intact.
Manual testing also confirmed that the chat history is correctly preserved after canceling and resuming a task.
* Quick fix actions
* Remove unused keys
* Simplify more stuff
* Bring back "Explain Code"
* Bring "Improve Code" back
* Add back "Improve"
* This is too flakey for now
This commit fixes an issue where subtasks weren't properly reporting back to parent tasks when cancelled and resumed. Previously, when a subtask was cancelled and a new task was started with the same message, the parent task would incorrectly resume, causing unexpected behavior.
The fix:
1. Stores parent-child relationship information before cancelling a task
2. Restores this relationship after task reinitialization
3. Ensures parent tasks only resume when explicitly instructed to do so
This approach maintains the correct task hierarchy throughout the cancellation and resumption process, preventing parent tasks from automatically resuming when unrelated tasks with similar messages are started.