Skip to content

fix(minimax): fall back to remaining_percent when count fields are zero#172

Closed
ASF-E-OBJECTTOOBIG wants to merge 1 commit into
slkiser:mainfrom
ASF-E-OBJECTTOOBIG:fix/minimax-percent-fallback
Closed

fix(minimax): fall back to remaining_percent when count fields are zero#172
ASF-E-OBJECTTOOBIG wants to merge 1 commit into
slkiser:mainfrom
ASF-E-OBJECTTOOBIG:fix/minimax-percent-fallback

Conversation

@ASF-E-OBJECTTOOBIG

Copy link
Copy Markdown

Summary

MiniMax's international Coding Plan endpoint now returns current_interval_total_count: 0 / current_interval_usage_count: 0for thegeneralandvideorows, with actual usage carried incurrent_interval_remaining_percent/current_weekly_remaining_percent(pluscurrent_*_status` for limit state).

The current parser drops any record with total <= 0, so affected users see no reportable MiniMax Coding Plan quota.

This is the follow-up to #150 — that fix added the general/video model-name match but assumed counts would still be populated. This PR:

  1. Adds a getPercentRemaining accessor to each entry in MINIMAX_WINDOW_SPECS reading current_interval_remaining_percent / current_weekly_remaining_percent.
  2. Rewrites buildMiniMaxEntry so that when count fields are missing/zero, it falls back to the percent field instead of returning null. The count-based path is preserved unchanged for any response shape that still populates totals.
  3. Relaxes isMiniMaxModelRecord to accept a record with current_interval_remaining_percent even when count fields are absent, hardening against further API drift.

The percent path reuses the existing roundPercent helper, matching upstream's "negative percentages allowed" contract.

Linked Issue

Fixes #171

OpenCode Validation

  • Current production released OpenCode version tested: 1.17.11
  • Why this version is relevant to the fix: this is the version running against the patched plugin locally during validation. Local diff applied against dist/providers/minimax-coding-plan.js (v3.11.2) confirmed /quota_status now reports five_hour_usage: 14% remaining and weekly_usage: 10% remaining for the user's actual MiniMax API payload.

Quality Checklist

  • I ran pnpm run typecheck
  • I ran pnpm test
  • I ran pnpm run build
  • This is the smallest safe root-cause fix (no unnecessary hook/output mutation logic)
  • I preserved behavioral invariants and updated/added boundary tests as needed
  • I updated docs for user-facing workflow/command/config changes (README.md and CONTRIBUTING.md when applicable)
  • For new API-key/token providers, I started from contributing/provider-template/ or explained why the template does not apply
  • For provider setup/auth wording changes, I checked the relevant dummy .ts template in contributing/provider-template/ and verified README.md against src/lib/provider-metadata.ts (authentication/authFallbacks) and provider auth resolver/diagnostics behavior

MiniMax's international Coding Plan API now returns
current_interval_total_count: 0 and current_interval_usage_count: 0 for the
general/video rows, with usage carried in
current_interval_remaining_percent and current_weekly_remaining_percent.

The previous parser dropped any record with total <= 0, surfacing
"no reportable MiniMax Coding Plan quota" on /quota and /quota_status.

- Add getPercentRemaining accessor to each entry in MINIMAX_WINDOW_SPECS.
- Rewrite buildMiniMaxEntry to fall back to the percent field when count
  fields are missing or zero. The count-based path is unchanged.
- Relax isMiniMaxModelRecord to accept records with
  current_interval_remaining_percent even when count fields are absent.

Closes the follow-up to the model-name fix in v3.11.1 (general/video
matching).
@slkiser

slkiser commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix and validation. This was integrated into v4.0.1, including the remaining-percentage fallback for zero-count MiniMax responses. Closing this PR as completed.

@slkiser slkiser closed this Jul 22, 2026
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.

[bug]: MiniMax international Coding Plan quota shows "no reportable" when count fields are zero

2 participants