Skip to content

feat(providers): support Qwen3.8 Max on Token Plan - #3157

Merged
Astro-Han merged 1 commit into
apache:mainfrom
MoonOld:feat/qwen38-token-plan-3156
Aug 17, 2026
Merged

feat(providers): support Qwen3.8 Max on Token Plan#3157
Astro-Han merged 1 commit into
apache:mainfrom
MoonOld:feat/qwen38-token-plan-3156

Conversation

@MoonOld

@MoonOld MoonOld commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Add qwen3.8-max as the primary Alibaba Token Plan model for China and global connections. Existing qwen3.8-max-preview selections reconcile to the formal ID, and reasoning controls now expose the documented off, low, medium, and xhigh values.

The existing OpenAI Chat wire remains unchanged. Responses, native Harness tools, and PDF materialization are tracked in #3162, #3163, and #3164.

Fixes #3156

Verification

  • npm --workspace @maka/core test — 551 passed
  • npm --workspace @maka/runtime run build
  • focused Runtime provider/factory/wire tests — 158 passed
  • targeted Biome format/lint check — passed
  • live Maka adapter: text, vision, thinking off, structured output, and two-step tool loop — passed
  • complex live E2E at xhigh: 6 model steps, 9 tool calls, operation-conflict recovery, revision reload, full candidate re-evaluation, and evidence-backed commit — passed
  • GitHub typecheck, workspaces, Runtime Host, Electron E2E, Windows recovery/sandbox/baseline — passed on the reviewed revision; checks rerun after the attribution-only amend

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex assisted with repository analysis, implementation, tests, live E2E design, and issue/PR drafting. The human contributor reviewed the changes and remains responsible for the contribution.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 12b92561-275a-4696-94c0-9161060e808f

📥 Commits

Reviewing files that changed from the base of the PR and between 734f003 and 4c771df.

📒 Files selected for processing (1)
  • packages/runtime/src/__tests__/model-factory-thinking.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime/src/tests/model-factory-thinking.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 0 remain after this review.


📝 Walkthrough

Summary

This PR adds Alibaba’s formal qwen3.8-max model to the China and global Token Plan providers.

It extends the existing provider registry and model metadata. It does not create a parallel provider path. The qwen3.8-max-preview alias reconciles persisted selections to qwen3.8-max during inventory refresh. The preview ID is not offered as a new model choice. The existing openai-chat wire remains unchanged.

The model supports a 1M context window, a 131072 output limit, vision, reasoning, structured output, function calling, and off, low, medium, and xhigh reasoning options. off maps to reasoning_effort: none. Chat-default eligibility remains supported.

Tests cover model metadata, default model selection, reasoning variants, alias reconciliation, runtime reasoning mappings, and openai-chat routing. The reported live end-to-end test passed with xhigh, six model steps, nine tool calls, conflict recovery, revision reload, candidate re-evaluation, cost-cap rejection, and final selection. The run preserved reasoning and cache-read accounting. Core tests, focused Runtime tests, builds, and Biome checks also passed. Required check status remains unverified because no direct check output was provided.

The solution is a small, coherent extension of the existing sources of truth. The alias table is necessary to migrate persisted preview selections without adding a separate provider implementation. No code or tests can be removed without weakening migration, provider-specific behavior, or regression coverage.

Review-relevant risks

The change affects user-visible model availability, persisted model selection migration, model metadata, and provider model-selection contracts. Material changes in these areas require independent human review under repository policy.

No security, licensing, release, or governance effect was identified in the current diff.

The person performing the merge must review the final diff. A maintainer makes the final determination.

Walkthrough

The change registers qwen3.8-max for both Alibaba Token Plan providers, maps the retired preview alias to it, and adds catalog, reasoning, alias, and openai-chat routing tests.

Changes

Qwen3.8 Alibaba Token Plan support

Layer / File(s) Summary
Model registration and core contracts
packages/core/src/provider-registry.ts, packages/core/src/model-metadata.ts, packages/core/src/__tests__/model-catalog.test.ts, packages/core/src/__tests__/model-thinking.test.ts
The provider allowlist and metadata define qwen3.8-max for both provider variants. Tests verify its catalog metadata and thinking levels.
Provider alias reconciliation
packages/core/src/model-metadata.ts, packages/core/src/__tests__/llm-connections.test.ts
The alias table maps qwen3.8-max-preview to qwen3.8-max. Tests verify alias-table selection and model reconciliation for both providers.
Runtime reasoning and wire contracts
packages/runtime/src/__tests__/model-factory-thinking.test.ts, packages/runtime/src/__tests__/responses-wire-contract.test.ts
Tests verify provider-specific reasoning options and confirm that qwen3.8-max uses the openai-chat wire.

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

Merge Risk: ⚪ Minimal · up to 4c771

