Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(pi): 未分类重试不再复用过载进度标记

Dashe7c1624c1565
diff --git a/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx b/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx
index 88aaa25b7c..be4f0a7f15 100644
--- a/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx
@@ -208,31 +208,3 @@ describe('ErrorBanner terminal rate-limit retry guidance', () => {
expect(screen.getByText(RATE_LIMIT)).toBeTruthy();
});
});
-
-describe('ErrorBanner generic provider auto-retry guidance', () => {
- const GENERIC = 'provider 500 from upstream (auto-retry 2/3)';
-
- it('localizes unclassified recoverable auto-retries instead of showing the protocol string', () => {
- render(createElement(ErrorBanner, {
- error: GENERIC,
- onRetry: vi.fn(),
- isRecoverable: true,
- }));
-
- expect(screen.getByText('chat.errorBanner.providerRetrying:2/3')).toBeTruthy();
- expect(screen.queryByText('chat.errorBanner.overloadRetrying:2/3')).toBeNull();
- expect(screen.queryByText(GENERIC)).toBeNull();
- expect(screen.queryByTitle('chat.errorBanner.retryTitle')).toBeNull();
- });
-
- it('keeps the raw provider error available for unclassified auto-retries', () => {
- render(createElement(ErrorBanner, {
- error: GENERIC,
- onRetry: vi.fn(),
- isRecoverable: true,
- }));
-
- fireEvent.click(screen.getByText('chat.errorBanner.networkShowRaw'));
- expect(screen.getByText(GENERIC)).toBeTruthy();
- });
-});
diff --git a/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx b/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx
index 7376a7dec2..69fb6b1fe9 100644
--- a/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx
+++ b/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx
@@ -372,13 +372,6 @@ export function ErrorBanner({
? 'chat.errorBanner.networkUnreachable'
: 'chat.errorBanner.networkUnreachableNoRetry',
);
- } else if (isRecoverable && overloadRetryProgress) {
- // Pi 等 agent 的瞬时供应商重试走同一套 `(auto-retry N/M)` 后缀,但原文未必能被
- // 过载/网络分支识别。没有这条兜底时,用户会直接看到英文协议串。
- displayError = t('chat.errorBanner.providerRetrying', {
- attempt: overloadRetryProgress.attempt,
- maxAttempts: overloadRetryProgress.maxAttempts,
- });
} else {
// Keep the raw message available to every specialized gate above. Only
// the final fallback uses the stable reason map, so auth/network/overload
@@ -524,7 +517,6 @@ export function ErrorBanner({
{(isNetworkishError ||
isOverloadError ||
terminalRateLimitRetryProgress ||
- Boolean(isRecoverable && overloadRetryProgress) ||
isClaudeGatewayOpusPlanMismatch ||
isClaudeSubscriptionOpusPlanMismatch) && (
// 网络类与过载类的原始错误折叠可查:友好文案替换了原文,但排障(端口/URL/
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 2968353e0d..3dbfa71296 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -6227,7 +6227,6 @@
"networkReconnecting": "Connection interrupted — reconnecting ({{attempt}}/{{maxAttempts}})…",
"overloadRetrying": "The model service is busy — retrying automatically ({{attempt}}/{{maxAttempts}})…",
"rateLimitRetrying": "Request rate limited — retrying automatically ({{attempt}}/{{maxAttempts}})…",
- "providerRetrying": "The service is temporarily unavailable — retrying automatically ({{attempt}}/{{maxAttempts}})…",
"overloadBusy": "The model service is busy — the upstream has no capacity right now. Click \"Retry\", or switch to another model.",
"overloadBusyNoRetry": "The model service is busy — the upstream has no capacity right now. Try again later, or switch to another model.",
"networkShowRaw": "Show raw error",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index b77cc9338f..3ff84b50d4 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -6224,7 +6224,6 @@
"networkReconnecting": "接続が中断されました。再接続中({{attempt}}/{{maxAttempts}})…",
"overloadRetrying": "モデルサービスが混雑しています:自動的に再試行しています({{attempt}}/{{maxAttempts}})…",
"rateLimitRetrying": "リクエストがレート制限されました。自動的に再試行しています({{attempt}}/{{maxAttempts}})…",
- "providerRetrying": "サービスが一時的に利用できません。自動的に再試行しています({{attempt}}/{{maxAttempts}})…",
"overloadBusy": "モデルサービスが混雑しています。上流に空き容量がありません。「再試行」を押すか、別のモデルに切り替えてください",
"overloadBusyNoRetry": "モデルサービスが混雑しています。上流に空き容量がありません。しばらくしてから再試行するか、別のモデルに切り替えてください",
"networkShowRaw": "元のエラーを表示",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 4fc3a09172..114c479548 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -6224,7 +6224,6 @@
"networkReconnecting": "연결이 끊어졌습니다. 다시 연결하는 중({{attempt}}/{{maxAttempts}})…",
"overloadRetrying": "모델 서비스가 혼잡합니다. 자동으로 다시 시도하는 중({{attempt}}/{{maxAttempts}})…",
"rateLimitRetrying": "요청이 속도 제한에 걸렸습니다. 자동으로 다시 시도하는 중({{attempt}}/{{maxAttempts}})…",
- "providerRetrying": "서비스를 일시적으로 사용할 수 없습니다. 자동으로 다시 시도하는 중({{attempt}}/{{maxAttempts}})…",
"overloadBusy": "모델 서비스가 혼잡합니다. 상위 서비스에 여유 용량이 없습니다. \"재시도\"를 누르거나 다른 모델로 바꿔 보세요",
"overloadBusyNoRetry": "모델 서비스가 혼잡합니다. 상위 서비스에 여유 용량이 없습니다. 잠시 후 다시 시도하거나 다른 모델로 바꿔 보세요",
"networkShowRaw": "원본 오류 보기",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 9acd4fd2d4..23253eb3a4 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -6224,7 +6224,6 @@
"networkReconnecting": "网络连接中断,正在重新连接({{attempt}}/{{maxAttempts}})…",
"overloadRetrying": "模型服务繁忙,正在自动重试({{attempt}}/{{maxAttempts}})…",
"rateLimitRetrying": "请求受到限流,正在自动重试({{attempt}}/{{maxAttempts}})…",
- "providerRetrying": "服务暂时异常,正在自动重试({{attempt}}/{{maxAttempts}})…",
"overloadBusy": "模型服务繁忙,上游暂时没有可用容量。可点击「重试」,或换一个模型。",
"overloadBusyNoRetry": "模型服务繁忙,上游暂时没有可用容量。可稍后重试,或换一个模型。",
"networkShowRaw": "查看原始错误",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index cbc17539f2..00dac4d299 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -6224,7 +6224,6 @@
"networkReconnecting": "網路連線中斷,正在重新連線({{attempt}}/{{maxAttempts}})…",
"overloadRetrying": "模型服務繁忙,正在自動重試({{attempt}}/{{maxAttempts}})…",
"rateLimitRetrying": "請求受到限流,正在自動重試({{attempt}}/{{maxAttempts}})…",
- "providerRetrying": "服務暫時異常,正在自動重試({{attempt}}/{{maxAttempts}})…",
"overloadBusy": "模型服務繁忙,上游暫時沒有可用容量。可點選「重試」,或換一個模型。",
"overloadBusyNoRetry": "模型服務繁忙,上游暫時沒有可用容量。可稍後重試,或換一個模型。",
"networkShowRaw": "檢視原始錯誤",
diff --git a/docs/product-rules/telegram-bot-parity.md b/docs/product-rules/telegram-bot-parity.md
index 209289bcfc..d10c416964 100644
--- a/docs/product-rules/telegram-bot-parity.md
+++ b/docs/product-rules/telegram-bot-parity.md
@@ -49,6 +49,7 @@ Cindy 有两个 Telegram bot,用户看到的是同一个产品:
| 交互卡的**语义层**(`ask_user_question` / `plan_review` / 权限确认) | `im/shared/interactionCardModel.ts` | 选项集与决策模型两侧真跑同一份:至多 6 个选项(`MAX_OPTIONS`)、multiSelect 降级单选、只渲染第一问、plan 正文截断 1500(`MAX_PLAN_LEN`)、按钮文案的**产品级**上限 30(`BTN_LABEL_MAX`)、无选项降级时唯一按钮「继续」,以及 buttonId → 决策对象的构造与 header/body 拆分。官方那条链路由 `hook-control/interactions.ts` 直接 import 本模块(对 `@cindy/maker-core` 刻意只做 type-only 依赖,免得 hook 链路在运行期加载整个 barrel)。**渲染不在这里**——按钮文案来源、标题格式、省略号样式、尺寸上限都是各自渲染侧的事,见第三节 |
| **计划对账注入**(plan reconcile) | `maker-ipc/planReconcile.ts`(`summarizeOpenPlan` + `buildPlanReconcileNote`) | 两侧在真实用户轮次发送前查询未收口计划并前置对账说明。官方侧:`hook-control/session-runner.ts`(仅 `req.source?.im` 存在时注入,自动派发不注入);个人侧:`im/shared/turnRunner.ts`。两侧共用同一份查询与文案构造,差异仅在"什么算普通用户轮次"的判定各走各的来源分类 |
| 群消息本地库的**保留策略** | `im/shared/groupWindowCore.ts` | 上限数值(每命名空间 1 GiB 正文 + 500 万行安全阀)、回收低水位(0.9)与回收实现都在这一处;两侧把同一份 `DEFAULT_GROUP_WINDOW_RETENTION` 传进同一个 `recordGroupWindowEntry`。**额度靠 provider 命名空间隔离**:官方 `telegram:<principalId>`、个人 `telegram-personal:<botId>`,统计与回收都按 provider 过滤,两个账号各算各的、消息不串。一个边界要记住:两侧各持有一份 `{ ...DEFAULT }` **可变副本**(为的是测试能用小阈值把回收逼出来),所以共享的是"模块初始化时的那组数字",运行期改一侧不会传导到另一侧 |
+| **上游过载 / 限流自动重试进度** | `im/shared/turnRetryNotice.ts`(`turnRetryNotice`) | 非终止 error 翻成渠道进度的**文案与判定**两侧真跑这一份:只认过载(`(auto-retry N/M)` + `upstream-overload` / 529)、终态 429 外层重投、以及 Auto 档审阅器不可用。Pi / Claude / Codex 过载重试都走「模型服务繁忙,正在自动重试(N/M)」;其它非终止 error(普通 5xx、未分类供应商抖动)保持静默。个人侧 `turnRunner`、官方侧 `turnPresenter` 都读这一份。**载体怎么发**不在这里——个人是过程消息原地编辑,官方私聊是草稿,见第三节 |
### 放在共享目录、但**只有一侧消费**的
diff --git a/packages/maker-core/src/agents/pi/__tests__/pi-translator.test.ts b/packages/maker-core/src/agents/pi/__tests__/pi-translator.test.ts
index c38733bacd..dcc67f48bf 100644
--- a/packages/maker-core/src/agents/pi/__tests__/pi-translator.test.ts
+++ b/packages/maker-core/src/agents/pi/__tests__/pi-translator.test.ts
@@ -282,7 +282,7 @@ describe('pi translator', () => {
]);
});
- it('keeps unclassified Pi auto-retries on the shared progress suffix', () => {
+ it('keeps unclassified Pi auto-retries silent instead of reusing the overload marker', () => {
const ctx = createPiTranslateContext(noopLogger);
const { queue, events } = makeQueue();
@@ -297,12 +297,7 @@ describe('pi translator', () => {
ctx,
);
- expect(events[0]?.data).toMatchObject({
- message: 'provider 500 from upstream (auto-retry 2/3)',
- isTerminal: false,
- willRetry: true,
- });
- expect((events[0]?.data as { reason?: string }).reason).toBeUndefined();
+ expect(events.filter((event) => event.type === 'error')).toHaveLength(0);
});
it('does not duplicate a terminal error after Pi auto-retry is exhausted', () => {
diff --git a/packages/maker-core/src/agents/pi/translator.ts b/packages/maker-core/src/agents/pi/translator.ts
index 396a8ba7ce..717538400d 100644
--- a/packages/maker-core/src/agents/pi/translator.ts
+++ b/packages/maker-core/src/agents/pi/translator.ts
@@ -594,12 +594,13 @@ export function translatePiEvent(
}
case 'auto_retry_start': {
- // 走 CC/Codex 同一套 `(auto-retry N/M)` 跨 agent 协议:ErrorBanner 靠这个后缀切本地化重试文案,手写
- // `Transient provider error, retrying (1/3)…` 会跌出过载/网络分支,把原始英文
- // 塞进红色错误条。
+ // 走 CC/Codex 同一套 `(auto-retry N/M)` 跨 agent 协议。这个后缀在 mobile /
+ // Telegram 投影里**只表示过载**,不能拿去编码未分类 5xx —— 否则手机会把普通
+ // 供应商故障显示成「模型服务繁忙」。
//
// 第 1 次不透出:单次抖动 pi 一次重试就过,提示只会闪一下徒增噪音
// (与 claude-code translator 的 api_retry 防噪口径一致)。
+ // 未分类错误同样静默:渠道 / 手机没有对应本地化契约,CC 也只透过载类。
const progress = parsePiAutoRetryProgress(event);
if (!progress || progress.attempt < 2) return;
const sdkError = typeof event.errorMessage === 'string'
@@ -607,19 +608,19 @@ export function translatePiEvent(
: undefined;
const rawMessage = (sdkError && sdkError.trim())
|| ctx.pendingAssistantError?.message
- || 'Transient provider error';
+ || '';
const signals = extractNonSecretErrorSignals(rawMessage);
const errorStatus = ctx.pendingAssistantError?.errorStatus ?? signals.errorStatus;
- const overload = parseOverloadError(rawMessage, errorStatus);
+ if (parseOverloadError(rawMessage, errorStatus) === null) return;
queue.push({
type: 'error',
data: {
message: formatOverloadRetryMessage(rawMessage, progress.attempt, progress.maxAttempts),
isTerminal: false,
willRetry: true,
+ reason: UPSTREAM_OVERLOAD_REASON,
...(sdkError ? { sdkError } : {}),
...(errorStatus !== undefined ? { errorStatus } : {}),
- ...(overload ? { reason: UPSTREAM_OVERLOAD_REASON } : {}),
},
source: 'pi',
});