Skip to content

feat(cli): add bailian and minimax provider compatibility#2268

Open
ilovingjny wants to merge 1 commit into
code-yeongyu:devfrom
ilovingjny:feature/provider-matching-overhaul
Open

feat(cli): add bailian and minimax provider compatibility#2268
ilovingjny wants to merge 1 commit into
code-yeongyu:devfrom
ilovingjny:feature/provider-matching-overhaul

Conversation

@ilovingjny
Copy link
Copy Markdown

@ilovingjny ilovingjny commented Mar 3, 2026

Summary

This PR has been rebased onto current dev and narrowed to the provider compatibility pieces that are still missing in the current architecture.

Current dev already moved model requirements into packages/model-core and already covers much of the original provider-matching direction (opencode-go, kimi-for-coding, vercel, and the newer fallback-chain shape). This refreshed PR does not revive the old broad fallback overhaul. It adds the remaining bailian-coding-plan and direct minimax compatibility paths in the current package layout.

What changed

  • Add CLI/TUI install support for --bailian-coding-plan and --minimax.
  • Detect existing bailian-coding-plan/ and minimax/ model config entries during install/config refresh.
  • Map bailian-coding-plan and minimax through provider availability so fallback-chain resolution can actually select them.
  • Add bailian-coding-plan routes for Qwen/GLM/Kimi-compatible fallback entries where the current chains already use those model families.
  • Add direct minimax/MiniMax-M2.5 support only to utility-capable chains: librarian, explore, atlas, sisyphus-junior, quick, unspecified-low, and writing.
  • Normalize minimax-m2.5 to MiniMax-M2.5 for direct MiniMax-compatible providers (minimax, bailian-coding-plan).
  • Update provider/model matching docs and focused tests.

Boundaries

This intentionally keeps the risky parts out of scope:

  • No MiniMax fallback was added to Hephaestus, Oracle, Momus, deep, or ultrabrain.
  • Existing Z.ai Librarian behavior is preserved when both Z.ai and Bailian are configured.
  • The old scribe/writing-agent changes are not part of this PR. That direction belongs to the separate writing-category PR.
  • The old src/shared/model-requirements.ts-style changes are not restored; the refreshed implementation follows current packages/model-core ownership.

Comparison with current provider/model work

Test plan

  • bun test src/cli/model-fallback.test.ts
  • bun test packages/model-core/src/model-requirements.test.ts packages/model-core/src/provider-model-id-transform.test.ts src/cli/provider-availability.test.ts src/cli/provider-model-id-transform.test.ts src/cli/install-validators.test.ts
  • bun test src/cli/cli-installer.test.ts src/cli/tui-installer.test.ts src/cli/cli-installer.telemetry.test.ts src/cli/config-manager/generate-omo-config.test.ts src/cli/config-manager/write-omo-config.test.ts src/cli/openai-only-model-catalog.test.ts
  • bun run typecheck
  • bun run build
  • git diff --check

Copy link
Copy Markdown

@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.

16 issues found across 28 files

Confidence score: 2/5

  • High-confidence compatibility issues suggest real runtime breakage risk: bailian-coding-plan (and qwen3.5-plus with that provider) appears unsupported in OpenCode across src/cli/types.ts, src/cli/model-fallback-requirements.ts, and src/cli/provider-availability.ts.
  • There is a concrete regression risk in fallback behavior: removing opencode from gpt-5.2 fallback entries for momus and oracle in src/cli/model-fallback-requirements.ts may break the expected GPT-first routing.
  • Test reliability is weakened by contradictory and skipped coverage in src/shared/model-requirements.test.ts and a skipped generateOmoConfig suite in src/cli/config-manager.test.ts, which reduces confidence in the fallback/model changes.
  • Pay close attention to src/cli/model-fallback-requirements.ts, src/shared/model-requirements.test.ts, src/cli/types.ts, src/cli/provider-availability.ts, and src/shared/provider-model-id-transform.ts - provider/model mismatches and skipped/contradictory tests are the main merge risks.
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="src/cli/model-fallback-requirements.ts">

<violation number="1" location="src/cli/model-fallback-requirements.ts:10">
P1: Custom agent: **Opencode Compatibility**

The provider `bailian-coding-plan` is not supported in the upstream opencode repository. Please ensure providers are implemented upstream before using them here to maintain Opencode compatibility.</violation>

<violation number="2" location="src/cli/model-fallback-requirements.ts:23">
P1: Custom agent: **Opencode Compatibility**