This change adds the Qwen3.8 Max Token Plan model and updates its documented reasoning controls; no actionable merge-blocking risk remains based on the supplied evidence.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: adding Qwen3.8 Max support for Alibaba Token Plan providers.
Description check ✅ Passed The description includes the required summary, issue reference, verification results, AI-use disclosure, and completed checklist items.
Linked Issues check ✅ Passed The changes implement the linked issue objectives for model selection, alias migration, metadata, reasoning controls, Chat routing, and supporting tests.
Out of Scope Changes check ✅ Passed The production and test changes are directly related to Qwen3.8 Max support and the linked issue requirements.
Ai Use Disclosure ✅ Passed The PR selects substantive generative tooling and names OpenAI Codex with scope; its sole introduced commit has the matching standalone Generated-by: OpenAI Codex trailer.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copilot AI 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.

Pull request overview

Adds first-class selection + verification coverage for Alibaba Token Plan’s documented flagship model ID qwen3.8-max-preview, ensuring it is the primary fallback for both China and global Token Plan providers while remaining distinct from qwen3.8-max.

Changes:

  • Adds qwen3.8-max-preview as the first curated fallback model ID for Alibaba Token Plan (CN + global) in the provider registry.
  • Pins/validates the preview model’s catalog projection (display name, 1M context, 131072 max output, modalities, and capability flags) and reasoning effort contract (low/medium/xhigh, no off).
  • Adds runtime contract tests asserting Token Plan continues using the OpenAI Chat wire for the preview model until Responses support is implemented, and that reasoning effort options are passed through without inventing an off wire.

Reviewed changes

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

Show a summary per file
File Description
packages/runtime/src/tests/responses-wire-contract.test.ts Asserts Token Plan keeps qwen3.8-max-preview on openai-chat wire (not Responses) for now.
packages/runtime/src/tests/model-factory-thinking.test.ts Verifies Token Plan reasoning effort options for qwen3.8-max-preview and that unsupported off yields no provider options.
packages/core/src/provider-registry.ts Adds qwen3.8-max-preview to the curated Token Plan fallback model allowlist (top priority).
packages/core/src/tests/model-thinking.test.ts Ensures preview model exposes low/medium/xhigh only and rejects off at the thinking-level resolver layer.
packages/core/src/tests/model-catalog.test.ts Validates catalog entry properties/capabilities for preview model and that it’s the default fallback for both Token Plan providers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@MoonOld
MoonOld force-pushed the feat/qwen38-token-plan-3156 branch from b36d47e to 2f152d2 Compare August 17, 2026 09:25
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 09:25
@MoonOld MoonOld changed the title feat(providers): support Qwen3.8 Max Preview on Token Plan feat(providers): support Qwen3.8 Max on Token Plan Aug 17, 2026

Copilot AI 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.

Pull request overview

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

Suppressed comments (1)

packages/core/src/provider-registry.ts:505

  • PR title/description state that qwen3.8-max-preview is added as the first Alibaba Token Plan fallback and kept distinct from qwen3.8-max, but the code change here does the opposite: it adds the formal billed id qwen3.8-max to the curated fallback list and treats the preview id as a retired compatibility alias elsewhere. Please update the PR title/description (and any release notes/changelog text) to match the implemented behavior so readers don’t walk away thinking the preview id is being offered for new selections.
  // qwen3.8-max-preview is a retired compatibility alias which the service
  // routes to this formal id. New selections must use the billed model id.
  'qwen3.8-max',
  'qwen3.7-max',

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

🧹 Nitpick comments (1)
packages/core/src/__tests__/llm-connections.test.ts (1)

4-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the object-identity assertion and its import.

assert.equal(modelIdAliasesForProvider(providerType), ALIBABA_TOKEN_PLAN_MODEL_ID_ALIASES) tests that the function returns the exact object reference. It does not test the provider behavior. The reconciliation assertion below already verifies the alias result for both providers.

Delete the import on Line 4 and the identity assertion on Lines 177-181.

As per path instructions: flag tests that assert implementation details or duplicate existing coverage.

Also applies to: 176-195

Source: Path instructions


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 69987180-c30f-474d-b9c2-5c64ed7d4a1c

📥 Commits

Reviewing files that changed from the base of the PR and between b36d47e and 2f152d2.

📒 Files selected for processing (7)
  • packages/core/src/__tests__/llm-connections.test.ts
  • packages/core/src/__tests__/model-catalog.test.ts
  • packages/core/src/__tests__/model-thinking.test.ts
  • packages/core/src/model-metadata.ts
  • packages/core/src/provider-registry.ts
  • packages/runtime/src/__tests__/model-factory-thinking.test.ts
  • packages/runtime/src/__tests__/responses-wire-contract.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/core/src/tests/model-thinking.test.ts
  • packages/runtime/src/tests/responses-wire-contract.test.ts
  • packages/runtime/src/tests/model-factory-thinking.test.ts
  • packages/core/src/tests/model-catalog.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.

@MoonOld

MoonOld commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Additional complex live E2E completed on qwen3.8-max at xhigh through Maka's real Chat adapter:

  • 6 model steps / 9 tool calls
  • nested object + array tool arguments
  • first evaluation returned operation_conflict at revision 1
  • model reloaded revision 2 and re-evaluated all three candidates
  • rejected the higher-headroom candidate because it exceeded the cost cap
  • committed the admissible maximum-headroom candidate with exact p95/cost/headroom evidence
  • 1,347 reasoning characters preserved; 12,907 input tokens, including 7,168 cache-read tokens; final decision matched every asserted value

