Skip to content

fix(acp-registry): Kimi quota exhaustion now reports as Limited instead of Failed - #45401

Closed
caopulan wants to merge 1 commit into
pingdotgg:mainfrom
caopulan:fix/kimi-usage-limit-classification
Closed

caopulan wants to merge 1 commit into
pingdotgg:mainfrom
caopulan:fix/kimi-usage-limit-classification

Conversation

@caopulan

Copy link
Copy Markdown

When Kimi Code hits its 5-hour usage limit, it closes the turn in wire.jsonl with code: "provider.api_error", name: "APIProviderQuotaExhaustedError", and details.statusCode: 429 instead of code: "provider.rate_limit". Because kimiAcp.ts only checked code === "provider.rate_limit", T3 classified these turns as provider_error and showed them as Failed instead of Limited (blocking usage-limit recovery UX).

Fix

  • Decode error.name and error.details.statusCode in KimiTurnEnded (packages/provider-acp-registry/src/server/kimiAcp.ts) and classify provider.rate_limit / provider.quota_exhausted, HTTP 429, QuotaExhausted / RateLimit error names, and usage-limit refusal text as usage_limit (while explicitly keeping HTTP 402 billing/balance errors as provider_error).
  • Also classify Kimi usage-limit messages in acpRegistryPromptFailure (packages/provider-acp-registry/src/server/adapter.ts) for direct ACP RPC rejections, including local kimi installs.

How I found and verified it

Hit Kimi Code's 5-hour quota across four active kimi-code/k3.1-pro threads; all four showed Failed (Provider error) in the sidebar and timeline. Inspecting each session's ~/.kimi-code/sessions/.../agents/main/wire.jsonl showed the exact turn.ended record:

{
  "type": "turn.ended",
  "agentId": "main",
  "reason": "failed",
  "error": {
    "code": "provider.api_error",
    "message": "You've reached your 5-hour usage limit. Your quota will reset when the current 5-hour window ends. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/settings/subscription?tab=quota",
    "name": "APIProviderQuotaExhaustedError",
    "details": { "requestId": null, "statusCode": 429, "traceId": "..." },
    "retryable": false
  },
  "continuation": "none"
}

Replayed this exact record (along with generic HTTP 429, message-only fallback, HTTP 402 billing exclusion, and ACP RPC rejection) through makeKimiPromptOutcomeWatch and acpRegistryPromptFailure, and ran vp run check:changed on upstream/main:

  • vp format, vp lint, vp knip, vp graphql (apps/server), vp typecheck (10 packages): all pass
  • vp test: 58 passed across packages/provider-acp-registry/src/server/kimiAcp.test.ts, apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts, and apps/server/src/provider/AgentContextBudget.test.ts

Written with Gemini 4 Neon in the Antigravity harness via T3 Code.

@macroscopeapp

macroscopeapp Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 86065c1

Macroscope's review found this PR approvable — Kimi quota exhaustion now uses existing usage-limit handling so affected turns appear as Limited rather than generic failures. The change is narrowly scoped to Kimi error classification and preserves retryability.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. T3 Code's ACP Registry support follows the ACP spec: the code every agent shares takes no changes that are specific to one agent, and the special cases already there are not a precedent for more (how providers are integrated).

This expands Kimi-only handling in the generic ACP Registry adapter: it interprets additional fields from Kimi’s private session log and recognizes quota refusal text only for Kimi. That conflicts with the ACP integration policy, even though the existing adapter already contains Kimi exceptions.

The reported Failed-versus-Limited problem is useful evidence. Please bring the quota-error reporting requirement to ACP upstream so agents can expose it through a shared protocol capability; T3 can then classify those errors for every compliant agent.

ACP has no shared way to do this yet. The place to propose one is ACP upstream, the Agent Client Protocol project itself, so that every agent can offer it and T3 Code can support it once for all of them.

Closing.

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.

2 participants