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
Commit 54a6df6
Browse filesBrowse the repository at this point in the historyBrowse files
fix: batch trigger skips idempotency key status check for failed runs
BatchTriggerV3Service.#prepareRunData only checked time-based expiration
on cached idempotency key lookups, but never checked whether the matched
run was in a terminal failure state. The single-trigger path
(IdempotencyKeyConcern.handleExistingRun) correctly calls
shouldIdempotencyKeyBeCleared(status) and re-triggers in that case.
This meant batchTrigger with an idempotency key that pointed at a
CRASHED, SYSTEM_FAILURE, TIMED_OUT, EXPIRED, COMPLETED_WITH_ERRORS, or
INTERRUPTED run would silently return the dead run as isCached: true,
instead of clearing the key and creating a fresh run.
The root cause was twofold:
- findRunsByIdempotencyKeys SQL query did not SELECT the status column
- IdempotencyKeyRunMatch type did not include status
Fix:
- Add status to IdempotencyKeyRunMatch and the backing SQL query
- Add shouldIdempotencyKeyBeCleared guard in #prepareRunData, mirroring
the single-trigger path
Tests:
- 21 unit tests covering all TaskRunStatus values
- Integration tests verifying status is returned from the query
- Edge case coverage for COMPLETED_SUCCESSFULLY, CANCELED, and
RETRYING_AFTER_FAILURE (all correctly remain cached)
return`SELECT "id", "createdAt", "friendlyId", "idempotencyKey", "idempotencyKeyExpiresAt" FROM "TaskRun" WHERE "runtimeEnvironmentId" = $${base+1} AND "taskIdentifier" = $${base+2} AND "idempotencyKey" = $${base+3}`;
1864
+
return`SELECT "id", "createdAt", "friendlyId", "idempotencyKey", "idempotencyKeyExpiresAt", "status" FROM "TaskRun" WHERE "runtimeEnvironmentId" = $${base+1} AND "taskIdentifier" = $${base+2} AND "idempotencyKey" = $${base+3}`;
0 commit comments