The model `qwen3.5-plus` and provider `bailian-coding-plan` are not supported in the upstream opencode repository.</violation>

<violation number="3" location="src/cli/model-fallback-requirements.ts:29">
P1: The `requiresProvider` array for `hephaestus` is missing `minimax` and `kimi-for-coding`, rendering their fallback entries unreachable for single-provider users.</violation>

<violation number="4" location="src/cli/model-fallback-requirements.ts:33">
P1: `opencode` provider should be added back to the `gpt-5.2` fallback entry for the `oracle` agent to maintain the "GPT-first" guarantee</violation>

<violation number="5" location="src/cli/model-fallback-requirements.ts:99">
P1: `opencode` provider should be added back to the `gpt-5.2` fallback entry for the `momus` agent to maintain the "GPT-first" guarantee</violation>
</file>

<file name="src/shared/provider-model-id-transform.ts">

<violation number="1" location="src/shared/provider-model-id-transform.ts:19">
P1: Custom agent: **Opencode Compatibility**

The `opencode-go` provider expects the model ID `minimax-m2.5` in lowercase, not capitalized.</violation>

<violation number="2" location="src/shared/provider-model-id-transform.ts:24">
P2: Inconsistent case-sensitivity checking for minimax-m2.5 model ID between providers. The `minimax`, `bailian-coding-plan`, and `opencode-go` providers use case-insensitive regex matching (`/^minimax-m2\.5$/i`), but the `opencode` provider uses strict lowercase equality (`model === "minimax-m2.5"`). If model names are passed with mixed casing (e.g., "MiniMax-M2.5"), the transformation to "minimax-m2.5-free" will fail for the opencode provider.</violation>
</file>

<file name="src/cli/types.ts">

<violation number="1" location="src/cli/types.ts:12">
P0: Custom agent: **Opencode Compatibility**

The provider `bailian-coding-plan` does not exist in the OpenCode SDK. Please verify the provider ID against OpenCode's supported providers (e.g., `alibaba` / `alibaba-cn` or other valid coding plan variants like `zhipuai-coding-plan`, `zai-coding-plan`, `minimax-coding-plan`, etc.).</violation>
</file>

<file name="src/cli/provider-availability.ts">

<violation number="1" location="src/cli/provider-availability.ts:30">
P1: Custom agent: **Opencode Compatibility**

The `bailian-coding-plan` provider is not supported by OpenCode. A review of the `anomalyco/opencode` source code shows no implementation or references for this provider ID.</violation>
</file>

<file name="src/cli/model-fallback.policy.test.ts">

<violation number="1" location="src/cli/model-fallback.policy.test.ts:32">
P2: Missing test coverage for Hephaestus opencode-go → glm-5 fallback path. The PR explicitly documents 'Hephaestus opencode-go fallback to glm-5' as intentional, and model-fallback-requirements.ts contains a comment '// opencode-go subscribers get glm-5 (intentional: GLM is a better fit for opencode-go than MiniMax in this slot)' with the corresponding fallback entry. However, there is no test verifying this specific fallback path when hasOpencodeGo: true is set (without OpenAI or Bailian). This leaves an important, explicitly documented fallback rule unverified and susceptible to regression.</violation>
</file>

<file name="src/cli/provider-model-id-transform.test.ts">

<violation number="1" location="src/cli/provider-model-id-transform.test.ts:198">
P2: Test for case-insensitive normalization uses already-capitalized input that won't detect broken normalization logic.</violation>
</file>

<file name="src/cli/config-manager.test.ts">

<violation number="1" location="src/cli/config-manager.test.ts:242">
P1: Test suite for `generateOmoConfig` is skipped, leaving the overhauled model fallback logic untested</violation>
</file>

<file name="docs/guide/agent-model-matching.md">

<violation number="1" location="docs/guide/agent-model-matching.md:86">
P2: Documentation contains contradictory fallback chain information for agent models. The Hephaestus table shows `GPT-5.3 Codex → GLM 5 → MiniMax M2.5 → Qwen3.5 Plus` but the implementation code and 'Hephaestus Fallback Note' both indicate `GPT-5.3 Codex → qwen3.5-plus → glm-5 → MiniMax M2.5`. Additionally, Oracle and Momus tables don't list `qwen3.5-plus` but the 'ChatGPT-First Groups' text and implementation code confirm it as the second fallback. The tables need to be updated to match the implementation and the note section for consistency.</violation>
</file>

<file name="src/shared/model-requirements.test.ts">

<violation number="1" location="src/shared/model-requirements.test.ts:9">
P0: Critical test suites erroneously skipped - AGENT_MODEL_REQUIREMENTS and CATEGORY_MODEL_REQUIREMENTS describe blocks changed to `.skip()`</violation>

<violation number="2" location="src/shared/model-requirements.test.ts:195">
P0: Contradictory test added that conflicts with actual implementation - forbids 'glm' models while implementation includes glm-5 in hephaestus</violation>
</file>

<file name="src/shared/model-requirements.policy.test.ts">

<violation number="1" location="src/shared/model-requirements.policy.test.ts:45">
P2: Test validates the wrong agent chain - tests 'oracle' (a ChatGPT-first agent) when the test name claims to test 'general chains'</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread src/cli/types.ts
copilot?: BooleanArg
opencodeZen?: BooleanArg
opencodeGo?: BooleanArg
bailianCodingPlan?: BooleanArg
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 3, 2026

Choose a reason for hiding this comment

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

P0: Custom agent: Opencode Compatibility

The provider bailian-coding-plan does not exist in the OpenCode SDK. Please verify the provider ID against OpenCode's supported providers (e.g., alibaba / alibaba-cn or other valid coding plan variants like zhipuai-coding-plan, zai-coding-plan, minimax-coding-plan, etc.).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/cli/types.ts, line 12:

<comment>The provider `bailian-coding-plan` does not exist in the OpenCode SDK. Please verify the provider ID against OpenCode's supported providers (e.g., `alibaba` / `alibaba-cn` or other valid coding plan variants like `zhipuai-coding-plan`, `zai-coding-plan`, `minimax-coding-plan`, etc.).</comment>

<file context>
@@ -8,6 +8,9 @@ export interface InstallArgs {
   copilot?: BooleanArg
   opencodeZen?: BooleanArg
+  opencodeGo?: BooleanArg
+  bailianCodingPlan?: BooleanArg
+  minimax?: BooleanArg
   zaiCodingPlan?: BooleanArg
</file context>
Fix with Cubic

Comment thread src/shared/model-requirements.test.ts Outdated
Comment thread src/shared/model-requirements.test.ts Outdated
Comment thread src/cli/model-fallback-requirements.ts Outdated
sisyphus: {
fallbackChain: [
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-6", variant: "max" },
{ providers: ["opencode-go", "bailian-coding-plan"], model: "kimi-k2.5" },
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 3, 2026

Choose a reason for hiding this comment

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

P1: Custom agent: Opencode Compatibility

The provider bailian-coding-plan is not supported in the upstream opencode repository. Please ensure providers are implemented upstream before using them here to maintain Opencode compatibility.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/cli/model-fallback-requirements.ts, line 10:

<comment>The provider `bailian-coding-plan` is not supported in the upstream opencode repository. Please ensure providers are implemented upstream before using them here to maintain Opencode compatibility.</comment>

<file context>
@@ -1,152 +1,225 @@
   sisyphus: {
     fallbackChain: [
-      { providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-6", variant: "max" },
+      { providers: ["opencode-go", "bailian-coding-plan"], model: "kimi-k2.5" },
+      { providers: ["opencode-go", "bailian-coding-plan", "opencode", "zai-coding-plan"], model: "glm-5" },
+      { providers: ["opencode-go", "bailian-coding-plan", "minimax", "opencode"], model: "minimax-m2.5" },
</file context>
Fix with Cubic

Comment thread src/cli/model-fallback-requirements.ts Outdated
fallbackChain: [
{ providers: ["openai", "opencode"], model: "gpt-5.3-codex", variant: "medium" },
{ providers: ["openai"], model: "gpt-5.3-codex", variant: "medium" },
{ providers: ["bailian-coding-plan"], model: "qwen3.5-plus" },
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 3, 2026

Choose a reason for hiding this comment

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

P1: Custom agent: Opencode Compatibility

The model qwen3.5-plus and provider bailian-coding-plan are not supported in the upstream opencode repository.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/cli/model-fallback-requirements.ts, line 23:

<comment>The model `qwen3.5-plus` and provider `bailian-coding-plan` are not supported in the upstream opencode repository.</comment>

<file context>
@@ -1,152 +1,225 @@
     fallbackChain: [
-      { providers: ["openai", "opencode"], model: "gpt-5.3-codex", variant: "medium" },
+      { providers: ["openai"], model: "gpt-5.3-codex", variant: "medium" },
+      { providers: ["bailian-coding-plan"], model: "qwen3.5-plus" },
+      // opencode-go subscribers get glm-5 (intentional: GLM is a better fit for opencode-go than MiniMax in this slot)
+      { providers: ["opencode-go"], model: "glm-5" },
</file context>
Fix with Cubic

Comment thread src/cli/model-fallback.policy.test.ts Outdated
Comment thread src/cli/provider-model-id-transform.test.ts Outdated
Comment thread docs/guide/agent-model-matching.md Outdated
Comment thread src/shared/model-requirements.policy.test.ts Outdated
}

if (provider === "opencode") {
if (model === "minimax-m2.5") {
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 3, 2026

Choose a reason for hiding this comment

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

P2: Inconsistent case-sensitivity checking for minimax-m2.5 model ID between providers. The minimax, bailian-coding-plan, and opencode-go providers use case-insensitive regex matching (/^minimax-m2\.5$/i), but the opencode provider uses strict lowercase equality (model === "minimax-m2.5"). If model names are passed with mixed casing (e.g., "MiniMax-M2.5"), the transformation to "minimax-m2.5-free" will fail for the opencode provider.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/shared/provider-model-id-transform.ts, line 24:

<comment>Inconsistent case-sensitivity checking for minimax-m2.5 model ID between providers. The `minimax`, `bailian-coding-plan`, and `opencode-go` providers use case-insensitive regex matching (`/^minimax-m2\.5$/i`), but the `opencode` provider uses strict lowercase equality (`model === "minimax-m2.5"`). If model names are passed with mixed casing (e.g., "MiniMax-M2.5"), the transformation to "minimax-m2.5-free" will fail for the opencode provider.</comment>

<file context>
@@ -1,18 +1,33 @@
+  }
+
+  if (provider === "opencode") {
+    if (model === "minimax-m2.5") {
+      return "minimax-m2.5-free"
+    }
</file context>
Fix with Cubic

@ilovingjny
Copy link
Copy Markdown
Author

@cubic-dev-ai All identified issues have been addressed in the latest commit. Here's a summary of changes made (model names kept as-is per project intent):

Fixed:

  • provider-model-id-transform.ts: Removed opencode-go from MiniMax capitalization — opencode-go correctly uses lowercase minimax-m2.5
  • model-fallback-requirements.ts: Added opencode back to oracle and momus gpt-5.2 fallback entries; added minimax and kimi-for-coding to hephaestus requiresProvider
  • model-requirements.ts: Updated hephaestus requiresProvider to include minimax and kimi-for-coding
  • Unskipped AGENT_MODEL_REQUIREMENTS and CATEGORY_MODEL_REQUIREMENTS test suites; updated 14 test expectations to match current chains
  • Unskipped generateOmoConfig test suite; updated sisyphus/ZAI/OpenAI-only expectations
  • Fixed contradictory "only GPT" hephaestus test — replaced with test that verifies GPT-first with intentional non-GPT fallbacks
  • Added bailian-lowercase transform test and opencode-go no-capitalize test
  • Added policy test for Hephaestus opencode-go → glm-5 fallback path
  • Fixed general-chains policy test to use scribe (a general agent) instead of oracle (GPT-first)
  • Fixed Hephaestus/Oracle/Momus fallback chain descriptions in agent-model-matching.md

Not changed (by design):

  • bailian-coding-plan, opencode-go, kimi-for-coding provider IDs — these are custom providers implemented by this plugin, not upstream OpenCode providers. The plugin manages its own provider registry independent of upstream.

84 tests passing, 0 TypeScript errors.

@chentianxin
Copy link
Copy Markdown

I configured bailian-coding-plan but it didn't work; I could only manually switch models using /models.
I wonder if this PR can solve this problem.

image image image

Copy link
Copy Markdown
Contributor

@SeeYouCowboi SeeYouCowboi left a comment

Choose a reason for hiding this comment

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

Just custom your own fallback chain in your oh-my-opencode.json. And you have edited Hephaestus fallback chain, which should be no fallback.

@code-yeongyu code-yeongyu added the triage:feature-request Feature or enhancement request label Mar 24, 2026
@code-yeongyu
Copy link
Copy Markdown
Owner

[sisyphus-bot]

PR sweep first-pass triage on dev.

  • Author: ilovingjny
  • Title: feat: overhaul provider matching with opencode-go/bailian-coding-plan/kimi support
  • Closing issues: none detected
  • Review decision: none yet
  • Mergeable state: CONFLICTING (rebase needed)
  • CI status: green / no failing checks

Needs rebase + review. Please rebase onto current dev first; then a review can land cleanly.

Assigning code-yeongyu so the maintainer can prioritize a focused review of this PR. If the linked issue above has been triaged, the verdict there is the authoritative direction for this change.

@code-yeongyu code-yeongyu self-assigned this May 16, 2026
@code-yeongyu
Copy link
Copy Markdown
Owner

[sisyphus-bot] Hi ilovingjny. 🙏 Thanks for the provider-matching overhaul with opencode-go.

Picking this back up from the 5/16 triage. The PR is large (1391/402 across 28 files) and shows CONFLICTING against current dev. The provider-matching layer has seen multiple in-flight PRs ( #4018 hardcoded provider detection, #4118 google whitelist, plus the model-registry direction in #4158 and #2399 ).

The provider-matching surface is becoming crowded with parallel proposals. Could you rebase against current dev, and add a short comparison in the PR description: how does the opencode-go matching approach differ from / compose with the in-flight provider changes? That'll help the maintainer pick a coherent direction.

Once the rebase is clean and the design is clear, I'll loop a maintainer in.

@ilovingjny
Copy link
Copy Markdown
Author

Thanks for the follow-up. I added the requested comparison section to the PR description.

High-level intent for the rebase:

I will rebase against current dev, resolve the conflicts, and keep the refreshed diff focused on what is still missing.

@ilovingjny ilovingjny force-pushed the feature/provider-matching-overhaul branch from 6ba0ec8 to 3bd048d Compare May 22, 2026 00:46
@ilovingjny ilovingjny changed the title feat: overhaul provider matching with opencode-go/bailian-coding-plan/kimi support feat(cli): add bailian and minimax provider compatibility May 22, 2026
@ilovingjny
Copy link
Copy Markdown
Author

Rebased and force-pushed this PR onto current dev at 3bd048d4.

I narrowed the PR substantially after the package/model-core refactor. Current dev already covers much of the original provider-matching work, so this refresh keeps only the missing compatibility pieces:

  • bailian-coding-plan and minimax install flags, config detection, and provider availability mapping
  • Bailian fallback entries for Qwen/GLM/Kimi-compatible chains in packages/model-core
  • direct minimax/MiniMax-M2.5 support for utility-capable chains only
  • MiniMax M2.5 casing normalization for direct MiniMax-compatible providers
  • docs and focused tests

Important boundary: MiniMax is not added to Hephaestus, Oracle, Momus, deep, or ultrabrain. Existing Z.ai Librarian behavior is also preserved when Z.ai and Bailian are both configured.

For @chentianxin's question: yes, this is intended to address the case where bailian-coding-plan is configured but the generated OmO routing does not actually select it. The refreshed installer/config path now detects bailian-coding-plan/ entries and the fallback resolver can select Bailian for the supported chains. It does not force every task onto Bailian, but it should remove the need to manually switch with /models for the routes covered by the fallback chains.

Validated locally:

  • bun test src/cli/model-fallback.test.ts
  • bun test packages/model-core/src/model-requirements.test.ts packages/model-core/src/provider-model-id-transform.test.ts src/cli/provider-availability.test.ts src/cli/provider-model-id-transform.test.ts src/cli/install-validators.test.ts
  • bun test src/cli/cli-installer.test.ts src/cli/tui-installer.test.ts src/cli/cli-installer.telemetry.test.ts src/cli/config-manager/generate-omo-config.test.ts src/cli/config-manager/write-omo-config.test.ts src/cli/openai-only-model-catalog.test.ts
  • bun run typecheck
  • bun run build
  • git diff --check

I also tried the full bun test locally. It now gets past the touched provider/model areas but still has one unrelated environment-dependent failure in src/tools/delegate-task/tools.test.ts -t "browserProvider propagation" because this local checkout does not expose the external agent-browser skill.

@cubic-dev-ai please re-run the review on the new commit.

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented May 22, 2026

Rebased and force-pushed this PR onto current dev at 3bd048d4.

I narrowed the PR substantially after the package/model-core refactor. Current dev already covers much of the original provider-matching work, so this refresh keeps only the missing compatibility pieces:

  • bailian-coding-plan and minimax install flags, config detection, and provider availability mapping
    ...

@ilovingjny I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@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 26 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: The PR touches 26 files across installer, config detection, model requirements, and fallback logic, introducing two new provider paths; despite passing tests, the scope and complexity make it impossible to be 100% certain of zero regressions.

Re-trigger cubic

@code-yeongyu code-yeongyu force-pushed the dev branch 2 times, most recently from eb25d29 to 2bfad49 Compare May 23, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:feature-request Feature or enhancement request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants