Skip to content

fix(agent-core-v2): preserve select_tools for disclosure - #2383

Open
lurenjia534 wants to merge 2 commits into
MoonshotAI:mainfrom
lurenjia534:fix/v2-select-tools-activation
Open

fix(agent-core-v2): preserve select_tools for disclosure#2383
lurenjia534 wants to merge 2 commits into
MoonshotAI:mainfrom
lurenjia534:fix/v2-select-tools-activation

Conversation

@lurenjia534

Copy link
Copy Markdown
Contributor

Related Issue

Resolve #2381

Problem

In the experimental v2 engine, a profile allowlist can omit select_tools while deferred MCP tools are still announced. Contribution activation applied that allowlist to the gateway before the request-time disclosure policy could apply its existing carve-out. As a result, the top-level agent could be told that deferred tools exist but receive no select_tools schema with which to load them.

What changed

  • Keep select_tools activatable when it is omitted from the profile allowlist, while continuing to honor an explicit profile disallowedTools entry.
  • Preserve the existing request-time checks for model capability, the experimental flag, global policy, the session denylist, and provider visibility.
  • Add unit coverage for both implicit gateway activation and the explicit-deny boundary.
  • Add a provider-wire regression test that applies the profile allowlist before contribution activation, matching production lifecycle ordering.

Validation

  • pnpm lint (passes with 0 errors)
  • pnpm typecheck
  • pnpm test (1,015 test files and 16,701 tests passed)
  • pnpm --filter @moonshot-ai/agent-core-v2 lint:domain
  • pnpm --filter @moonshot-ai/agent-core-v2 typecheck
  • pnpm --filter @moonshot-ai/agent-core-v2 test
  • pnpm --filter @moonshot-ai/agent-core-v2 build
  • pnpm --filter @moonshot-ai/kimi-code typecheck
  • pnpm --filter @moonshot-ai/kimi-code build
  • Regression mutation check: restoring the old activation predicate makes the provider-wire regression fail with an empty tool schema; the fixed predicate passes.

No changeset is needed because this behavior is limited to the experimental v2 engine. No documentation update is needed because no command, configuration, or usage contract changed.

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

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bb3d4c8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@lurenjia534
lurenjia534 marked this pull request as ready for review July 29, 2026 19:02
@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

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

commit: bb3d4c8

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

ℹ️ 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/test/harness/agent.ts Outdated
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.

v2 engine (headless -p): deferred MCP tools announced but select_tools never registered — top-level agent cannot call any MCP tool

1 participant