You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "me2seeks (via GitHub)" <gi...@apache.org> on 2026/08/21 08:47:46 UTC
[PR] fix(ui): humanize provider retry delay in the banner copy [maka]
me2seeks opened a new pull request, #3402:
URL: https://github.com/apache/maka/pull/3402
Fixes #3401.
## Problem
With a long provider `Retry-After` (subscription quota window reset, e.g. kimi-k3 / OpenCode Go 5h quota), the desktop retry banner renders a raw five-digit second count — `13565 秒后重试(2/10)` — illegible and visually indistinguishable from a hang. The TUI strip already humanizes the same wait as `4h 28m 3s` (#3393).
## Fix
Format `providerRetryScheduled` in d/h/m/s units per locale:
- zh: `4小时 28分 3秒后重试(2/10)`
- en: `Retrying in 4h 28m 3s (2/10)`
One-second granularity is kept so the banner visibly ticks every second — the goal chip's minute-granularity ladder would reintroduce the frozen look between minute boundaries. Short delays keep the familiar seconds-only form (`45秒后重试` / `Retrying in 45s`).
## Tests
New `conversation-copy.test.ts` pins both locales across second/minute/hour/day scales. Full ui suite (184) passes; biome lint/format clean.
Note: independent of #3400 (countdown ticking); either merge order works.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3402:
URL: https://github.com/apache/maka/pull/3402#issuecomment-5383900331
Reviewed at `efd19dbf`. No findings.
The problem is small but real: a provider's `Retry-After` can be hours or days, and rendering that as a raw second count gives the reader a long number with no sense of scale.
The shape is right in the way that matters most for a copy change — it stays a copy change. `conversation-copy.ts` gains one pure formatter that decomposes into d/h/m/s, the locales supply only unit strings, and `chat-turn.tsx` remains the single call site, still doing `Math.max(1, Math.ceil(delayMs / 1000))` as before. No countdown, no timer, no retry policy migrated into the UI, and no second formatter competing with an existing one.
Checked and clear: 0, 1, 45 and 75 seconds; the 59/60 and 3599/3600 carry boundaries; mixed hour-and-day combinations; zh/en agreement; and that sub-second values still round up in the existing consumer rather than displaying "0 seconds". Negative, `NaN` and `Infinity` reach the formatter only if called directly — the sole consumer clamps first and the runtime's retry metadata is a finite positive delay — so we did not raise those as findings.
Verification: the full `packages/ui` suite passes (202 tests / 29 suites), the focused `conversation-copy` test passes, and Biome plus `git diff --check` are clean on the changed files.
**On CI:** the run on this head is `action_required` at 0s — a fork-PR approval gate, not a failure, but it means nothing has actually executed. Worth a maintainer kicking it off; that is the only thing outstanding from our side.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "ARE404 (via GitHub)" <gi...@apache.org>.
ARE404 commented on code in PR #3402:
URL: https://github.com/apache/maka/pull/3402#discussion_r3839447171
##########
packages/ui/src/conversation-copy.ts:
##########
@@ -68,6 +68,54 @@ function formatGoalElapsedUnits(elapsedMs: number, units: GoalElapsedUnits): str
return `${Math.floor(hours / 24)}${units.day} ${hours % 24}${units.hour}`;
}
+/** Wall-clock units for the provider retry countdown, per locale. */
+interface ProviderRetryDelayUnits {
+ second: string;
+ minute: string;
+ hour: string;
+ day: string;
+ separator: string;
+}
+
+const PROVIDER_RETRY_DELAY_UNITS_ZH: ProviderRetryDelayUnits = {
+ second: '秒',
+ minute: '分',
+ hour: '小时',
+ day: '天',
+ separator: ' ',
+};
+const PROVIDER_RETRY_DELAY_UNITS_EN: ProviderRetryDelayUnits = {
+ second: 's',
+ minute: 'm',
+ hour: 'h',
+ day: 'd',
+ separator: ' ',
+};
+
+/**
+ * Humanized provider retry delay. A subscription quota window can hand the
+ * runtime an hour-scale Retry-After; a raw five-digit second count reads as a
+ * frozen hang, so the banner counts down in d/h/m/s units that keep moving
+ * every second (unlike the goal chip's minute-granularity ladder).
+ */
+function formatProviderRetryDelay(seconds: number, units: ProviderRetryDelayUnits): string {
Review Comment:
Cross-reference so this isn't read in isolation (see #3400 thread): the correct sequence for this feature line is **#3400 lands first, then #3402 rebases on top of it**. This PR is currently a sibling branch off `main`; both PRs edit the same `messages` `providerRetryScheduled` line in `conversation-copy.ts`, so merging this independently of #3400 will conflict as a pair. When rebased onto #3400, this banner should **reuse the shared d/h/m/s formatter** (the one #3400 establishes in `@maka/core`) instead of the local `formatProviderRetryDelay` copy — per the [P2] on line 101. Note #3400 is currently **NO-GO**: its `test` job fails on the protocol epoch guard (current `origin/main` epoch is **44**; the author must rebase to main and bump from 44). Treat this PR's green standalone `test` as necessary, not sufficient, for the line to merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3402:
URL: https://github.com/apache/maka/pull/3402#issuecomment-5392953997
感谢你把这个问题挖出来并给了完整的复现(`13565 秒后重试(2/10)` 那个例子很有说服力)。
这条我准备关掉,因为 #3611 已经覆盖了同样的改动并且走得更远:同样在 `packages/ui/src/conversation-copy.ts` 里加 `formatRetryDelay(seconds, locale)`、同样接进中英两处 `providerRetryScheduled`,另外还一并修了 CLI 侧的 `pi-transcript.ts`。#3611 目前已经 approve,我也帮它 rebase 到了最新 main,正在等 CI。
有一点你这边是有而 #3611 没有的:`packages/ui/src/__tests__/conversation-copy.test.ts` 里的单测。#3611 没带测试,如果你愿意把这几个用例单独提一条小 PR 补上去,我这边优先跟。
另外你的 #3400(倒计时,对应 #3393)和这条是两回事,那条我不动,继续正常 review。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3402:
URL: https://github.com/apache/maka/pull/3402#discussion_r3836002621
##########
packages/ui/src/conversation-copy.ts:
##########
@@ -49,6 +49,54 @@ function formatGoalElapsedUnits(elapsedMs: number, units: GoalElapsedUnits): str
return `${Math.floor(hours / 24)}${units.day} ${hours % 24}${units.hour}`;
}
+/** Wall-clock units for the provider retry countdown, per locale. */
+interface ProviderRetryDelayUnits {
+ second: string;
+ minute: string;
+ hour: string;
+ day: string;
+ separator: string;
+}
+
+const PROVIDER_RETRY_DELAY_UNITS_ZH: ProviderRetryDelayUnits = {
+ second: '秒',
+ minute: '分',
+ hour: '小时',
+ day: '天',
+ separator: ' ',
+};
+const PROVIDER_RETRY_DELAY_UNITS_EN: ProviderRetryDelayUnits = {
+ second: 's',
+ minute: 'm',
+ hour: 'h',
+ day: 'd',
+ separator: ' ',
+};
+
+/**
+ * Humanized provider retry delay. A subscription quota window can hand the
+ * runtime an hour-scale Retry-After; a raw five-digit second count reads as a
+ * frozen hang, so the banner counts down in d/h/m/s units that keep moving
+ * every second (unlike the goal chip's minute-granularity ladder).
+ */
+function formatProviderRetryDelay(seconds: number, units: ProviderRetryDelayUnits): string {
+ let remaining = Math.max(0, Math.floor(seconds));
+ const parts: string[] = [];
Review Comment:
`[P2]` This duplicates `formatElapsedDuration` in `packages/cli/src/pi-transcript.ts:1415` exactly — same unit table, same loop, same zero/empty tail, same separator. The only real difference is that the unit strings became a parameter so `zh` can supply its own.
Simpler equivalent solution, spelled out: hoist this ladder to a package both `ui` and `cli` can import, taking the unit strings and separator as the parameter you already designed here, then have `formatElapsedDuration` and `formatProviderRetryDelay` both call it. That also makes the `[P2]` on the TUI strip a one-line change instead of a third copy.
Acknowledging the cost honestly: this is a cross-package move, not a local import, so it is more work than it looks. Not a blocker — but with the ladder now written twice, the third copy is the one that will drift.
##########
packages/ui/src/conversation-copy.ts:
##########
@@ -49,6 +49,54 @@ function formatGoalElapsedUnits(elapsedMs: number, units: GoalElapsedUnits): str
return `${Math.floor(hours / 24)}${units.day} ${hours % 24}${units.hour}`;
}
+/** Wall-clock units for the provider retry countdown, per locale. */
+interface ProviderRetryDelayUnits {
+ second: string;
+ minute: string;
+ hour: string;
+ day: string;
+ separator: string;
+}
+
+const PROVIDER_RETRY_DELAY_UNITS_ZH: ProviderRetryDelayUnits = {
+ second: '秒',
+ minute: '分',
+ hour: '小时',
+ day: '天',
+ separator: ' ',
Review Comment:
`[P3]` `separator: ' '` is shared by both locales, so `zh` renders `4小时 28分 3秒后重试`. Chinese typography does not normally space between a number-unit group and the next one — `4小时28分3秒后重试` is the conventional form. Since `separator` is already per-locale in this interface, `zh` can just carry `''` and `en` keep `' '`; the test expectations would move with it.
Cosmetic, and a native reader should overrule me if they disagree.
##########
packages/ui/src/__tests__/conversation-copy.test.ts:
##########
@@ -0,0 +1,27 @@
+import assert from 'node:assert/strict';
+import { test } from 'node:test';
+import { getConversationCopy } from '../conversation-copy.js';
+
+/**
+ * A subscription quota window can hand the runtime an hour-scale Retry-After;
+ * the banner must count down in humanized d/h/m/s units rather than a raw
+ * five-digit second count that reads as a frozen hang.
+ */
+test('providerRetryScheduled humanizes hour-scale delays in both locales', () => {
+ const zh = getConversationCopy('zh').messages.providerRetryScheduled;
+ const en = getConversationCopy('en').messages.providerRetryScheduled;
+
+ // Short delays keep the familiar seconds-only form.
+ assert.equal(zh(1, 2, 10), '1秒后重试(2/10)');
+ assert.equal(en(1, 2, 10), 'Retrying in 1s (2/10)');
+ assert.equal(zh(45, 2, 10), '45秒后重试(2/10)');
+ assert.equal(en(45, 2, 10), 'Retrying in 45s (2/10)');
Review Comment:
`[P3]` The description says short delays “keep the familiar seconds-only form (`45秒后重试`)”, but the previous `zh` copy was `${seconds} 秒后重试` — with a space before `秒`. This assertion pins `'45秒后重试(2/10)'`, so the short-delay `zh` string does change, just subtly.
I think dropping the space is the better copy and I am not asking you to restore it. Only flagging that the description says this path is unchanged when it is not, so a reader diffing screenshots is not left confused.
Separately, and to the test's credit: pinning both locales across second/minute/hour/day scales is exactly the right shape here — it fails if the ladder regresses, rather than restating the implementation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3402:
URL: https://github.com/apache/maka/pull/3402#issuecomment-5383963571
Heads up on CI: the workflow run for this PR was sitting in `action_required` (fork PRs need a maintainer to approve the run), so it had never actually executed. I approved it — it has now run on `efd19dbfa0fa862da71777b6b1d527ea48ead849` and came back **red**.
**Failing step:** `Check ASF source headers`
```
1 file(s) are missing the ASF license header. Run `npm run write:asf-headers`:
packages/ui/src/__tests__/conversation-copy.test.ts
```
Fix:
```
npm run write:asf-headers
```
**Worth flagging:** this step runs early in the job, so everything after it — build, typecheck, and the whole test suite — was reported as `skipped` rather than passing. The red header check is not evidence that the rest is fine; those steps never ran.
The review conclusion from our side is unchanged and still stands on this head. Once the header is added and CI is green we'll approve.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han closed pull request #3402: fix(ui): humanize provider retry delay in the banner copy
URL: https://github.com/apache/maka/pull/3402
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): humanize provider retry delay in the banner copy [maka]
Posted by "ARE404 (via GitHub)" <gi...@apache.org>.
ARE404 commented on code in PR #3402:
URL: https://github.com/apache/maka/pull/3402#discussion_r3839441133
##########
packages/ui/src/conversation-copy.ts:
##########
@@ -68,6 +68,54 @@ function formatGoalElapsedUnits(elapsedMs: number, units: GoalElapsedUnits): str
return `${Math.floor(hours / 24)}${units.day} ${hours % 24}${units.hour}`;
}
+/** Wall-clock units for the provider retry countdown, per locale. */
+interface ProviderRetryDelayUnits {
+ second: string;
+ minute: string;
+ hour: string;
+ day: string;
+ separator: string;
+}
+
+const PROVIDER_RETRY_DELAY_UNITS_ZH: ProviderRetryDelayUnits = {
+ second: '秒',
+ minute: '分',
+ hour: '小时',
+ day: '天',
+ separator: ' ',
+};
+const PROVIDER_RETRY_DELAY_UNITS_EN: ProviderRetryDelayUnits = {
+ second: 's',
+ minute: 'm',
+ hour: 'h',
+ day: 'd',
+ separator: ' ',
+};
+
+/**
+ * Humanized provider retry delay. A subscription quota window can hand the
+ * runtime an hour-scale Retry-After; a raw five-digit second count reads as a
+ * frozen hang, so the banner counts down in d/h/m/s units that keep moving
+ * every second (unlike the goal chip's minute-granularity ladder).
+ */
+function formatProviderRetryDelay(seconds: number, units: ProviderRetryDelayUnits): string {
Review Comment:
[P2] This adds a second, local copy of the d/h/m/s humanizer, but the same feature line (#3400) deliberately extracted/shared that computation into `@maka/core` precisely because "the two client copies drifted apart at the expiry floor" (see the #3393 commit message and `provider-retry-countdown.ts`). I verified this `formatProviderRetryDelay` is byte-for-byte identical to `formatElapsedDuration` (CLI) across a 0–200k second sweep, so today they agree — but keeping two parallel formatters reintroduces the exact divergent-copy risk this work set out to remove. Please reuse the shared formatter (ideally export one canonical duration formatter from `@maka/core` and have both the CLI strip and this banner call it) instead of a second local implementation.
##########
packages/ui/src/conversation-copy.ts:
##########
@@ -469,7 +517,7 @@ const CONVERSATION_COPY = {
chooseAriaLabel: (label, branch) => branch ? `选择项目:${label},当前分支 ${branch}` : `选择项目:${label}`,
},
messages: {
- you: '你', assistant: 'Maka', processing: '正在处理…', continuing: '继续中…', workingPhrases: ['正在琢磨…', '正在推敲…', '正在盘算…', '正在钻研…', '正在忙活…', '正在梳理…', '正在打磨…', '正在鼓捣…', '正在酝酿…', '正在攻坚…', '正在权衡…', '正在拾掇…'], providerRetryScheduled: (seconds, attempt, maxAttempts) => `${seconds} 秒后重试(${attempt}/${maxAttempts})`, providerRetryStarted: (attempt, maxAttempts) => `正在重试(${attempt}/${maxAttempts})`, providerRetryReason: { network: '网络中断', provider_capacity: '模型服务暂时满载', provider_unavailable: '模型服务暂时不可用', rate_limit: '触发模型速率限制', timeout: '请求超时', unknown: '模型请求失败' }, safeResumePending: '正在验证…', safeResume: '安全恢复', thinking: '深度思考', truncated: '已截断', copied: '已复制', copying: '复制中', copyFailed: '复制失败', copy: '复
制', editMessage: '编辑并重发', editMessageDisabledRunning: '当前回答仍在进行中,结束后再编辑', editMessageDisabledAttachments: '包含附件的历史消息暂不支持编辑并重发', editMessageDisabledQuotes: '包含引用的历史消息暂不支持编辑并重发', editMessageDisabledTransformedText: '通过显式技能发送的历史消息暂不支持编辑并重发',
+ you: '你', assistant: 'Maka', processing: '正在处理…', continuing: '继续中…', workingPhrases: ['正在琢磨…', '正在推敲…', '正在盘算…', '正在钻研…', '正在忙活…', '正在梳理…', '正在打磨…', '正在鼓捣…', '正在酝酿…', '正在攻坚…', '正在权衡…', '正在拾掇…'], providerRetryScheduled: (seconds, attempt, maxAttempts) => `${formatProviderRetryDelay(seconds, PROVIDER_RETRY_DELAY_UNITS_ZH)}后重试(${attempt}/${maxAttempts})`, providerRetryStarted: (attempt, maxAttempts) => `正在重试(${attempt}/${maxAttempts})`, providerRetryReason: { network: '网络中断', provider_capacity: '模型服务暂时满载', provider_unavailable: '模型服务暂时不可用', rate_limit: '触发模型速率限制', timeout: '请求超时', unknown: '模型请求失败' }, safeResumePending: '正在验证…', safeResume: '安全恢复', thinking: '深度思考', truncated: '已截断', copied: '已复制', copying
: '复制中', copyFailed: '复制失败', copy: '复制', editMessage: '编辑并重发', editMessageDisabledRunning: '当前回答仍在进行中,结束后再编辑', editMessageDisabledAttachments: '包含附件的历史消息暂不支持编辑并重发', editMessageDisabledQuotes: '包含引用的历史消息暂不支持编辑并重发', editMessageDisabledTransformedText: '通过显式技能发送的历史消息暂不支持编辑并重发',
Review Comment:
[P3] Minor copy note: this bundles a display change beyond pure humanization — the Chinese banner drops the space (`45 秒后重试` → `45秒后重试`) and, for range-y totals, produces tokens like `4小时 28分 3秒后重试` where the embedded spaces around CJK units read a little loose right before `后重试` (`4小时28分3秒后重试` would read tighter). Also worth a sentence in the PR description that the zh string format changed alongside the humanization. Not blocking.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org