You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prevent in-flight task messages from recreating deleted tasks #2376
Investigate the shared task message lifecycle when a message write is already in progress during task disposal and deletion.
At PR #1403 head 1471730e6d22d1817e113c3df7d3a11a3ae273db, Task.addToClineMessages() awaits postStateToWebviewThrottled() before emitting the message event and calling saveClineMessages(). If disposal occurs during that await and another panel deletes the task, a late persistence operation may recreate the deleted task. The post-save diagnostics tail has cancellation guards before say() starts, but those guards cannot stop a say() already in progress.
Affected areas
src/core/task/Task.ts: say(), ask(), addToClineMessages(), and task disposal.
src/core/webview/ClineProvider.ts and task persistence/deletion paths.
Acceptance criteria
Define and implement the disposal-versus-persistence contract at the appropriate shared boundary. Prevent a late in-flight message write from recreating a deleted task.
Add a regression test that pauses the state post, disposes and deletes the task, then releases the post and checks that the task is not recreated.
Verify normal say() and ask() event and persistence behavior, including unanswered ask ordering, remains correct.
Activity