Skip to content

fix(ui, cli): humanize provider retry delay (3401) - #3611

Open
yunaremaia wants to merge 1 commit into
apache:mainfrom
yunaremaia:fix/maka-3401-humanize-retry-v2
Open

fix(ui, cli): humanize provider retry delay (3401)#3611
yunaremaia wants to merge 1 commit into
apache:mainfrom
yunaremaia:fix/maka-3401-humanize-retry-v2

Conversation

@yunaremaia

Copy link
Copy Markdown

Fixes #3401.

When a provider returns a long Retry-After (~13565s for a 5h quota reset), the retry banner renders Retrying in 13565s / 13565 秒后重试 — illegible. Related to #3393 (countdown ticking).

What changed

  • packages/ui/src/conversation-copy.ts — new formatRetryDelay(seconds, locale): 135653h 46m 5s (en) / 3小时 46分 5秒 (zh), 1s granularity. Wired into both zh/en providerRetryScheduled catalog entries.
  • packages/cli/src/pi-transcript.ts — new formatRetryDuration(delayMs) for the TUI activity strip; same humanized output (en).

Granularity stays at one second so the banner visibly ticks (minute-granularity would reintroduce the frozen look from #3393).

Verification

  • formatRetryDelay spot-checked locally (13565→3h 46m 5s, 90061→1d 1h 1m 1s, edge: 0.2→1s).
  • No registry workaround; change is compile-only (no new deps).
  • Full local build/test not run — relies on @xterm/xterm custom registry (ms-feed-2.pkgs.visualstudio.com); CI is the verification layer.

Closes #3401.
Related: #3393.

Humanizes the retry banner from raw seconds (`13565s`) to
`3h 46m 5s` / `3小时 46分 5秒` with 1s granularity.

- ui/conversation-copy: new `formatRetryDelay(seconds, locale)`
  shared by zh/en catalogs; replaces raw `${seconds}s` copy
- cli/pi-transcript: new `formatRetryDuration(delayMs)`
  for TUI activity strip

Fixes apache#3401.
Related to apache#3393 (countdown ticking) — this complements that fix
by formatting the number that now ticks.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 742bbc9. Coverage: UI zh/en duration formatting over seconds/minutes/hours/days and fractional-second rounding; CLI millisecond formatting and narrow-line fitting; provider-retry event bounds/countdown flow; confirmation that Runtime retry-after/backoff calculation, sleep, attempts, and protocol transport are unchanged. Exclusions: real provider Retry-After traffic and interactive terminal/renderer visual inspection. Local UI→CLI builds passed and 228 focused UI/CLI tests are green; hosted exact-head test is green. No P0–P3 findings. The branch is 24 commits behind main and currently conflicts only in packages/ui/src/conversation-copy.ts; rebase should preserve current main’s newer copy entries plus this PR’s formatter/wiring.

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.

Desktop retry banner shows raw seconds for long waits: '13565 秒后重试'

2 participants