Repository navigation
fix(coding-plans): classify missing MiniMax quota rows as an inactive plan - #6215
Conversation
MiniMax stopped returning a parseable `general` row on the gateway host for managed Token Plan keys on 2026-09-13. Every usage lookup then threw `invalid_response`, the router returned 502, and the subscription page showed "Current quota is temporarily unavailable". Query the documented `www.minimax.io` host first and keep `api.minimax.io` as a fallback. Accept the aggregate pool when MiniMax reports it as `MiniMax-M*`, and clamp an out-of-range remaining percent instead of discarding the response.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous Review Summaries (2 snapshots, latest commit 012b6d2)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 012b6d2)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit 9479953)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe MiniMax quota hardening is directionally sound, but the new Overview
Issue Details (click to expand)WARNING
Files Reviewed (3 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
… plan MiniMax returns HTTP 200 with `base_resp.status_code: 0` and `model_remains: null` for a managed key whose Token Plan is not usable. The response schema rejected `null`, so every lookup threw `invalid_response` and `codingPlans.getUsage` returned 502. Accept `null` and report the empty case with a distinct `subscription_inactive` code, so support can separate a provider plan problem from a parse failure. This supersedes the endpoint change in the previous commit. A live probe shows both hosts return identical data, so the endpoint stays as it was.
An omitted `model_remains` key now maps to `invalid_response`. Only the documented `null` and empty-array shapes report an inactive plan. A non-zero application status without rows still maps to `application`. Rename `subscription_inactive` to `provider_plan_inactive`. The adapter runs only for active and past_due subscriptions, so the old label misdescribed the condition in logs.
Finding
The first diagnosis was wrong. A live probe with the production read replica and
BYOK_ENCRYPTION_KEYshows the actual shape:{"model_remains":null,"base_resp":{"status_code":0}}fromGET /v1/token_plan/remains.www.minimax.ioandapi.minimax.ioreturn identical data. The endpoint was never the problem.model_remainswith ageneralrow and percent fields, so the aggregate name and the percent fields are unchanged.MiniMax holds no quota rows for these keys and rejects inference on them. That part is upstream.
Kilo defect
model_remainsused.optional(), which acceptsundefinedbut notnull. Every affected lookup therefore threwinvalid_response, andcodingPlans.getUsagereturned 502. The page showed "Current quota is temporarily unavailable".Change
model_remains: null.subscription_inactiveerror code, so logs separate a provider plan problem from a parse failure.The endpoint, aggregate row selection, and percent handling are unchanged.
Verification
npx jest src/lib/coding-plans src/routers/coding-plans-router.test.ts: 9 suites, 122 tests pass.tsgo --noEmitexit 0.oxlintclean.oxfmtapplied.model_remains: null; 7/8 sampled unassigned inventory keys returned active plans.Remaining work
This change does not restore service, because MiniMax has no usable plan for the affected keys. Unblocking them needs key replacement and a MiniMax escalation. Replacement is viable: 7 of 8 sampled unassigned inventory keys still hold an active plan.