feat: add --prompt-retries for automatic retry on transient errors#142
feat: add --prompt-retries for automatic retry on transient errors#142lupuletic wants to merge 4 commits 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>
Triage resultHuman attention: Quick readThis PR adds an opt-in IntentAdd a configurable automatic retry mechanism for WhyIssue #137 reports transient 400/500-style model/API failures surfacing as ACP internal errors and interrupting prompt/session flow even when retrying would often recover. This PR addresses that by adding retry classification plus exponential backoff in the main prompt paths while excluding clearly permanent failures. Codex reviewGitHub Codex review data for the current head was empty; the local Codex review was established and used as the primary review evidence. Blocking issues were fixed before handoff:
Remaining Codex notes are non-blocking follow-ups in queued session mode:
CI/CDCI status: green for the current head. Approval-blocked workflow handling:
Passing jobs:
Other notes:
RecommendationReady for human landing decision. If you are comfortable landing with the remaining non-blocking queued-session follow-ups deferred, this PR looks safe to continue: intent is correct, blocking review issues were addressed, targeted validation passed, and CI is green. |
) * feat: add --prompt-retries flag for automatic retry on transient errors 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 #137 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix prompt retry replay after partial output * Honor strict JSON during prompt retries * docs(changelog): note prompt retry support (#142) --------- Co-authored-by: Catalin Lupuleti <catalin.lupuleti@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: bob <dutifulbob@gmail.com>
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