Skip to content

fix(agent-core-v2): activate select tools for disclosure - #2384

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

fix(agent-core-v2): activate select tools for disclosure#2384
huige66631 wants to merge 2 commits into
MoonshotAI:mainfrom
huige66631:codex/fix-v2-select-tools-activation

Conversation

@huige66631

Copy link
Copy Markdown

Problem

In v2 headless runs with progressive tool disclosure enabled, the main agent is told to use select_tools for MCP tools, but AgentToolActivationService only registers tools present in the profile allowlist. The built-in agent profile includes mcp__* but omits select_tools, leaving the gateway absent from the runtime schema.

Solution

Keep normal contribution activation unchanged and add a narrow exception for the disclosure gateway. When the contribution is select_tools, progressive disclosure is enabled, and the disclosure policy permits it, activation registers the tool even when the profile allowlist omits it. This reuses the existing disclosure gate and explicit-disable policy instead of modifying profile definitions.

Changes

  • Register select_tools through the existing disclosure gate in v2 tool activation.
  • Add activation tests for the enabled path, closed gate, and explicit policy denial.
  • Add a patch changeset for @moonshot-ai/kimi-code.

Testing

  • pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run test/agent/toolActivation/toolActivationService.test.ts test/agent/toolSelect/toolSelect.e2e.test.ts
  • pnpm --filter @moonshot-ai/agent-core-v2 run typecheck
  • pnpm exec oxlint --type-aware packages/agent-core-v2/src/agent/toolActivation/toolActivationService.ts packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts

The focused tests cover registration when the profile omits select_tools, behavior when disclosure is disabled, explicit policy denial, and the existing select-to-MCP execution flow.

Notes for Reviewer

  • The exception is intentionally limited to select_tools; all other contributions retain ordinary profile allowlist behavior.
  • isToolActiveForDisclosure() preserves global, session, and explicit deny controls.
  • The complete package test suite was also attempted locally on Windows; unrelated filesystem, symlink-permission, and path-separator tests fail in that environment.

Fixes #2381

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5202a5

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

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