Repository navigation
fix(sdk): Retry hunks when the runtime reports a provider error - #601
Merged
Merged
Conversation
A runtime result with status provider_error failed the hunk at once. Only thrown errors went through the retry loop. Transient provider failures now retry with the same backoff, and the last attempt still reports the failure and counts toward the circuit breaker. The all-chunks-failed error now also lists each failure's code and message, so it no longer hides the cause behind auth guidance. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dcramer
approved these changes
Dec 2, 2026
| import { getHunkLineRange, type HunkWithContext } from '../diff/index.js'; | ||
| import { Sentry, emitExtractionMetrics, emitRetryMetric, emitSkillMetrics, ensureLocalTracing } from '../sentry.js'; | ||
| import { SkillRunnerError, WardenAuthenticationError, isRetryableError, isAuthenticationError, isAuthenticationErrorMessage, isSubprocessError, classifyError, mapExtractionErrorCode, sanitizeErrorMessage, type ProviderErrorContext } from './errors.js'; | ||
| import { ProviderResultError, SkillRunnerError, WardenAuthenticationError, isRetryableError, isAuthenticationError, isAuthenticationErrorMessage, isSubprocessError, classifyError, mapExtractionErrorCode, sanitizeErrorMessage, type ProviderErrorContext } from './errors.js'; |
Contributor
There was a problem hiding this comment.
ProviderResultError with IPC substrings skips retry and becomes auth failure
Retryable provider_error results are thrown as ProviderResultError, but the catch path runs isSubprocessError before isRetryableError, so messages containing ECONNRESET/EPIPE/etc. abort as auth instead of retrying. Handle ProviderResultError before the subprocess/auth converters.
Evidence
- On non-final attempts,
provider_errorbecomesthrow new ProviderResultError(failureMessage)wherefailureMessageembedsresultMessage.errors(analyze.ts~504). - The hunk catch path checks
isSubprocessError(error)beforeisRetryableError(error)(analyze.ts~662–680). isSubprocessErroris true for anyErrorwhose message includesECONNRESET/EPIPE/ECONNREFUSED/ENOTCONN(errors.ts, covered byerrors.test.ts).- That branch records
auth_failed, opens the circuit, and throwsWardenAuthenticationError, so the intendedProviderResultErrorretry never runs. - Before this change, the same
provider_errorresult returnedfailureCode: 'provider_unavailable'without entering that catch path.
Identified by Warden · code-review · 4FJ-4QF
This branch was successfully deployed
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.
When a runtime result comes back with status
provider_error, the hunk failed right away. Only thrown errors went through the retry loop, so a transient upstream failure, such as "Internal error during token generation", lost the whole hunk.Those results now go through the same retry and backoff as thrown provider errors. The last attempt still reports the failure and counts toward the circuit breaker, so a sustained outage still stops the run.
The "All N chunks failed to analyze" error now also lists each failure's code and message. Before, it showed only auth guidance, even when the real cause was something else.
via @dcramer.
--
View Session [Sentry]