Skip to content

fix(provider): clamp Xiaomi MiMo public reasoning tiers - #1485

Draft
Ingwannu wants to merge 1 commit into
devfrom
agent/fix-1483-xiaomi-reasoning
Draft

fix(provider): clamp Xiaomi MiMo public reasoning tiers#1485
Ingwannu wants to merge 1 commit into
devfrom
agent/fix-1483-xiaomi-reasoning

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a fixed-destination xiaomi-mimo preset for Xiaomi's official OpenAI-compatible Chat endpoint
  • expose only the upstream-validated low, medium, and high reasoning tiers
  • clamp direct xhigh, max, and ultra requests to high
  • preserve same-named custom providers that point at another destination
  • document the separate public Chat transport and its registry ownership decision

Root cause and impact

https://api.xiaomimimo.com/v1 had no registry-owned transport contract. A custom provider named xiaomi-mimo therefore kept the generic routed-model ladder and could advertise/send max even though the MiMo endpoint rejects every reasoning value above high.

The new preset is intentionally separate from the existing Xiaomi Anthropic and MiMo token-plan entries because those routes use different hosts and transport contracts. preserveCustomDestination prevents the preset from retargeting an existing custom key when a same-named row points somewhere else.

This PR does not normalize the separately reported malformed delta.tool_calls failure. The shared parser remains fail-closed until a redacted failing frame identifies the actual nested shape; guessing there could silently drop or mis-bind a tool call.

Refs #1483.

Provider evidence

Verified from Xiaomi's primary sources on 2026-08-11:

  • Official OpenAI-compatible Chat reference: https://platform.xiaomimimo.com/docs/en-US/api/chat/openai-api documents POST https://api.xiaomimimo.com/v1/chat/completions and API-key/Bearer authentication.
  • Service terms: https://mimo.mi.com/docs/terms/user-agreement identify Xiaomi Technologies Singapore Pte. Ltd. as the API service operator outside mainland China; the agreement was updated 2026-07-07.
  • Privacy terms: https://mimo.mi.com/docs/terms/privacy-policy identify Xiaomi Technology Netherlands B.V. and Xiaomi Technologies Singapore Pte. Ltd.; the policy was updated 2026-03-17.
  • Aggregator authorization: not applicable. This preset sends a user key to Xiaomi's first-party endpoint for Xiaomi's own MiMo model; it does not resell or route third-party models.
  • OpenCodex maintenance owner: @Ingwannu. Endpoint/auth/catalog breakage should be reported in the OpenCodex issue tracker and will be rechecked against the primary sources above.
  • The preset does not declare live model discovery, so no authenticated GET /v1/models contract is claimed.

Verification

  • bun test tests/mimo-token-plan-provider.test.ts tests/provider-registry-parity.test.ts — 41 passed
  • bun test tests/provider-workspace-rail.test.ts — 6 passed after installing the GUI workspace dependencies
  • bun run typecheck — passed
  • bun run privacy:scan — passed
  • cd docs-site && bun install --frozen-lockfile && bun run build — 265 pages built
  • bun run test — 11,047 passed, 11 skipped, 2 failed across 681 files; the failures were the live service-token environment collision in codex-shim.test.ts and a loaded-runner stall deadline in bridge-lifecycle.test.ts
  • env -u OPENCODEX_API_AUTH_TOKEN bun test tests/codex-shim.test.ts tests/bridge-lifecycle.test.ts — both failed files passed in isolation, 82/82
  • git diff --check — passed

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Scope notes

  • Targets dev only.
  • No GUI behavior or text-only product change.
  • No authentication or credential flow change.
  • No speculative malformed-tool-call repair.

Summary by CodeRabbit

  • New Features

    • Added Xiaomi MiMo as an OpenAI-compatible provider.
    • Added support for the mimo-v2.5 model with low, medium, and high reasoning levels.
    • Added handling for unsupported higher reasoning requests.
  • Documentation

    • Updated provider catalogs in English, Japanese, Korean, Russian, Simplified Chinese, and Traditional Chinese.
    • Documented Xiaomi MiMo configuration and reasoning behavior.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Xiaomi MiMo OpenAI Chat provider preset with the mimo-v2.5 model, constrained reasoning tiers, high-tier clamping, and custom-destination preservation. Updates registry tests, parity expectations, decision-log documentation, and localized provider catalogs.

Changes

