fix(agent-core): honor [tools].disabled config in v1 engine - #2537
fix(agent-core): honor [tools].disabled config in v1 engine#2537C0d3N1nja97342 wants to merge 3 commits into
Conversation
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 detectedLatest commit: 82958df The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
💡 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".
| disallowedTools: [ | ||
| ...(profile.disallowedTools ?? []), | ||
| ...toolsDisabled, | ||
| ], |
There was a problem hiding this comment.
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
|
Addressed codex P1 review in |
Related Issue
Resolves #2534
Problem
[tools].disabledinconfig.tomlwas ignored by the v1 engine. v2 has a dedicatedtoolPolicyservice that reads the[tools]config section; v1'sKimiConfigSchemahas no typedtoolsfield, so the section lands inconfig.rawand is never read.What changed
In
bootstrapAgentProfile(the single entry point where v1 applies a profile to an agent), read[tools].disabledfromconfig.rawand merge it into the profile'sdisallowedToolsbefore callinguseProfile. This makessetActiveToolsfilter the disabled tools from both the top-level tool list and the subagentAgenttool description.Added a
readToolsDisabled()helper that safely extracts the string array from the raw config, returning[]when the section is absent or malformed.Checklist