#9482: feat: add cloud code assist retry logic and parsing for rate limit errors
agents
stale
Cluster:
Error Resilience and Retry Logic
## Summary
- Add a single bounded retry for Cloud Code Assist 429 “capacity” errors.
- Parse the provider’s “reset after Ns” hint and wait up to 60s before retrying.
- Avoids premature profile cooldown/failover on transient CCA throttles.
## Testing
- Not run (please advise).
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a single bounded retry path for Cloud Code Assist throttling errors (HTTP 429 “capacity”), by parsing a provider error hint of the form “reset after Ns” and sleeping up to 60 seconds before retrying the embedded PI run loop. The retry is guarded to only occur once per run (`cloudCodeAssistRetryUsed`) and is applied both for prompt submission failures (`promptError`) and assistant failures (`lastAssistant?.errorMessage`) when the provider is `google-gemini-cli`, to reduce unnecessary auth profile cooldown/failover on transient throttles.
<h3>Confidence Score: 4/5</h3>
- This PR is generally safe to merge with low functional risk.
- Change is localized and adds a bounded, single retry with a hard cap; no obvious control-flow or state bugs were found. Main issue is an incorrect provider/model in one warning log, which can mislead triage but won’t break behavior.
- src/agents/pi-embedded-runner/run.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#20982: Improve 429 messaging for Retry-After parse failures and failover
by Tsopic · 2026-02-19
76.8%
#9025: Fix/automatic exponential backoff for LLM rate limits
by fotorpics · 2026-02-04
75.8%
#16239: fix: retry on transient API errors (overloaded, rate-limit, timeout)
by zerone0x · 2026-02-14
74.9%
#8256: feat: Add rate limit strategy configuration
by revenuestack · 2026-02-03
74.9%
#15301: Feat/gemini overflow and tags
by divisonofficer · 2026-02-13
73.9%
#14368: fix: skip auth profile cooldown on format errors to prevent provide...
by koatora20 · 2026-02-12
73.8%
#11874: fix: handle fetch rejections in provider usage withTimeout
by Zjianru · 2026-02-08
72.8%
#13686: Add opt-in rate limiting and token-based budgets for external API c...
by ShresthSamyak · 2026-02-10
72.6%
#16913: fix(agent): increase transient HTTP retry from 1 to 3 with escalati...
by hou-rong · 2026-02-15
72.6%
#23497: feat(retry): add retryHttpAsync utility with comprehensive coverage
by thinstripe · 2026-02-22
72.1%