acoustic-carpenter-78188
03/18/2026, 6:59 AMdoWatch() creates watches without passing ResourceVersion, so the API server replays all existing resources as ADDED events on reconnect.
Fix:
1. Added lastResourceVersion field to ActionsClient struct
2. In `doWatch()`: read lastResourceVersion under RLock and pass it in metav1.ListOptions.ResourceVersion when creating the watch
3. In `handleWatchEvent()`: update lastResourceVersion from taskAction.ResourceVersion under write Lock
4. Handle watch.Error events: on 410 Gone, reset lastResourceVersion to "" (triggers fresh list); on other errors, preserve version for retry
Thread safety uses the existing mu sync.RWMutex.
Test Plan
• `TestHandleWatchEvent_UpdatesResourceVersion`: verify ResourceVersion is extracted and stored from watch events
• `TestDoWatch_PassesResourceVersionOnReconnect`: verify stored version is passed in ListOptions on reconnect
• `TestDoWatch_HandlesGoneError`: verify 410 Gone resets to empty string
• `TestDoWatch_PreservesResourceVersionOnOtherErrors`: verify non-Gone errors preserve version
All tests pass with -race flag.
• main
• #6583
• fix: Track ResourceVersion in TaskAction watcher to prevent duplicate ADDED events 👈
flyteorg/flyteacoustic-carpenter-78188
03/18/2026, 6:59 AM