Skip to content

Commit a91c08c

Browse files
authored
fix(core): retry run start-attempt on transient connection errors (#4441)
## What `startRunAttempt` — the run controller's first call when a run starts — had no retry on transient connection errors. A brief connection blip on that call would abandon the start and send the run back through the queue, delaying its first attempt. This adds a jittered backoff retry, matching the existing `continueRunExecution` path with a shorter budget, so a transient blip is ridden out in place instead of bouncing the run. ## Why a shorter budget The continue path retries generously. Start-attempt keeps a tighter budget (6 attempts, ~25-40s jittered) so it rides out a transient blip but never keeps retrying past the point the run would already have been requeued. ## Safety Retrying is safe: start-attempt is guarded server-side by the snapshot id — a retry after a start has already committed is rejected, so it can never double-start an attempt. A pure connection error (the common case) never reached the server. ## Scope One retry-options object on `startRunAttempt`; no other behavior change. Warm starts share this path and get the same resilience.
1 parent c72ebf9 commit a91c08c

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Transient connection errors when a run starts are now retried for longer, so a brief connectivity blip no longer sends the run back through the queue and delays its first attempt.

packages/core/src/v3/runEngineWorker/workload/http.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ export class WorkloadHttpClient {
165165
...this.defaultHeaders(),
166166
},
167167
body: JSON.stringify(body),
168+
},
169+
{
170+
retry: {
171+
minTimeoutInMs: 1000,
172+
maxTimeoutInMs: 10_000,
173+
maxAttempts: 6,
174+
factor: 2,
175+
randomize: true,
176+
},
168177
}
169178
);
170179
}

0 commit comments

Comments
 (0)