Skip to content

fix: resolve model capabilities from bundled catalog#2150

Open
NarwhalChen wants to merge 4 commits into
MoonshotAI:mainfrom
NarwhalChen:refactor/models-dev-capability-fallback
Open

fix: resolve model capabilities from bundled catalog#2150
NarwhalChen wants to merge 4 commits into
MoonshotAI:mainfrom
NarwhalChen:refactor/models-dev-capability-fallback

Conversation

@NarwhalChen

@NarwhalChen NarwhalChen commented Jul 24, 2026

Copy link
Copy Markdown

Related issue

Related: #2023

Follow-up to #2036, where the model catalog review exposed that thinking profiles and general capabilities can drift independently. This also carries the capability-fallback direction from #1660 onto the current v1/v2 architecture.

@RealKai42, could you take a look since this follows the catalog/capability review in #2036?

Problem

When a configured model does not declare every capability, runtime detection can fall through to hand-maintained static matchers even though the bundled models.dev snapshot already has the metadata.

Protocol identity is not enough to choose the right catalog provider. For example, the provider in #2023 must use type = "openai" to speak the OpenAI-compatible protocol, but its capability metadata belongs under the deepseek provider in models.dev. Treating type as both protocol and catalog vendor either misses the metadata or requires unsafe guessing.

What changed

  • Add an optional catalog_provider to provider config. It selects the exact models.dev provider used for capability metadata without changing the API protocol selected by type.
  • Keep the compatibility policy deliberately narrow:
    • an explicit catalog_provider wins;
    • official provider types use their known models.dev provider by default;
    • the configured model is looked up only within that provider;
    • Kimi Code never guesses from the local provider name or scans unrelated vendors;
    • existing static matchers remain the final fallback before UNKNOWN.
  • Persist the original models.dev provider id when /provider imports a catalog entry, including when the user chooses a different local provider name.
  • Pass the catalog provider and resolved provider mode through the v2 capability resolver. Existing google-genai configurations running in Vertex mode now use the google-vertex snapshot instead of the ordinary Google snapshot.
  • Keep context/input/output limits owned by model configuration; the snapshot fallback only supplies model capabilities.
  • Document the new field and the exact DeepSeek configuration from [TUI] Thinking toggle unavailable for reasoning-capable third-party models (openai provider), even though thinkingEffort is sent #2023 in both locales.

For the manual setup in #2023, adding catalog_provider = "deepseek" selects the right metadata while keeping type = "openai". If a gateway replaces the canonical models.dev model id with an arbitrary deployment alias, the user must continue to declare capabilities explicitly.

Verification

  • After the final simplification, 313 focused agent-core / agent-core-v2 tests passed.
  • Typechecks passed for agent-core, agent-core-v2, node-sdk, and the CLI.
  • agent-core-v2 domain lint and config-manifest check passed.
  • The bilingual docs build passed.
  • A read-only final diff audit confirmed that the removed model-level catalog override no longer appears in the schema, runtime, manifest, tests, or docs, while catalog_provider remains intact.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 38876aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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: ca917a3a10

ℹ️ 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 thread packages/agent-core-v2/src/app/kosongConfig/modelsDevCapability.contrib.ts Outdated
@NarwhalChen

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 38876aa2b1

ℹ️ 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".

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.

1 participant