



















@@ -380,6 +380,13 @@ function buildRateLimitCooldownMessage(err: unknown): string {
380380if (codexUsageLimitMessage) {
381381return codexUsageLimitMessage;
382382}
383+if (isFallbackSummaryError(err) && hasBillingAttemptSummary(err)) {
384+return BILLING_ERROR_USER_MESSAGE;
385+}
386+const message = formatErrorMessage(err);
387+if (isBillingErrorMessage(message)) {
388+return BILLING_ERROR_USER_MESSAGE;
389+}
383390if (!isFallbackSummaryError(err)) {
384391return "⚠️ All models are temporarily rate-limited. Please try again in a few minutes.";
385392}
@@ -448,11 +455,11 @@ function isPureTransientRateLimitSummary(err: unknown): boolean {
448455);
449456}
450457451-function isPureBillingSummary(err: unknown): boolean {
458+function hasBillingAttemptSummary(err: unknown): boolean {
452459return (
453460isFallbackSummaryError(err) &&
454461err.attempts.length > 0 &&
455-err.attempts.every((attempt) => attempt.reason === "billing")
462+err.attempts.some((attempt) => attempt.reason === "billing")
456463);
457464}
458465@@ -625,7 +632,7 @@ export function buildKnownAgentRunFailureReplyPayload(params: {
625632const message = formatErrorMessage(params.err);
626633const isFallbackSummary = isFallbackSummaryError(params.err);
627634const isBilling = isFallbackSummary
628- ? isPureBillingSummary(params.err)
635+ ? hasBillingAttemptSummary(params.err)
629636 : isBillingErrorMessage(message);
630637if (isBilling) {
631638return markAgentRunFailureReplyPayload({
@@ -2263,7 +2270,7 @@ export async function runAgentTurnWithFallback(params: {
22632270}
22642271const message = formatErrorMessage(err);
22652272const isBilling = isFallbackSummaryError(err)
2266- ? isPureBillingSummary(err)
2273+ ? hasBillingAttemptSummary(err)
22672274 : isBillingErrorMessage(message);
22682275const isContextOverflow = !isBilling && isLikelyContextOverflowError(message);
22692276const isCompactionFailure = !isBilling && isCompactionFailureError(message);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。