Automations: guard deletion against concurrent definition changes
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Ref: https://github.com/microsoft/vscode/pull/333226#discussion_r3883321966
## Problem
Automation deletion currently uses only the automation ID after the user confirms. If another window or process updates the automation while the confirmation dialog is open, confirming deletion removes the newer definition without detecting that it differs from the snapshot the user reviewed.
If the automation is removed concurrently, provider routing can also fail before reaching stores whose delete operation otherwise treats a missing ID as a no-op.
This behavior predates the automation-card context menu and applies to the existing trash-button flow as well.
## Expected behavior
Deletion should atomically compare the current editable automation state with the descriptor shown when confirmation began, and return an explicit outcome:
- deleted;
- changed since confirmation began; or
- already deleted.
The UI should report changed and already-deleted outcomes clearly instead of deleting a newer definition or surfacing a generic provider lookup error.
## Implementation direction
Add a guarded deletion operation analogous to `updateAutomationIfUnchanged` across `IAutomationStore`, `IAutomationService`, provider routing, legacy storage, and Agent Host storage. Reuse the existing canonical editable-state comparison and add cross-window/provider tests.
Follow-up from #333226.
Contributor guide
Assessment
This issue has not been assessed yet.