Skip to content

fix(agent-core-v2): degrade broken secondary-model pool entries to startup warnings - #3369

Open
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:bug-109-08-29-secondary-model-pool-soft-fail
Open

fix(agent-core-v2): degrade broken secondary-model pool entries to startup warnings#3369
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:bug-109-08-29-secondary-model-pool-soft-fail

Conversation

@sailist

@sailist sailist commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

N/A — reported via internal feedback (no public issue).

Problem

If any entry in the [secondary_model.models] pool references a model alias that no longer exists in [models] (typical after a provider is deleted or logged out), the session-startup pre-flight threw a configuration error, so every session create/resume/fork failed — the user had to hand-edit config.toml before any session could be opened at all.

What changed

Secondary-model pool problems no longer block session startup, mirroring the v1 engine's long-standing advisory semantics:

  • Effective pool view: pool entries that fail to resolve (and the reserved primary alias) are filtered out; a missing or broken default_model falls back to the first surviving entry; when nothing survives, subagents inherit the caller's model. The Agent/AgentSwarm tool descriptions and binding choices only see the surviving entries.
  • Warnings instead of errors: the create/resume/fork pre-flight now logs pool issues instead of throwing, and the session-warnings surface (SDK getSessionWarnings, GET /sessions/{id}/warnings) reports each issue as a secondary-model-invalid warning, which the TUI renders when the session opens.
  • Lazy backstop kept: a spawn that still binds a broken model — an explicit model request naming it, or a force pin — fails with the existing wrapped, actionable error naming the entry.
  • Removed the session-scope validation sentinel service (nothing consumed it; its constructor failure only produced a sticky failed DI unit).
  • Docs (en/zh) updated to the new semantics; changeset included.

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 Aug 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8ba05c6

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 29, 2026

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

commit: 8ba05c6

@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: 4096ff2ca6

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

}
}
const aliases = Object.keys(models);
if (aliases.length === 0) return { pool: undefined, issues };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Report an invalid default when the pool is empty

When [secondary_model.models] is present but empty, this early return produces no issues even if default_model is configured or required. Since the schema accepts an empty record, a configuration such as default_model = "provider/fast" followed by an empty models table silently makes subagents inherit the caller model, without the promised startup warning that the default is not a usable pool key. Validate the missing/unavailable default before returning for zero surviving aliases.

Useful? React with 👍 / 👎.

@sailist
sailist force-pushed the bug-109-08-29-secondary-model-pool-soft-fail branch from 4096ff2 to 8ba05c6 Compare August 29, 2026 13:05
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