Skip to content

feat(agent-core-v2): warn on [models] entries missing the model field - #3681

Merged
7Sageer merged 2 commits into
mainfrom
warn-malformed-models-entry
Sep 9, 2026
Merged

feat(agent-core-v2): warn on [models] entries missing the model field#3681
7Sageer merged 2 commits into
mainfrom
warn-malformed-models-entry

Conversation

@7Sageer

@7Sageer 7Sageer commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Resolve #3609

Problem

A [models] entry written with an unquoted dotted TOML table name (e.g. [models.kimi-k2.7-code]) parses as nested tables, so the resulting entry has no model/name field. Since #2981 / #3003 it no longer crashes, but it stays silently unusable: the picker shows the truncated alias and the entry only fails at selection time with Model "kimi-k2" must define a wire-facing name in config.toml., with nothing pointing at the actual mistake.

What changed

  • Added collectMalformedModelEntries, a load-time collector that scans the raw [models] TOML entries and emits a warning config diagnostic for every entry missing both model and name. When the entry contains a stray nested table (the tell-tale shape of an unquoted dotted alias, excluding the legitimate oauth/overrides object fields), the message reconstructs the intended alias and shows the quoted form, e.g. [models."kimi-k2.7-code"].
  • Wired it into ConfigService.load() next to collectKeyDeprecations, before the no-op-reload early return, so the warning surfaces through the existing diagnostics channel (TUI boot warnings, run-prompt stderr, kap-server config warnings) and clears on reload once the entry is fixed.

This follows the existing key-deprecation diagnostics path rather than adding a new surfacing mechanism, so all consumers pick it up for free.

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 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c0a432c

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

@7Hanrui

7Hanrui commented Sep 9, 2026

Copy link
Copy Markdown

@codex review

@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026

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

commit: c0a432c

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 56f5c7220e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

… models section

Move collectMalformedModelEntries next to ModelRecordSchema and derive
the known object-field set from the schema shape instead of hardcoding
it, so future object fields cannot drift out of sync. Sections now
contribute load-time diagnostics through a collectDiagnostics hook,
mirroring the deprecations contribution.
@7Sageer
7Sageer merged commit 1306a9a into main Sep 9, 2026
15 checks passed
@7Sageer
7Sageer deleted the warn-malformed-models-entry branch September 9, 2026 13:18
@github-actions github-actions Bot mentioned this pull request Sep 9, 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.

Warn on [models] entries missing the model field (malformed TOML table names)

2 participants