Skip to content

fix(agent-core): honor [tools].disabled config in v1 engine - #2537

Open
C0d3N1nja97342 wants to merge 3 commits into
MoonshotAI:mainfrom
C0d3N1nja97342:fix/tools-disabled-v1
Open

fix(agent-core): honor [tools].disabled config in v1 engine#2537
C0d3N1nja97342 wants to merge 3 commits into
MoonshotAI:mainfrom
C0d3N1nja97342:fix/tools-disabled-v1

Conversation

@C0d3N1nja97342

Copy link
Copy Markdown

Related Issue

Resolves #2534

Problem

[tools].disabled in config.toml was ignored by the v1 engine. v2 has a dedicated toolPolicy service that reads the [tools] config section; v1's KimiConfigSchema has no typed tools field, so the section lands in config.raw and is never read.

What changed

In bootstrapAgentProfile (the single entry point where v1 applies a profile to an agent), read [tools].disabled from config.raw and merge it into the profile's disallowedTools before calling useProfile. This makes setActiveTools filter the disabled tools from both the top-level tool list and the subagent Agent tool description.

Added a readToolsDisabled() helper that safely extracts the string array from the raw config, returning [] when the section is absent or malformed.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue.
  • This PR needs a changeset (user-visible behavior change).

The [tools].disabled config was ignored in v1: KimiConfigSchema has no
typed 'tools' section (v2 uses a dedicated toolPolicy service), so the
section lands in config.raw and is never read.

Read the disabled array from config.raw in bootstrapAgentProfile and
merge it into the profile's disallowedTools before calling useProfile.
This matches v2's behavior where [tools].disabled filters tools from
both the top-level list and subagent tool descriptions.

Fixes MoonshotAI#2534
@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 82958df

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 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: e232a3b496

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

Comment on lines +790 to +793
disallowedTools: [
...(profile.disallowedTools ?? []),
...toolsDisabled,
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Apply disabled tools to spawned subagents

When [tools].disabled contains a tool used by a subagent profile, this merge only changes the profile currently passed through bootstrapAgentProfile. Spawned subagents are configured later in SessionSubagentHost.configureChild with the original catalog profile, and the Agent/AgentSwarm descriptions are also built from those unmodified catalog profiles, so a config like disabled = ["Bash"] removes Bash from the main agent but still lets the main agent launch a coder/explore subagent that advertises and receives Bash. Please compose the global disabled list into the subagent-profile/catalog path as well.

Useful? React with 👍 / 👎.

Address codex P1 review: bootstrapAgentProfile only merged disabled
tools into the main agent's profile, but subagents in
SessionSubagentHost.configureChild used the original unmodified catalog
profile. Move readToolsDisabled to public and apply the same merge in
configureChild so disabled = ['Bash'] also removes Bash from coder/
explore subagents and their Agent tool descriptions.

Fixes MoonshotAI#2534
@C0d3N1nja97342

Copy link
Copy Markdown
Author

Addressed codex P1 review in 82958df6: applied the same readToolsDisabled() merge in SessionSubagentHost.configureChild so [tools].disabled also filters tools from spawned subagents (coder/explore) and their Agent tool descriptions.

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.

[Bug] [tools].disabled is ignored by the default terminal CLI

1 participant