fix: retry transient read timeouts when polling dbt Cloud run status#294
Merged
Conversation
The dbt Cloud request retry policy only retried HTTP 502/503/504, so a transient read timeout — surfaced by the core HTTP client as RuntimeException(SocketTimeoutException) — was not retried and failed the whole CheckStatus/TriggerRun task, even though the dbt Cloud run was still healthy and went on to complete successfully. Broaden the retry predicate to also cover connection-level failures (HttpClientRequestException, i.e. socket/SSL) and read/connect timeouts (SocketTimeoutException, including when wrapped as the cause). Genuine client errors such as 4xx still fail fast. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Contributor
Tests report quick summary:success ✅ > tests: 40, success: 40, skipped: 0, failed: 0 unfold for details
|
fdelbrayelle
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
io.kestra.plugin.dbt.cloud.CheckStatus(andTriggerRunwithwait: true) polls the dbt Cloud run status throughAbstractDbtCloud.request, whose retry policy only retries HTTP 502/503/504. A transient read timeout during a status poll is surfaced by the core HTTP client asRuntimeException(java.net.SocketTimeoutException), so it is not retried, propagates out of the polling loop, and fails the whole task — even though the dbt Cloud run is still healthy and goes on to complete:The very next attempt of the same run completed
10 total | 10 success, confirming there was no real dbt error — just a transient network read timeout on one poll.Root cause
The retry predicate in
AbstractDbtCloud.requestonly matchedHttpClientResponseExceptionwith status 502/503/504:A read timeout is not an
HttpClientResponseException, so it never matched, was not retried, and failed the task.Fix
Broaden the retry predicate (extracted into
isRetriableTransientError) to also treat as transient:HttpClientRequestException(socket / SSL handshake);SocketTimeoutException, including when wrapped as the cause.Genuine client errors (4xx) still fail fast — no change there. Reuses the existing
maxRetries/initialDelayMsconfig; no new properties. Benefits every request path (CheckStatuspolling,downloadArtifacts,TriggerRun).Tests
CheckStatusRetryTest:shouldRetryOnReadTimeoutAndEventuallySucceed— reproduces the reported failure (RuntimeException(SocketTimeoutException)then200) and asserts retry + success. Verified red without the fix (SocketTimeoutException: Read timed out), green with it.shouldNotRetryOnClientError— asserts a404fails fast (single attempt, no retry).Full
io.kestra.plugin.dbt.cloudpackage: 14/14 green.Closes #295
🤖 Generated with Claude Code