No reasoning replay, tool identity, or recovery error occurred. The only warning was the already-tracked dashed provider-options deprecation in #1430.

@MoonOld
MoonOld force-pushed the feat/qwen38-token-plan-3156 branch from 2f152d2 to 734f003 Compare August 17, 2026 09:40
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 09:40

Copilot AI 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.

Pull request overview

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

Suppressed comments (1)

packages/runtime/src/tests/model-factory-thinking.test.ts:245

  • This test hard-codes the providerOptions namespace to the dashed providerType string. The runtime’s openai-compatible path documents that dashed keys are deprecated and emit a warning on every generation result, and #1430 tracks moving these namespaces to camelCase. To avoid cementing the deprecated shape (and reduce churn when the namespace is migrated), assert the reasoningEffort values without depending on the exact namespace key (or allow either dashed or camelCase).
  test('Alibaba Token Plan sends the formal Qwen3.8 effort and disable wires', () => {
    for (const providerType of ['alibaba-token-plan-cn', 'alibaba-token-plan'] as const) {
      assert.deepEqual(
        buildProviderOptions(conn(providerType), 'qwen3.8-max', 'xhigh'),
        { [providerType]: { reasoningEffort: 'xhigh' } },

@MoonOld
MoonOld force-pushed the feat/qwen38-token-plan-3156 branch from 734f003 to ad4c45d Compare August 17, 2026 09:45
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 09:45
@MoonOld

MoonOld commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Ready for human review

The PR description now reflects the final formal-ID contract and the complete validation evidence:

This changes user-visible provider selection, so an independent human approval is requested under the repository review policy.

@MoonOld

MoonOld commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@Astro-Han Could you please review and approve this provider change once the latest CI run completes? The final diff uses the formal qwen3.8-max ID, migrates the retired Preview alias, and has both contract coverage and live Maka E2E evidence. Thank you.

Copilot AI 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.

Pull request overview

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

@MoonOld
MoonOld force-pushed the feat/qwen38-token-plan-3156 branch from ad4c45d to 4c771df Compare August 17, 2026 10:16
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 10:16
@MoonOld

MoonOld commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest Copilot review suggestion: the Qwen3.8 reasoning-options test now verifies the single emitted reasoningEffort payload without pinning the deprecated dashed provider-options namespace. This keeps the test compatible with the #1430 namespace migration. Focused Runtime build/test and Biome check pass.

Copilot AI 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.

Pull request overview

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

@Astro-Han

Copy link
Copy Markdown
Contributor

Thanks for the addition — the problem is real (Token Plan has no /models discovery contract, so availability is pinned by the alibabaTokenPlanModelIds allowlist, which stopped at qwen3.7-max while qwen3.8-max already existed in the generated metadata), and the fix is minimal: one id at the head of the allowlist (which flows into fallbackModels[0]), a static thinking-metadata override, and reuse of the existing modelIdAliasesForProvider/supersededModelId mechanism for the preview→formal migration. No parallel implementation, no copied state. I ran the affected core test files locally (20/20 pass) and confirmed no overlap with #2659 (different provider namespace qwen/qwen3.8-max vs atlas-cloud). CI is green.

Conclusion: PASS — no blocking findings (no P0/P1/P2).

P3 (optional): the same thinkingOptions object is inlined twice for cn/global at model-metadata.ts:317-326 (could share a const, matching the CLAUDE_SUBSCRIPTION_MODEL_METADATA pattern); the static override extends the models.dev-generated efforts ['low','medium','xhigh'] with 'none' — correctness of the off tier rests on your local testing, so a comment citing the source would help future maintainers; the retired preview id remains in the generated catalog (already documented as an intentional server-compat alias).


AI-assisted review disclosure: this review was produced with AI assistance (pi review subagent on ollama-cloud/deepseek-v4-flash). The subagent ran the affected core tests locally (20/20) and cross-checked the model metadata against the generated catalog; the P3 items are static observations. Please weigh these findings with your own judgment.

中文摘要(AI 辅助审查)

结论:PASS,无阻塞项。问题真实(Token Plan 无 /models 发现契约,可用性靠 alibabaTokenPlanModelIds 白名单 pin,此前止于 qwen3.7-max,而 qwen3.8-max 已在生成元数据中),修复最小(白名单首位加 1 个 id → 自动成为 fallbackModels[0]、静态 thinking 元数据覆盖、复用现有 alias/superseded 机制做 preview→formal 迁移)。无并行实现、无复制状态。本地实跑受影响 core 测试 20/20 通过;与 #2659 无重叠(不同 provider 命名空间)。P3(可选):thinkingOptions 对象 cn/global 内联两次可提共享 const;静态覆盖把 models.dev 生成的 efforts 扩为含 'none'(off 档正确性依赖作者实测背书,建议注释注明依据);退役 preview id 仍在生成目录(已声明为有意服务端兼容别名)。

@Astro-Han
Astro-Han merged commit 834488f into apache:main Aug 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(providers): complete Qwen3.8 Max support for Alibaba Token Plan

3 participants