Repository navigation
fix(native-chat): say which retry a Claude retry is on and what it last failed with - #25818
Conversation
…hat-retry-progress
Claude Code sends its first api_retry frame only after the first request failed, so frame "attempt N of max_retries" is the Nth retry. Say "Retry N of M." and store the bound as maxRetries.
Status: ready for review (head
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (12)
🚧 Files skipped from review as they are similar to previous changes (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughProvider retry facts now retain valid attempt counts and a maximum when it is at least the attempt. Retry status wording includes retry progress and may include provider causes or generated error details. English, Spanish, French, Japanese, Korean, and Chinese copy was added. Claude retry rows now pass attempt metadata to the shared retry fact reader. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change improves retry notices to show the retry number and the last error. No concrete merge-blocking risk was found in the supplied context. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 9 files. (7 skipped: 7 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…hat-retry-progress # Conflicts: # src/renderer/src/i18n/locales/en.json
…hat-retry-progress
ELI5
When Claude's request to its API fails, Claude Code retries it on its own, up to 10 times. A native chat showed one amber line for this, "Claude hit a temporary problem and is retrying.", and that line never changed. On the first retry and on the ninth it read the same and named no error, so a chat stuck in a retry loop looked frozen. The line now says which retry Claude is on, out of how many, and what the last request failed with.
What Changed
The problem: a Claude chat whose requests went through an API proxy kept getting
502responses. Each request hung for about 4 minutes, then failed, and Claude Code retried. Over an hour the chat went through two full retry runs. All the user saw was "Working…" and, once the first request failed, one amber line that never changed. Nothing showed that the retry count was rising, that every request was failing the same way, or that Claude would give up after 10 retries.Before (the same text for every retry):
After (the row is still revised in place, but now it moves):
A rate-limited retry reads "Claude is rate-limited and retrying. Retry 2 of 10." followed by "Last error: HTTP 429 rate limit."
The mechanism: Claude Code sends a
system/api_retryevent for every retry. It sends the first one only after the first request has failed, soattemptN means the Nth retry, and up to 10 retries means up to 11 requests. The event already carriesattempt,max_retries,error_status, anderror. Orca's retry row kept only the status and the error, used them just to pick between the "rate-limited" and the generic sentence, and dropped the retry count.AgentSessionProviderRetry) gains two optional fields,attempt(which retry this is, counted from 1) andmaxRetries. The reader keeps them only when they are positive whole numbers, and keeps the maximum only when it is at least the retry it bounds.Why
The common pattern for this state is one row per retry run, updated in place, that shows the retry count out of the maximum and the provider's error. Orca already had the single row updated in place; it was missing the count and the error. This PR adds both.
How this differs from the common pattern:
After a request gets through, the row still says "is retrying", as it did before this PR. Relabelling it as recovered is not part of the common pattern and would be a separate change.
The alternative was to show the raw event or the HTTP status alone. That would put internal codes in front of people without saying how far the retry has gone, and the retry count is the part that answers "is this stuck?".
Compatibility: both fields are new and optional. An older desktop or mobile client prints the row's text as the host wrote it, so it shows the new wording. A reader that doesn't know the new fields drops them, and that reader's fallback is the host's text. Rows written before this change keep their old wording.
Linked Issue
N/A (maintainer)
Visual Proof
Captured in a hidden test build on macOS. The chat's Claude was a stand-in that sends the same
system/api_retryevent Claude Code sent in the real incident: 6 retries, 15 seconds apart, then a normal answer.After (this PR), rate-limited (HTTP 429), retry 3:
After the retries end, the turn finishes as before and folds into "Worked for …":
In every run there was exactly one retry row, revised in place. No extra rows, toasts, cut-off text, raw
server_errorcodes, or unfilled placeholders appeared.Testing
Unit tests: the Claude retry row (retry number and maximum recorded, a 502 run's wording, a new run starting over), the sentence builder (with and without a maximum, the provider's own explanation outranking its codes, Codex progress not counted twice, and every fact shape still one readable sentence that ends with a period and contains no code-like words), and the reader (retry number and maximum validation, the full fact surviving a round trip).
Passed on the head with main merged in:
tc:node,tc:web,tc:cli, the changed-lines quality gate, oxlint, and the localization catalog, extraction, coverage, and runtime-catalog checks.Electron QA on macOS (hidden test builds of main and of this PR, isolated profiles): the before/after runs above, for HTTP 502 and HTTP 429.
Platforms: the change is platform-independent string building on the host. The SSH and remote case gets the same row text from the remote host.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)