Skip to content

fix(native-chat): say which retry a Claude retry is on and what it last failed with - #25818

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/native-chat-retry-progress
Oct 6, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/native-chat-retry-progress

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​138 $\color{#cf222e}{\Huge{\mathbf{−}}}$​23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115

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 502 responses. 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):

Claude hit a temporary problem and is retrying.

After (the row is still revised in place, but now it moves):

Claude hit a temporary problem and is retrying. Retry 7 of 10.
Last error: HTTP 502 server error.

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_retry event for every retry. It sends the first one only after the first request has failed, so attempt N means the Nth retry, and up to 10 retries means up to 11 requests. The event already carries attempt, max_retries, error_status, and error. 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.

  • The failure fact on a retry row (AgentSessionProviderRetry) gains two optional fields, attempt (which retry this is, counted from 1) and maxRetries. 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.
  • The Claude retry row fills both fields from the event.
  • The sentence builder adds "Retry N of M." after the sentence. When the provider wrote no explanation of its own, it adds a "Last error:" line built from the provider's status and error code. Underscores in the code become spaces ("server error").
  • Rows where the provider describes its own progress keep quoting it and are not counted a second time. Codex rows ("Reconnecting... 2/5") are unchanged.
  • The three new phrases are translated in every locale. The retry wording moved to its own module so the sentence module stays under the line limit.

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:

  • No retry delay shown. Intended. The common pattern also shows the wait before the next retry, as a fixed figure such as "retrying in 9.4 s". In this incident that wait grew 0.5 s, 1.2 s, 2.1 s, 4.6 s, 9.4 s, and so on, while each request hung about 4 minutes before it failed. A figure like "retrying in 9.4 s" would stay on screen for minutes after it stopped being true, so the row leaves it out.
  • The row stays an amber warning card instead of a neutral progress line. Intended for this PR. That styling already exists and is out of scope.

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_retry event Claude Code sent in the real incident: 6 retries, 15 seconds apart, then a normal answer.

Retry 1 Retry 3
Before (main), HTTP 502 before, retry 1 before, retry 3
After (this PR), HTTP 502 after, retry 1 after, retry 3

After (this PR), rate-limited (HTTP 429), retry 3:

after, rate limited, retry 3

After the retries end, the turn finishes as before and folds into "Worked for …":

after, retries over

In every run there was exactly one retry row, revised in place. No extra rows, toasts, cut-off text, raw server_error codes, 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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and 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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@brennanb2025 brennanb2025 changed the title fix(native-chat): say which attempt a Claude retry is on and what it last failed with fix(native-chat): say which retry a Claude retry is on and what it last failed with Oct 6, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status: ready for review (head b51c43ff1a3)

The problem this fixes: a Claude chat whose API requests kept failing (HTTP 502 through a proxy) showed only "Working…" and one amber line that never changed: "Claude hit a temporary problem and is retrying." It read the same on the first retry and the ninth, so the chat looked frozen.

What you see now: the same single row is revised in place and moves: "Claude hit a temporary problem and is retrying. Retry 3 of 10." with "Last error: HTTP 502 server error." on a second line. Rate limits read "Claude is rate-limited and retrying. Retry 3 of 10." with "Last error: HTTP 429 rate limit."

Review:

  • Round 1: no code bugs. It found that "Attempt N of M" mislabelled Claude's numbers. Claude Code sends retry N only after the Nth request has failed, and max_retries caps retries, so 10 retries means 11 requests.
  • Round 2: switched the wording to "Retry N of M", renamed the saved field from maxAttempts to maxRetries before it ships, merged main, and fixed the description.
  • Round 3: independent review, clean, no changes.
  • Readiness checklist at the start and the end: no blocking findings.

Checks on this head:

  • tc:node, tc:web and tc:cli pass.
  • The changed-lines quality gate, oxlint and the four localization checks pass.
  • 173 targeted tests pass.
  • CI: 14 checks passed and 18 skipped, none failed or pending at the time of writing.

Live QA (macOS, hidden test builds, isolated profiles): main and this PR were run side by side against a Claude stand-in that sends the same retry event as the real incident.

  • Main shows one unchanging row.
  • This PR shows one row revised in place, from Retry 1 of 10 to Retry 3 of 10, with the last-error line, for both 502 and 429.
  • When the retries end, the turn finishes and folds as before.
  • No extra rows, toasts, cut-off text, raw codes or placeholders appeared.
  • Screenshots are in the description.

Known, not changed here:

  • After a request gets through, the row still says "is retrying", as before. Relabelling it as recovered would be a separate change.
  • A rate-limited row names the rate limit twice, once in the sentence and once in "Last error". This is harmless.
  • When Claude reports no HTTP status and the error unknown, the row reads "Last error: unknown.", the same raw code the common pattern shows.
  • Possible follow-up (not verified): retry rows are grouped by whether each retry number follows the last. If Claude Code ever interleaves retry events from two requests (its rate-limit path might), one row could briefly show the other request's number. With the CLI version checked (2.1.280), subagent retries arrive as a different event, so the main case can't happen. Confirming the rest needs a captured transcript.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 6, 2026 20:20
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e53bb1a0-5d7f-4e23-be7e-324064fa1211
📥 Commits

Reviewing files that changed from the base of the PR and between b51c43f and 9c7447a.

📒 Files selected for processing (12)
  • src/renderer/src/components/native-chat/agent-session-failure-words-text.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/agent-session-failure-copy.ts
  • src/shared/agent-session-failure-words.ts
  • src/shared/agent-session-failure.test.ts
  • src/shared/agent-session-failure.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/es.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Provider 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 9c744

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: showing the retry number and last error in Claude native chat. It is specific and relevant, though slightly long.
Description check ✅ Passed The description explains the problem, user-visible change, implementation, rationale, testing, and visual proof. It addresses the template sections; the maintainer issue exception applies, and the unc…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025
brennanb2025 merged commit f6448a1 into main Oct 6, 2026
25 of 27 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/native-chat-retry-progress branch October 6, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant