Skip to content

fix(minimax): improve session bucket selection and CN path handling#472

Open
FrankieeW wants to merge 15 commits into
robinebers:mainfrom
FrankieeW:feat/minimax-plugin-refresh
Open

fix(minimax): improve session bucket selection and CN path handling#472
FrankieeW wants to merge 15 commits into
robinebers:mainfrom
FrankieeW:feat/minimax-plugin-refresh

Conversation

@FrankieeW
Copy link
Copy Markdown
Contributor

@FrankieeW FrankieeW commented May 18, 2026

Summary

  • Extend session bucket detection to cover M2.7, M2.7-highspeed, minimax_m naming patterns
  • Apply session bucket selection to both GLOBAL and CN paths (previously GLOBAL-only)
  • Remove incorrect 5h Coding Plan assumption from inferRemainsMs comment
  • Add regression test for CN path with companion bucket appearing first

Test plan

  • npm test passes (1094 total, 60 minimax)
  • No breaking changes to provider output format
  • Backward compatible with existing usage patterns

Related

Fixes PR #317 review comments


Summary by cubic

Improves the MiniMax plugin’s session detection, plan inference, and CN handling. Session now shows as a percentage (0–100); companion TTS/image quotas stay as counts with correct reset windows and Turbo/HD labeling.

  • New Features

    • Show Session as percent; companion buckets (Text to Speech HD/Turbo, image-01/Image Generation) stay as counts with chars/images.
    • Detect session buckets for M2.7/M2.7-highspeed/minimax_m and prefer the session entry even if it isn’t first (GLOBAL and CN).
    • Infer plans from model-call limits and companion quotas; normalize to Starter/Plus/Max/Plus-High-Speed/Max-High-Speed/Ultra-High-Speed with a (CN)/(GLOBAL) suffix.
    • Render companion resource lines in both regions and use daily windows when only remains_time is present.
  • Bug Fixes

    • Apply session bucket selection to CN responses and update CN primary endpoint to https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains with fallbacks.
    • Prevent “Speech 2.8 Turbo” from being classified as HD; extend Turbo matching to space-separated names.
    • Tighten session matchers to avoid misclassifying MiniMax-Music/Multimodal; keep those as non-session lines.
    • Improve remains_time handling: pick seconds vs ms correctly, favor ms when it matches end_time, respect 5h (Token Plan) vs 24h (daily) windows, and handle overflow.
    • Rename “Coding Plan” to “Token Plan” and simplify plan-name normalization; recognize Image Generation alias.
    • Docs: Update README and provider docs; clarify percent Session and raw companion counts. Quota tables rechecked on 2026-05-18.

Written for commit 67f6e2b. Summary will update on new commits. Review in cubic

- 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
Copilot AI review requested due to automatic review settings May 18, 2026 00:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isSessionUsageName patterns (m2.7, minimax_m) and apply orderRemainItemsForDisplay in CN path.
  • Update inferRemainsMs to accept an explicit expectedWindowMs and 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.

Comment thread README.md Outdated
- [**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
@FrankieeW FrankieeW marked this pull request as draft May 18, 2026 00:41
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Re-trigger cubic

FrankieeW added 3 commits May 18, 2026 01:47
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.
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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".

- 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)
@FrankieeW FrankieeW marked this pull request as ready for review May 18, 2026 09:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread plugins/minimax/plugin.js
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread plugins/minimax/plugin.js
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
@validatedev validatedev requested a review from Copilot May 18, 2026 10:35
@validatedev
Copy link
Copy Markdown
Collaborator

@codex re-review please

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread docs/providers/minimax.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/providers/minimax.md
FrankieeW added 2 commits May 18, 2026 13:56
…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.
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ 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".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Collaborator

@validatedev validatedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't try the code, but the code looks good. Thanks!

@robinebers
Copy link
Copy Markdown
Owner

Generally open to merging this but would need much better PR name + description + screenshot/s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants