Skip to content

fix(agent-core-v2): fall back to the configured default model for image format gating - #3652

Merged
RealKai42 merged 1 commit into
mainfrom
fix/default-model-image-format-gate
Sep 8, 2026
Merged

fix(agent-core-v2): fall back to the configured default model for image format gating#3652
RealKai42 merged 1 commit into
mainfrom
fix/default-model-image-format-gate

Conversation

@RealKai42

Copy link
Copy Markdown
Collaborator

Related Issue

Follow-up to #3649 (no tracking issue; gap found during end-to-end smoke testing of that PR).

Problem

#3649 made image format acceptance provider-aware, but every gate resolved the provider type only from the bound model. A fresh session that has not explicitly bound a model yet (no per-request model, no agent_config selection) has an empty profile alias, so getModelProviderType() returned undefined and every gate fell back to the baseline PNG/JPEG/GIF/WebP set. Two supported flows hit this:

  • A first prompt with a HEIC/HEIF/BMP attachment on a session whose default_model is served by Kimi: the image was persisted as an attachment and replaced by a text notice even though the turn's effective model is the Kimi default.
  • A first prompt that selects a profile without naming a model: bind() falls back to the configured default_model, but the kap-server route runs media resolution before the bind, so the gate saw undefined again.

What changed

IAgentProfileService.getModelProviderType(alias?) now resolves alias ?? boundModelAlias ?? config defaultModel before consulting the catalog, mirroring the fallback bind() itself applies. One change covers every consumer (prompt-entry gate, kap-server prompt/skill routes, MCP tool results). Explicit alias and bound-model resolution are unchanged; when neither a bound model nor a resolvable default exists, the method still returns undefined and gates keep the baseline set.

Tests (red-first): profile-level fallback including precedence and non-Kimi/missing defaults (profileOps.test.ts); kap-server route regressions for both flows above (prompts.test.ts). Verified with the full agent-core-v2 / kap-server / acp-server / klient suites plus a live end-to-end smoke (real server process, mock OpenAI-compatible provider, sips-generated HEIC/BMP files): 20/20 checks pass, including the previously failing unbound-first-prompt case.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • 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 Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 13a99fd

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 commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T12:15:59.702798Z 13a99fd PR opened
🔒 Security Review Completed 2026-09-08T12:16:07.579458Z 13a99fd PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 8, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@13a99fd
npx https://pkg.pr.new/@moonshot-ai/kimi-code@13a99fd

commit: 13a99fd

@RealKai42
RealKai42 merged commit 7f5debf into main Sep 8, 2026
15 of 16 checks passed
@RealKai42
RealKai42 deleted the fix/default-model-image-format-gate branch September 8, 2026 12:42
@github-actions github-actions Bot mentioned this pull request Sep 8, 2026
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