feat(minimax): refresh Token Plan usage display#472
Conversation
- Extend isSessionUsageName to match M2.7, M2.7-highspeed, minimax_m patterns - Rename pickGlobalSessionRemainItem to pickSessionRemainItem for CN reuse - Apply session bucket selection to both GLOBAL and CN paths (was GLOBAL only) - Remove unused endpointSelection parameter from classifyUsageEntry - Update inferRemainsMs comment to reflect actual behavior (not just 5h Coding Plan) - Add regression test for CN path with companion bucket appearing first Fixes PR robinebers#317 review comments on session bucket selection
There was a problem hiding this comment.
Pull request overview
Follow-up to PR #317 fixing MiniMax plugin issues: expanding the session-bucket detection patterns, applying session-bucket selection to CN (not just GLOBAL), correcting a stale comment in inferRemainsMs, and adding a CN regression test.
Changes:
- Extend
isSessionUsageNamepatterns (m2.7,minimax_m) and applyorderRemainItemsForDisplayin CN path. - Update
inferRemainsMsto accept an explicitexpectedWindowMsand drop the inaccurate "Coding Plan resets every 5h" assumption. - Add CN-region regression test asserting the session entry is picked when a companion bucket appears first.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates MiniMax bullet to mention model-calls and CN TTS/image buckets. |
| docs/providers/minimax.md | Documents new model-calls display, six-tier plan naming, CN endpoint, and companion-resource lines. |
| plugins/minimax/plugin.json | Adds detail-scope lines for TTS HD/Turbo, Image Generation, and image-01. |
| plugins/minimax/plugin.js | Refactors parser to emit multiple resource entries, infer plans via companion quotas, normalize CN endpoint order, and parameterize inferRemainsMs window. |
| plugins/minimax/plugin.test.js | Adds extensive new tests for CN/GLOBAL companion buckets, session ordering, plan inference, and remains_time handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - [**Kiro**](docs/providers/kiro.md) / credits, bonus credits, overages | ||
| - [**Kimi Code**](docs/providers/kimi.md) / session, weekly | ||
| - [**MiniMax**](docs/providers/minimax.md) / coding plan session | ||
| - [**MiniMax**](docs/providers/minimax.md) / coding plan session model-calls, CN TTS/image buckets |
Update all references from CODING_PLAN_* constants to TOKEN_PLAN_* for consistency with MiniMax API rename. Also normalize "MiniMax Coding Plan" to "Token Plan" alongside existing "token plan" handling.
Add 8 new tests covering: - M2.7 and M2.7-highspeed session bucket classification - speech-hd and image-01 NOT classified as session - session bucket selected by name pattern, not order (GLOBAL + CN) - 5h token-plan window for session remains_time inference - daily window for non-session companion buckets Also fix isSessionUsageName to include highspeed pattern per official docs.
Session bucket now displays usage as percentage (used/limit*100) with limit normalized to 100, matching plugins/claude and plugins/codex style. Companion buckets (speech-hd, image-01) remain as counts. Companion bucket assertions updated to use actual API values.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
- Fix README:38 — "coding plan session model-calls" → "token plan model-calls"
(resolves Copilot review comment discussion_r3255779189)
- Update quota table checked-on date to 2026-05-18 (re-verified vs official docs)
refactor(minimax): simplify normalizePlanName and tighten isSessionUsageName
- Merge duplicate coding/token-plan early-return into one condition
- Replace broad name.includes("coding") with name.includes("coding plan") |
name.includes("token plan") to avoid future false matches on companion buckets
fix(minimax): const total in parseModelRemainEntry (was let)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a42cece67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="plugins/minimax/plugin.js">
<violation number="1" location="plugins/minimax/plugin.js:107">
P2: GLOBAL plan inference no longer supports prompt-count totals, only exact model-call totals. If the GLOBAL API returns prompt-based `current_interval_total_count` values without an explicit `plan_name`, plan inference will silently fail.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
isSpeechHdUsageName matched anything containing "speech 2.8", so a payload
named "Speech 2.8 Turbo" (space-separated) would short-circuit to HD before
the turbo matcher ran. Its quota then polluted speechHdTotal and could flip
plan disambiguation (e.g. Plus -> Plus-High-Speed).
- Guard isSpeechHdUsageName with an early-return when name contains "turbo"
- Extend isSpeechTurboUsageName to also match space-separated form
("speech 2.8 turbo") in addition to the existing hyphen form
- Add regression test asserting label + plan tier remain correct
|
@codex re-review please |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
…ping Copilot autofix (fbda6a4) updated the Output contract to percent/limit:100 but left two earlier sections still describing Session as raw model-calls: - Overview "Display note": now describes Session as percentage + companion buckets as raw counts (chars/images). - Usage Mapping bullet: same alignment, clarifying that prompts conversion is intentionally skipped.
…l false matches
name.includes("minimax-m") would also match future non-text model names like
"MiniMax-Music-2.6" or "MiniMax-Multimodal", which would then be misclassified
as session — wrong label (Session vs Music), wrong window (5h vs daily, per
both official Token Plan docs), and wrong format (percent vs count).
Tighten the M-series patterns to require a digit after the M:
- name.includes("minimax-m") -> /minimax-m\d/
- name.includes("minimax_m") -> /minimax_m\d/
Existing "MiniMax-M*" wildcard tests still pass via the `index === 0` and
`pickSessionRemainItem` fallback paths. Add a regression test asserting
"MiniMax-Music-2.6" is rendered as its own non-session line.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
validatedev
left a comment
There was a problem hiding this comment.
Can't try the code, but the code looks good. Thanks!
|
Generally open to merging this but would need much better PR name + description + screenshot/s |
MiniMax can return coding-plan-vlm and coding-plan-search in arbitrary model_remains order. Keep the primary Session line first, then promote only those two coding-plan buckets directly below it while preserving all other resource rows in API order. Constraint: User requested only Session, coding-plan-vlm, and coding-plan-search ordering; other rows must not be globally sorted. Rejected: Sort all companion resources | would reorder unrelated TTS/image rows the user explicitly said not to manage. Confidence: high Scope-risk: narrow Directive: Do not expand this ordering helper to unrelated MiniMax resources without a specific display requirement. Tested: npm test -- plugins/minimax/plugin.test.js
|
Updated the PR title/description. Also moved the two coding-related MiniMax buckets, |
Summary
minimax_msession buckets by name instead of bucket order.Test plan
npm testpasses (1094 total, 60 MiniMax tests).Related
Fixes PR #317 review comments.
npm run tauri dev
Summary by cubic
Refreshes the MiniMax Token Plan usage: Session now displays as a percent (0–100), and companion TTS/image quotas show as counts with correct labels, windows, and ordering across GLOBAL and CN.
New Features
Text to Speech HD/Turbo,image-01/Image Generation) as counts withchars/images, rendered in both regions.minimax_m), not position; prefer it even if a companion bucket appears first.(CN)/(GLOBAL)suffix.Bug Fixes
remains_timeparsing (seconds vs ms), prefer ms when it matchesend_time, respect 5h (Session) vs 24h (companion) windows, and handle overflow.Written for commit 86d3f67. Summary will update on new commits. Review in cubic