Xiaomi MiMo provider integration

Layer / File(s) Summary
Provider preset and validation
src/providers/registry.ts, tests/mimo-token-plan-provider.test.ts, tests/provider-registry-parity.test.ts
src/providers/registry.ts:2306-2323 adds the xiaomi-mimo preset with its endpoint, model, reasoning mappings, and destination handling. Tests at tests/mimo-token-plan-provider.test.ts:9-70 validate official and custom-provider behavior. The parity list at tests/provider-registry-parity.test.ts:38 includes gitlab-duo.
Provider documentation and decision log
structure/03_catalog-and-subagents.md, docs-site/src/content/docs/guides/providers.md, docs-site/src/content/docs/ja/guides/providers.md, docs-site/src/content/docs/ko/guides/providers.md, docs-site/src/content/docs/ru/guides/providers.md, docs-site/src/content/docs/zh-cn/guides/providers.md, docs-site/src/content/docs/zh-tw/guides/providers.md
The decision log at structure/03_catalog-and-subagents.md:153-167 records the preset behavior. Localized provider catalogs add Xiaomi MiMo OpenAI Chat entries at the documented lines. The Traditional Chinese catalog also retains the existing A6API custom-provider wording at line 511.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProviderRegistry
  participant LoginProviderConfiguration
  participant ChatAdapter
  ProviderRegistry->>LoginProviderConfiguration: configure Xiaomi MiMo endpoint and mimo-v2.5
  LoginProviderConfiguration->>ChatAdapter: route OpenAI Chat requests
  ChatAdapter-->>LoginProviderConfiguration: map reasoning effort to low, medium, or high
  LoginProviderConfiguration-->>ProviderRegistry: preserve custom destination when configured
Loading

Possibly related PRs

  • lidge-jun/opencodex#385: Adds an OpenAI-compatible provider preset and updates provider parity expectations.
  • lidge-jun/opencodex#653: Adds a first-class OpenAI-compatible provider with custom-destination preservation, documentation, and tests.
  • lidge-jun/opencodex#1315: Adds an OpenAI-compatible provider with localized documentation and registry parity coverage.

Suggested labels: review-ready

Suggested reviewers: lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main behavioral change: clamping Xiaomi MiMo public reasoning tiers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-1483-xiaomi-reasoning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@Ingwannu

Copy link
Copy Markdown
Owner Author

Exact-head CI follow-up for 945d1718a4ad9ff9d3babe5a2523673a1bb1bf60:

  • the first gates attempt failed in the existing GUI aggregate-suite isolation pattern; the same 25 failures reproduced on clean origin/dev, while the four owning files passed 32/32 in isolation;
  • the first macOS attempt completed 11,051 tests and timed out only in the unrelated existing Cursor blob ID key channel bounds test;
  • I reran only those two failed jobs after the parent run finalized;
  • rerun gates passed, rerun macOS passed, and workflow run 31515208300 is now completed with success at attempt 3.

All Linux shards, gates, macOS, API/storage, keyring, npm-global, React Doctor, hygiene, and target checks are therefore green on the exact PR head. No GUI or unrelated timeout change was added to this provider patch. The PR remains draft and unmerged pending independent maintainer review.

@Wibias Wibias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the Xiaomi MiMo reasoning-contract change. I did not find an additional blocker in this scoped head. The fixed-destination preset limits the advertised ladder to low/medium/high, clamps higher direct tiers to high, and preserveCustomDestination protects same-named custom providers on other origins.

The separately reported malformed delta.tool_calls failure in #1483 is intentionally not repaired here and should remain tracked independently. I am not approving this head because it is currently not mergeable against the latest dev; rebase/resolve conflicts and request re-review.

@Wibias
Wibias force-pushed the agent/fix-1483-xiaomi-reasoning branch from 945d171 to f65dcae Compare August 11, 2026 19:39
@Wibias
Wibias marked this pull request as ready for review August 11, 2026 19:40
@Wibias
Wibias marked this pull request as draft August 11, 2026 19:42
@Wibias
Wibias marked this pull request as ready for review August 11, 2026 19:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Line 294: Document Xiaomi MiMo’s reasoning contract alongside the provider
entry: state that only low, medium, and high are supported, and that xhigh, max,
and ultra are clamped to high. Apply the equivalent localized note in
docs-site/src/content/docs/ja/guides/providers.md:221,
docs-site/src/content/docs/ko/guides/providers.md:221,
docs-site/src/content/docs/ru/guides/providers.md:232,
docs-site/src/content/docs/zh-cn/guides/providers.md:209, and
docs-site/src/content/docs/zh-tw/guides/providers.md:275, while adding the
base-language note in docs-site/src/content/docs/guides/providers.md:294.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5c3e0737-3722-4414-aa42-1093b639e040

