feat(core): retry all provider errors and surface JSON-RPC error details#888
Merged
feat(core): retry all provider errors and surface JSON-RPC error details#888
Conversation
Previously, the retry loop only retried timeout-like errors; other
provider failures (e.g. transient API errors, JSON-RPC rejections from
ACP SDK) failed immediately with no retry. Now all provider errors are
retried up to maxRetries (default 2).
Also fixes error serialization: the ACP SDK rejects promises with plain
JSON-RPC error objects ({code, message}) instead of Error instances.
buildErrorResult used String(error) on these, producing the unhelpful
"[object Object]" message. The new extractErrorMessage() helper reads
the .message and .code properties from plain objects.
Closes #886
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds 2^attempt * 1000ms delay (1s, 2s, 4s, …) capped at 30s between retry attempts, matching promptfoo's approach. Prevents hammering rate-limited APIs with immediate retries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…xtraction - sleep() now accepts an optional AbortSignal so cancellation isn't blocked during backoff delays - extractErrorMessage() falls back to JSON.stringify for plain objects that lack a string message property, preventing [object Object] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
maxRetries(default 2). This matches how promptfoo and inspect_ai handle retries — both retry broadly, not just timeouts.[object Object]error messages: The ACP SDK rejects promises with plain JSON-RPC error objects ({code, message}) instead ofErrorinstances.buildErrorResultusedString(error)on these, producing the unhelpful[object Object]. NewextractErrorMessage()helper reads.messageand.codefrom plain objects.Closes #886
Context
Observed in CI run 23804682863: 4 tests (
respond-triages-pr-comments,respond-classification-coverage,retrospect-synthesizes-journal,retrospect-identifies-patterns) failed withERROR: [object Object]— 0 tokens, 0ms duration. The Copilot CLI returned a JSON-RPC error during ACP initialization (transient API issue), and the error was never retried becauseisTimeoutLike()returned false for non-Error objects.Test plan
{code: -32600, message: "Invalid request"}produces"Invalid request (code -32600)"not"[object Object]"🤖 Generated with Claude Code