Skip to content

feat(providers): add the MiMo token-plan preset on the Chat wire (#1158) - #1211

Merged
lidge-jun merged 2 commits into
devfrom
codex/260807-mimo-token-plan
Aug 7, 2026
Merged

feat(providers): add the MiMo token-plan preset on the Chat wire (#1158)#1211
lidge-jun merged 2 commits into
devfrom
codex/260807-mimo-token-plan

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Closes #1158. Stacked on #1208.

Xiaomi MiMo's paid token-plan endpoint answers the Responses wire for plain turns, so a user configuring it by hand picks openai-responses — MiMo documents Responses support. But its gateway rejects type: "custom" tools with 400 responses_feature_not_supported, and apply_patch is a custom tool. The result is a provider where chat works and every agentic turn fails.

Only xiaomi (Anthropic wire) and mimo-free (free tier, bespoke adapter) existed, so token-plan users had no preset to start from and naturally landed on the one wire that breaks.

This adds a preset pinned to openai-chat, the wire the reporter confirmed works end to end. The Chat path already lowers custom tools to {input: string} functions and restores them as custom_tool_call, so apply_patch survives the round trip — nothing needed building, the provider just had to point at the wire that works.

Two decisions worth reviewing

Not stripping the custom tools. That would stop the 400 and disable the Codex agent loop — a provider that no longer errors and no longer edits files. apply_patch is the custom tool.

preserveCustomDestination: true, and it is tested rather than asserted. Someone may already have a hand-rolled provider under this id; without the flag, routing canonicalizes their base URL onto ours and sends their key to a host they never chose. That is the hazard the zhipu-bigmodel comment documents.

The preset-shape assertions do not exercise that flag at all — it only engages when endpoint, adapter, or auth differ. So there is a separate routing-level regression: a pre-existing mimo provider pointing elsewhere with a different adapter, routed through, asserting its URL, key, and adapter are untouched and that it does not inherit the registry's effort clamp.

Reasoning tiers above high are clamped; the gateway validates the ladder strictly.

Verification

bun run typecheck                                    # clean
bun test mimo-token-plan + registry-parity + cline-pass + update-job   # 100 pass, 0 fail
bun run privacy:scan                                 # passed

The full prepush gate ran and passed on push. No frontend files are touched.

Both mechanisms ablation-confirmed:

Reverted Failing test
adapter pinned back to openai-responses the Chat-wire test
preserveCustomDestination removed the collision test

The parity list needed mimo inserted in registry-definition order, not alphabetically — worth knowing if you add an entry.

Planning record: devlog/_plan/260807_untouched_bug_stack/070_mimo_token_plan_preset.md. This plan failed its first independent audit for claiming collision preservation while never testing it; the routing regression is that correction.

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.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

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

Copy link
Copy Markdown

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: acde7a4005

ℹ️ 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 on lines +23 to +24
Both environment variables are also writable by the process that launched us,
which makes the principal attacker-influenceable in a permissions path.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the unfixed ACL security plan from tracked devlog

Because this commit does not fix the Windows ACL defect, this tracked plan publicly discloses an attacker-influenceable credential-permission path together with affected environments, bypass reasoning, and a detailed pre-disclosure patch strategy. Remove this file from the commit and keep it in .tmp/ or another scratch directory until the fix has shipped publicly.

AGENTS.md reference: AGENTS.md:L61-L68

Useful? React with 👍 / 👎.

Comment thread src/providers/registry.ts
Comment on lines +2046 to +2047
baseUrl: "https://token-plan-cn.xiaomimimo.com/v1",
adapter: "openai-chat",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document the new MiMo token-plan preset

This new user-facing preset is absent from docs-site/src/content/docs/guides/providers.md, whose lines 273–280 still list only MiMo's Anthropic endpoint and explicitly describe Xiaomi MiMo as Anthropic-only; the translated provider guides repeat that claim. Users following the documentation therefore cannot discover this token-plan endpoint and may continue choosing the incompatible wire this change is intended to prevent. Add the token-plan URL and its openai-chat distinction to the English guide and keep the locale copies consistent.

AGENTS.md reference: AGENTS.md:L231-L232

Useful? React with 👍 / 👎.

@lidge-jun
lidge-jun force-pushed the codex/260807-mimo-token-plan branch from acde7a4 to aa27ba5 Compare August 7, 2026 11:02
@lidge-jun
lidge-jun force-pushed the codex/260807-adopt-cursor-quota branch from e916ec7 to 6db8e6a Compare August 7, 2026 11:02
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a58fb94a-ac0f-4fe5-a560-19cfd768e625

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@lidge-jun
lidge-jun force-pushed the codex/260807-mimo-token-plan branch from aa27ba5 to 36936da Compare August 7, 2026 11:34
@lidge-jun
lidge-jun force-pushed the codex/260807-adopt-cursor-quota branch from 6db8e6a to 1b4d7c8 Compare August 7, 2026 11:34
@lidge-jun
lidge-jun force-pushed the codex/260807-mimo-token-plan branch from 36936da to 86b31f2 Compare August 7, 2026 16:47
@lidge-jun
lidge-jun force-pushed the codex/260807-adopt-cursor-quota branch from 1b4d7c8 to 6b7635b Compare August 7, 2026 16:47
Xiaomi MiMo's paid endpoint answers the Responses wire for plain turns, so a
user configuring it by hand picks `openai-responses` — MiMo documents Responses
support. But its gateway rejects `type: "custom"` tools with
`400 responses_feature_not_supported`, and `apply_patch` is a custom tool. The
result is a provider where chat works and every agentic turn fails.

Only `xiaomi` (Anthropic wire) and `mimo-free` (free tier, own adapter) existed,
so token-plan users had no preset to start from. This adds one pinned to
`openai-chat`, which is the wire the reporter confirmed works end to end. The
Chat path already lowers custom tools to `{input: string}` functions and
restores them as `custom_tool_call`, so the capability survives intact.

Stripping the custom tools instead would stop the 400 and disable the Codex
agent loop — a provider that no longer errors and no longer edits files.

Reasoning tiers above `high` are clamped: the gateway validates the ladder
strictly and rejects anything higher.

`preserveCustomDestination` is set because a user may already have a hand-rolled
provider under this id. Without it, routing canonicalizes their base URL onto
ours and sends their key to a host they never chose — the hazard the
`zhipu-bigmodel` comment documents.

That last property is the one worth testing rather than asserting: the preset
shape assertions do not exercise it at all, since the mechanism only engages
when endpoint, adapter, or auth differ. A routing-level regression covers it,
and both it and the adapter pin were confirmed to fail when reverted.
… plan

Audit found resolveTrustedWindowsPowerShellExe() already resolves and validates
the executable through GetSystemDirectoryW. Writing a third SystemRoot/PATH
lookup would reintroduce the substitution surface the plan exists to close.
@lidge-jun
lidge-jun force-pushed the codex/260807-adopt-cursor-quota branch from 6b7635b to aabee91 Compare August 7, 2026 17:15
@lidge-jun
lidge-jun force-pushed the codex/260807-mimo-token-plan branch from 86b31f2 to 355640d Compare August 7, 2026 17:15
@lidge-jun
lidge-jun changed the base branch from codex/260807-adopt-cursor-quota to dev August 7, 2026 17:38
@lidge-jun
lidge-jun merged commit 4ff8d69 into dev Aug 7, 2026
25 of 43 checks passed
@lidge-jun
lidge-jun deleted the codex/260807-mimo-token-plan branch August 8, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant