fix(acp): pass agent.disabled_toolsets to AIAgent — config-disabled tools stay executable over ACP - #57421
fix(acp): pass agent.disabled_toolsets to AIAgent — config-disabled tools stay executable over ACP#574215uck1ess wants to merge 2 commits into
Conversation
…ools stayed executable over ACP
The CLI (cli.py: CLI_CONFIG['agent'].get('disabled_toolsets')) and the
gateway (gateway/run.py) both read agent.disabled_toolsets from config
and pass it to AIAgent. The ACP adapter's _make_agent never did, so
state.agent.disabled_toolsets was always None and the ACP tool-registry
rebuild (acp_adapter/server.py -> get_tool_definitions) included every
tool in the enabled toolsets — a toolset the user disabled in config
(todo, browser, ...) remained fully executable in editor/ACP sessions.
Observed live: a 'todo' tool call executed from a profile whose config
lists todo in agent.disabled_toolsets.
Read agent.disabled_toolsets in _make_agent and pass it through,
mirroring the CLI and gateway paths.
Claude-Session: https://claude.ai/code/session_01YNvCUipheR7yx4VorUL2jW
|
Thanks for tracing this ACP-specific construction gap. The premise is confirmed on current main: Problems
Suggested changes
This is an automated hermes-sweeper review. |
…l coverage Review follow-up: _cmd_tools rebuilt its listing without state.agent.disabled_toolsets, so a config-disabled toolset was filtered from execution but still advertised by /tools. Pass it through, matching the session tool-surface rebuild. New tests exercise the real get_tool_definitions (no patching) and assert a disabled toolset is absent from both the /tools listing and the rebuilt valid_tool_names — with a baseline assertion that the toolset is present when nothing is disabled, so the check cannot pass vacuously.
|
Both points addressed in 040b08c:
|
|
Independent current-main validation supports keeping this original PR rather than the newer duplicate #74617.
This PR is broader than #74617 because it also filters the ACP /tools listing and already has non-vacuous behavioral coverage for both advertised and executable tools. GitHub currently reports it mergeable and rebaseable. I recommend refreshing its base and closing the duplicate. In short, this is the original branch worth “Stayin' Alive.” |
Problem
agent.disabled_toolsetsinconfig.yamlis honored by the CLI (cli.py:CLI_CONFIG['agent'].get('disabled_toolsets')) and the gateway (gateway/run.py:12782) — both pass it toAIAgent. The ACP adapter's_make_agentnever does.Consequence:
state.agent.disabled_toolsetsis alwaysNoneon the ACP path, so the tool-registry rebuild inacp_adapter/server.pycallsget_tool_definitions(enabled_toolsets=..., disabled_toolsets=None)and every tool in the enabled toolsets stays registered and executable — including toolsets the user explicitly disabled in config.Observed live driving hermes over ACP: a
todotool call executed from a profile whose config liststodoinagent.disabled_toolsets.Related family of reports on other surfaces: #36729 (WebUI), #54433 (desktop). This PR fixes the ACP surface. Sibling PR #57418 fixes the same construction gap for
fallback_model(#18452) —_make_agentbuilds its kwargs from scratch and has drifted from what the CLI/gateway pass.Fix
Read
agent.disabled_toolsetsfrom the loaded config in_make_agentand pass it toAIAgent, mirroring the CLI and gateway. Guarded by anisinstancecheck consistent with the surrounding config handling.Verification
Two new tests in
tests/acp/test_session.py(chain passes through when configured; key absent otherwise). Full file: 47 passed.https://claude.ai/code/session_01YNvCUipheR7yx4VorUL2jW