📥 Commits

Reviewing files that changed from the base of the PR and between d91ca60 and f65dcae.

📒 Files selected for processing (10)
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/ja/guides/providers.md
  • docs-site/src/content/docs/ko/guides/providers.md
  • docs-site/src/content/docs/ru/guides/providers.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • docs-site/src/content/docs/zh-tw/guides/providers.md
  • src/providers/registry.ts
  • structure/03_catalog-and-subagents.md
  • tests/mimo-token-plan-provider.test.ts
  • tests/provider-registry-parity.test.ts

| SiliconFlow | `https://api.siliconflow.cn/v1` |
| Volcengine Ark · Coding Plan · Agent Plan | `https://ark.cn-beijing.volces.com/api/v3` · `https://ark.cn-beijing.volces.com/api/coding/v3` · `https://ark.cn-beijing.volces.com/api/plan/v3` |
| Xiaomi MiMo | `https://api.xiaomimimo.com/anthropic` |
| Xiaomi MiMo (OpenAI Chat) | `https://api.xiaomimimo.com/v1` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the Xiaomi MiMo reasoning contract.

The new rows identify the endpoint, but they do not state that Xiaomi MiMo supports only low, medium, and high. They also do not state that xhigh, max, and ultra are clamped to high. Users can otherwise select a tier that the CLI silently changes.

  • docs-site/src/content/docs/guides/providers.md#L294-L294: Add the supported ladder and clamping behavior.
  • docs-site/src/content/docs/ja/guides/providers.md#L221-L221: Add the equivalent localized behavior note.
  • docs-site/src/content/docs/ko/guides/providers.md#L221-L221: Add the equivalent localized behavior note.
  • docs-site/src/content/docs/ru/guides/providers.md#L232-L232: Add the equivalent localized behavior note.
  • docs-site/src/content/docs/zh-cn/guides/providers.md#L209-L209: Add the equivalent localized behavior note.
  • docs-site/src/content/docs/zh-tw/guides/providers.md#L275-L275: Add the equivalent localized behavior note.

As per path instructions, user-facing docs must stay in sync with actual CLI/API behavior. The referenced adapter documentation also requires consistent documentation of provider-specific reasoning support and higher-tier clamping.

📍 Affects 6 files
  • docs-site/src/content/docs/guides/providers.md#L294-L294 (this comment)
  • docs-site/src/content/docs/ja/guides/providers.md#L221-L221
  • docs-site/src/content/docs/ko/guides/providers.md#L221-L221
  • docs-site/src/content/docs/ru/guides/providers.md#L232-L232
  • docs-site/src/content/docs/zh-cn/guides/providers.md#L209-L209
  • docs-site/src/content/docs/zh-tw/guides/providers.md#L275-L275
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-site/src/content/docs/guides/providers.md` at line 294, Document Xiaomi
MiMo’s reasoning contract alongside the provider entry: state that only low,
medium, and high are supported, and that xhigh, max, and ultra are clamped to
high. Apply the equivalent localized note in
docs-site/src/content/docs/ja/guides/providers.md:221,
docs-site/src/content/docs/ko/guides/providers.md:221,
docs-site/src/content/docs/ru/guides/providers.md:232,
docs-site/src/content/docs/zh-cn/guides/providers.md:209, and
docs-site/src/content/docs/zh-tw/guides/providers.md:275, while adding the
base-language note in docs-site/src/content/docs/guides/providers.md:294.

Source: Path instructions

@Wibias Wibias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review against current dev@e8db4e03: the implementation correctly limits Xiaomi MiMo to low/medium/high and clamps xhigh/max/ultra to high, but the user-facing provider guides only add the endpoint row and omit that behavior. Since users can otherwise select a tier that OpenCodex silently lowers, please document the supported ladder and clamping behavior in the base guide and the five localized provider guides touched by this PR. The branch is also 9 commits behind current dev and currently not mergeable, so please rebase after the docs fix.

@Wibias
Wibias marked this pull request as draft August 11, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants