Repository navigation
Conversation
|
Codex review: blocked before merge. Reviewed September 26, 2026, 8:35 PM ET / September 27, 2026, 00:35 UTC (Revision 12). ClawSweeper reviewWhat this changesThe branch moves MiniMax fast-mode routing into its provider plugin, records the highspeed price for M2.7, adds priority-tier routing and pricing for M3, and removes the former shared stream hooks. Merge readiness⛔ Blocked before merge - 7 items remain This PR remains useful: current main still records the standard M2.7 price after routing Priority: P2 Review scores
Verification
How this fits togetherAn agent turn passes its selected model and fast-mode setting to the MiniMax provider plugin. The plugin shapes the outbound request, while the model cost passed to the stream is used to estimate usage charges. flowchart LR
A[Agent model and fast setting] --> B[MiniMax provider plugin]
B --> C{Model and fast mode}
C -->|M2.7 fast| D[Highspeed model and price]
C -->|M3 fast| E[Priority request and price]
C -->|Other| F[Original model]
D --> G[MiniMax request and usage]
E --> G
F --> G
Decision needed
Why: The mapping changes spend for existing preferences, and the related issue records a conflicting intended behavior; code and live endpoint proof cannot decide product intent. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +31, Tests +165, Docs -1. Total +195 across 12 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the M2.7 accounting repair at the MiniMax plugin boundary, retain shipped SDK compatibility until its transition is approved, and add M3 priority only after a clear product decision with final-tier pricing coverage. Do we have a high-confidence way to reproduce the issue? Yes for the M2.7 defect and the preserved-tier mismatch: current-main routing retains standard cost, and the branch's wrapper always multiplies M3 cost before inspecting the final tier. The supplied live trace covers the ordinary routes, not the preserved-standard case. Is this the best way to solve the issue? No as submitted. Plugin-local pricing is the right owner boundary for M2.7, but the M3 paid mapping needs product approval and the SDK removal needs a supported transition. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d06b334112a2. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
fd567d3 to
7bf614c
Compare
…t pricing MiniMax-M2.7 `/fast` already routed to the highspeed model but recorded the standard M2.7 rate, so the one fast lane that existed was billed at half its real input/output price. MiniMax-M3 had no `/fast` behavior at all, unlike Anthropic and OpenAI where `/fast` already opts into the provider's faster paid lane. Root cause of the mispricing: fast mode was a core stream wrapper that swapped `model.id` after `model.cost` had been resolved, while MiniMax pricing lives in the plugin. Id and cost drifted. Move the wrapper into the MiniMax plugin's own `wrapStreamFn`, next to `resolveMinimaxApiCost`, matching `extensions/anthropic/stream-wrappers.ts`: - M2.7 -> swap to MiniMax-M2.7-highspeed together with its catalog cost. - M3 -> inject `service_tier: "priority"` and scale `model.cost` 1.5x, the same shape as ANTHROPIC_FAST_MODE_COST_MULTIPLIER. An upstream service_tier is preserved. Fast mode is resolved plugin-locally through the public `normalizeFastMode`, so no new SDK export is needed. This deletes the orphaned core `createMinimaxFastModeWrapper`, the `minimax-fast-mode` stream family, its `MINIMAX_FAST_MODE_STREAM_HOOKS` shortcut, and the now-unused `resolveBooleanFastMode`; all were already `@deprecated` and have no remaining reader.
7bf614c to
0d520a0
Compare
|
Rebased onto current
CI is green on @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Related: #136257, #141852 ## What Problem This Solves Fixes an issue where users could enable a Fast choice that has no effect for a selected OpenAI, xAI, or MiniMax request. Models without a Fast alias and OpenAI requests controlled by an explicit service tier still fell back to provider-wide support. ## Why This Change Was Made Provider metadata shares the existing alias and service-tier rules with request construction. The existing selected-model capability field carries the result to controls. Explicit-tier precedence, unknown native capability, and saved-preference clearing stay intact. The rules use existing lightweight internal entries. MiniMax pricing and its proposed M3 paid lane remain separate work in #107378. ## User Impact Known no-op Fast choices are disabled, while supported requests keep their current mapping. Typed `/fast` commands continue to set or clear preferences. The capability describes local request mapping; it makes no speed, pricing, entitlement, or native-runtime claim. ## Evidence The real compiled Gateway and its authenticated client produced these results: | Selected non-native request | Baseline capability | Candidate capability | | --- | --- | --- | | xAI `grok-4.3` | absent | false | | xAI `grok-3` | absent | true | | MiniMax `MiniMax-M2.5` | absent | false | | MiniMax `MiniMax-M2.7` | absent | true | | OpenAI Responses with explicit `flex` | absent | false | | OpenAI Responses without an explicit tier | absent | true | - All six rows remain available under the selected OpenClaw runtime. Public output excludes credentials, endpoints and private parameter records. - Fresh independent acceptance passed all six metadata clauses after its own nonce command. Both Gateway runs stopped; the independent service recorded no remaining processes and enforced memory, CPU and swap limits. - 43 focused checks pass: provider rules, selected-model/agent parameters, dynamic aliases, composed OpenAI/ChatGPT tier precedence, and the corrected auth-refresh expectation. Formatting and lint pass; the changed assertion and normal hooks were verified on Testbox. - Baseline source is `127e3ffa3080841cef31927c57071c7ae9ae52ae`, exercised through source-equivalent build `1b284af37e091fab9fc58297e4478a0f701ed6fd`. Candidate proof uses actual CI build `d85807c2b634c885fd1d5caa2d17c99cf5601d9f` from run [34291602461](https://github.com/openclaw/openclaw/actions/runs/34291602461). The later commit changes only the expected metadata in one test, so production proof remains valid at its original build identity. - The earlier CI run caught that expected-row mismatch and two channel test timeouts before their injected reply callbacks. Full history is retained; those timeouts are not claimed fixed. Current results are in [PR checks](https://github.com/openclaw/openclaw/pull/142682/checks). - Generic control, unknown-case and preference-clearing proof from #141852 is retained for unchanged consumers. Fresh acceptance covers the new public metadata; it does not claim browser clicks or vendor inference. Co-authored-by: Ayaan Zaidi <[email protected]>
…#142682) Related: openclaw#136257, openclaw#141852 ## What Problem This Solves Fixes an issue where users could enable a Fast choice that has no effect for a selected OpenAI, xAI, or MiniMax request. Models without a Fast alias and OpenAI requests controlled by an explicit service tier still fell back to provider-wide support. ## Why This Change Was Made Provider metadata shares the existing alias and service-tier rules with request construction. The existing selected-model capability field carries the result to controls. Explicit-tier precedence, unknown native capability, and saved-preference clearing stay intact. The rules use existing lightweight internal entries. MiniMax pricing and its proposed M3 paid lane remain separate work in openclaw#107378. ## User Impact Known no-op Fast choices are disabled, while supported requests keep their current mapping. Typed `/fast` commands continue to set or clear preferences. The capability describes local request mapping; it makes no speed, pricing, entitlement, or native-runtime claim. ## Evidence The real compiled Gateway and its authenticated client produced these results: | Selected non-native request | Baseline capability | Candidate capability | | --- | --- | --- | | xAI `grok-4.3` | absent | false | | xAI `grok-3` | absent | true | | MiniMax `MiniMax-M2.5` | absent | false | | MiniMax `MiniMax-M2.7` | absent | true | | OpenAI Responses with explicit `flex` | absent | false | | OpenAI Responses without an explicit tier | absent | true | - All six rows remain available under the selected OpenClaw runtime. Public output excludes credentials, endpoints and private parameter records. - Fresh independent acceptance passed all six metadata clauses after its own nonce command. Both Gateway runs stopped; the independent service recorded no remaining processes and enforced memory, CPU and swap limits. - 43 focused checks pass: provider rules, selected-model/agent parameters, dynamic aliases, composed OpenAI/ChatGPT tier precedence, and the corrected auth-refresh expectation. Formatting and lint pass; the changed assertion and normal hooks were verified on Testbox. - Baseline source is `beca6a1c05d9dad59a9abbe6de226ac350f3a3ec`, exercised through source-equivalent build `1b284af37e091fab9fc58297e4478a0f701ed6fd`. Candidate proof uses actual CI build `d85807c2b634c885fd1d5caa2d17c99cf5601d9f` from run [34291602461](https://github.com/openclaw/openclaw/actions/runs/34291602461). The later commit changes only the expected metadata in one test, so production proof remains valid at its original build identity. - The earlier CI run caught that expected-row mismatch and two channel test timeouts before their injected reply callbacks. Full history is retained; those timeouts are not claimed fixed. Current results are in [PR checks](https://github.com/openclaw/openclaw/pull/142682/checks). - Generic control, unknown-case and preference-clearing proof from openclaw#141852 is retained for unchanged consumers. Fresh acceptance covers the new public metadata; it does not claim browser clicks or vendor inference. Co-authored-by: Ayaan Zaidi <[email protected]>
|
This pull request has been automatically marked as stale due to inactivity. |
Supersedes #95802
Related: #88868
AI-assisted.
What Problem This Solves
Two MiniMax fast-lane defects, one of them a live billing misreport:
/fastalready rewritesMiniMax-M2.7toMiniMax-M2.7-highspeed, but OpenClaw keeps recording the standard M2.7 rate. Highspeed costs$0.6/$2.4per million input/output tokens against M2.7's$0.3/$1.2, so every/fastM2.7 turn is reported at half its real input and output price./fastalready means "opt into the provider's faster paid lane" everywhere else in OpenClaw.Why This Change Was Made
Root cause of the mispricing. Fast mode was a core stream wrapper (
createMinimaxFastModeWrapper) that swapped the requestmodel.idaftermodel.costhad already been resolved, while MiniMax pricing lives in the plugin (resolveMinimaxApiCost). Id and cost drifted, and the swapped request was billed at the original model's rate. No amount of core-side patching fixes that without a cross-boundary cost callback.The fix moves ownership to the boundary that has the prices. The wrapper now lives in the MiniMax plugin's own
wrapStreamFn(extensions/minimax/stream-wrappers.ts), which is exactly the shapeextensions/anthropic/stream-wrappers.tsalready uses:MiniMax-M2.7-highspeedtogether with its catalog cost. A plain name→price lookup, identical to selecting any other model.service_tier: "priority"and scalemodel.costby 1.5x, the same construction asANTHROPIC_FAST_MODE_COST_MULTIPLIER = 2on main. Aservice_tierset upstream is preserved.Fast mode is resolved plugin-locally through the public
normalizeFastMode, mirroringresolveAnthropicFastMode, so this PR adds no plugin SDK export. It deletes the orphaned corecreateMinimaxFastModeWrapper, theminimax-fast-modestream family, itsMINIMAX_FAST_MODE_STREAM_HOOKSshortcut, and the then-unusedresolveBooleanFastMode.Responses to the previous review
The branch is rebased onto current
main, and the three P1 findings were re-checked against it rather than restated.1. "Preserve the shipped MiniMax SDK adapter." These are not live SDK contracts being retired; they were already retirement debt before this PR.
createMinimaxFastModeWrapperandMINIMAX_FAST_MODE_STREAM_HOOKScarry@deprecated ... do not use from third-party pluginsonmain, andmainhas itself already droppedMINIMAX_FAST_MODE_STREAM_HOOKSfrom the publicopenclaw/plugin-sdk/provider-stream-familyre-export list — the bundled plugin reached it viabuildProviderStreamFamilyHooks("minimax-fast-mode"). The only in-repo reader was the bundled MiniMax plugin, which this PR migrates in the same change, perextensions/AGENTS.md("ALL bundled plugins must move to modern SDK seams in the same change"). That matches the precedent set by #112915, which removed reader-free deprecated SDK declarations outright rather than adding adapters. Keeping a deprecated compatibility adapter here would mean keeping a second, knowingly mispriced fast-mode path alive. If maintainers want the packaged-corpus reader scan that #112915 ran before removal, that gate is yours to run — I verified in-repo readers only.2. "Do not redefine M3 fast mode without approval."
/fastopting into a faster, more expensive provider lane is the established product semantic onmain, not a new one this PR invents:docs/providers/anthropic.md:497— native fast mode "is billed at$10/$50per million input/output tokens. OpenClaw applies the same 2x multiplier to cache pricing in its cost estimate."docs/concepts/model-providers.md:115— "/fastandparams.fastModemap directopenai/*Responses requests toservice_tier=priority".MiniMax-M3 was the outlier. This PR also does the thing the OpenAI path still does not: it records the premium in the cost estimate instead of silently under-reporting it. Note also that #88869, the competing implementation of the M3-unchanged direction, was closed unmerged on 2026-06-14, so there is no longer a competing branch to consolidate against. The
/fastsemantics remain opt-in; nothing changes when fast mode is off. If maintainers still prefer M3-unchanged, say so and I will drop the M3 half — the M2.7 accounting repair stands on its own.3. "Use tier-aware M3 cost before multiplying." Not reachable at this seam, and not made worse here. The runtime
Model.costhanded to aStreamFnis four flat numbers (packages/llm-core/src/types.ts:631) with no tier information;tieredPricingexists only in the catalog layer (packages/model-catalog-core/src/model-catalog-types.ts:217), and the MiniMax catalog declares notieredPricingfor M3 (extensions/minimax/model-definitions.ts). Long-context M3 is therefore under-reported onmainidentically with and without this PR. Making M3 tier-aware is catalog work owned by #88868, and it composes cleanly with this change: once the catalog carries tiers, the multiplier applies on top of whatever base cost the catalog resolved.User Impact
With
/fastenabled on a MiniMax model: M2.7 runs on the highspeed model and is finally reported at the highspeed rate instead of half of it, and M3 runs on MiniMax's priority tier reported at 1.5x. No behavior change when fast mode is off, and no plugin SDK surface is added.Cost accounting follows automatically:
calculateCost(model, usage)(packages/ai/src/model-utils.ts:9) derivesusage.costfrom the exact model object the wrapper hands down the stream, which is the routed/repriced one. The live test below captures that object directly.The inline per-reply usage bar still shows the base rate — it recomputes from the model ref and cannot see a tier, the same limitation OpenAI's priority tier has today.
Evidence
Live OpenClaw run on this branch (
extensions/minimax/minimax.live.test.ts, newminimax fast lane liveblock, MiniMax API key redacted). Each case registers the real MiniMax plugin, takes the provider's ownwrapStreamFn, and drives a real turn againsthttps://api.minimax.io/anthropicthroughstreamSimple, capturing both the request body MiniMax receives and the model OpenClaw bills:The first line is the defect and the fix in one: the request goes to
MiniMax-M2.7-highspeedand the recorded cost is now that model's own0.6/2.4rate. Before this change it stayed at M2.7's0.3/1.2.Live endpoint re-confirmation (today, current API — the earlier review flagged that MiniMax's Anthropic-compat docs claim
service_tieris ignored):The endpoint honors the flag and reports the served lane back.
Focused unit proof:
extensions/minimax/stream-wrappers.test.ts(11),extensions/minimax/index.test.ts(12),src/plugin-sdk/provider-stream.test.ts+src/llm/providers/stream-wrappers/minimax.test.ts(26),src/plugins/contracts/provider-family-plugin-tests.test.ts(3),src/agents/embedded-agent-runner-extraparams.test.ts(138) — all passing. The new extension test covers the M2.7 id+cost swap, the M3service_tier: "priority"+ 1.5x cost ({0.6,2.4,0.12,0}→{0.9,3.6,0.18,0}), upstream-tier preservation, the/fastfunction and string spellings,/fast autostaying unresolved, fast-off no-op, and non-MiniMax passthrough.Static gates:
tsgo:core,tsgo:extensions,tsgo:test:src,tsgo:test:extensions,check:deprecated-api-usage,check:deprecated-jsdoc,check:import-cycles,plugin-sdk:surface:check, both extension plugin-SDK boundary lints,format:check, andgit diff --checkall clean.plugin-sdk:api:genproduces no baseline change (the removed symbols are outside the 142 curated baseline modules), so the generated baseline edit from the pre-rebase revision is gone.Rebase notes: rebased onto
mainatf1538c6d6c1. Three surfaces that moved under the branch since it was opened are updated here:provider-registration.tsnow composeswrapStreamFndirectly instead ofbuildProviderStreamFamilyHooks("minimax-fast-mode"), theminimaxsentinel insrc/plugins/contracts/provider-family-plugin-tests.test.tsdrops itsstreamFamiliesentry, andsrc/agents/embedded-agent-runner-extraparams.test.tsuses a localcreateTestMinimaxFastModeWrapper(matching the existing xAI test helper) instead of importing the deleted core wrapper. That file also had two byte-identicalit(...)cases for the M2.7 highspeed mapping; one is removed.Prod LOC is net +31, which is the M3 lane itself — new behavior rather than refactor churn. The core deletions offset most of the wrapper move.
🤖 Generated with Claude Code