feat: add --prompt-retries for automatic retry on transient errors#142
Open
lupuletic wants to merge 1 commit intoopenclaw:mainfrom
Open
feat: add --prompt-retries for automatic retry on transient errors#142lupuletic wants to merge 1 commit intoopenclaw:mainfrom
lupuletic wants to merge 1 commit intoopenclaw:mainfrom
Conversation
When model APIs return transient errors (HTTP 400/500 surfacing as ACP internal errors), acpx now supports automatic retry with exponential backoff via the --prompt-retries flag. - Add isRetryablePromptError() to classify transient vs permanent errors - Retry only on ACP -32603 (internal) and -32700 (parse) errors - Never retry auth, permission, timeout, or session-not-found errors - Exponential backoff: 1s, 2s, 4s, 8s, capped at 10s - Skip retry if agent process crashed during prompt - Flow --prompt-retries through CLI → queue owner → prompt execution - Default: 0 (no retries, preserving existing behavior) Closes openclaw#137 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
--prompt-retries <count>CLI flag to automatically retry failed prompt turns on transient ACP errorsisRetryablePromptError()to classify transient vs permanent errors — retries only on ACP-32603(internal error) and-32700(parse error)Closes #137
How it works
When a model API returns a transient error (e.g. HTTP 400/500), the ACP agent wraps it as a JSON-RPC
-32603internal error. With--prompt-retries 3, acpx will:isRetryablePromptError()Test plan
isRetryablePromptError()covering all error categoriesAI-assisted PR
pnpm build && pnpm test && pnpm lint)🤖 Generated with Claude Code