fix(setup): exclude posture toolsets from blank-slate disabled_toolsets

Blank Slate's _blank_slate_minimal_toolsets() adds every TOOLSETS entry
to agent.disabled_toolsets except file and terminal.  The coding
posture toolset (session-level, selected by agent/coding_context.py)
slips through because the loop only skips hermes-* composites and
includes-only groups.

At runtime, model_tools.get_tool_definitions() resolves coding and
subtracts its tools — terminal, read_file, write_file, patch,
search_files, process — erasing the entire Blank Slate minimal surface.
The agent ends up with only cronjob.

Skip posture toolsets in the disabled-list computation.  Posture
toolsets are not user-facing capabilities to disable; they are
per-session selections that should never appear in agent.disabled_toolsets.

Fixes #57315
This commit is contained in:
liuhao1024 2026-07-03 04:21:22 +08:00 committed by Teknium
parent c9adbaff5e
commit b57fe5ca01
2 changed files with 41 additions and 0 deletions

View file

@ -3054,6 +3054,12 @@ def _blank_slate_minimal_toolsets(config: dict):
continue # platform composites — not user-facing toolsets
if isinstance(tdef, dict) and tdef.get("includes"):
continue # composite groupings, not leaf toolsets
if isinstance(tdef, dict) and tdef.get("posture"):
continue # posture toolsets (e.g. coding) are session-level
# selections made by agent/coding_context.py — not permanent
# user-facing disables. Adding them here causes model_tools
# to subtract their tools (terminal, read_file, …) from the
# minimal Blank Slate surface (#57315).
all_keys.add(k)
disabled = sorted(all_keys - keep)

View file

@ -34,6 +34,17 @@ class TestBlankSlateMinimalToolsets:
# The recovered non-configurable toolset that used to leak is suppressed.
assert "kanban" in disabled
def test_disabled_toolsets_excludes_posture_toolsets(self):
"""Posture toolsets (e.g. coding) are session-level selections made by
agent/coding_context.py not permanent user-facing disables. Including
them in disabled_toolsets causes model_tools to subtract their tools
(terminal, read_file, ) from the minimal Blank Slate surface (#57315).
"""
cfg = {}
_blank_slate_minimal_toolsets(cfg)
disabled = set(cfg["agent"]["disabled_toolsets"])
assert "coding" not in disabled
def test_resolver_yields_exactly_file_and_terminal(self):
from hermes_cli.tools_config import _get_platform_tools
cfg = {}
@ -59,6 +70,30 @@ class TestBlankSlateMinimalToolsets:
assert names == ["patch", "process", "read_file", "search_files",
"terminal", "write_file"]
def test_tool_schema_survives_disabled_toolsets_from_config(self):
"""Regression: disabled_toolsets must not erase the minimal Blank Slate
surface when passed to model_tools. Before the fix, posture toolsets
like ``coding`` in disabled_toolsets caused model_tools to subtract
terminal, read_file, write_file, etc. (#57315).
"""
import model_tools
from hermes_cli.tools_config import _get_platform_tools
cfg = {}
_blank_slate_minimal_toolsets(cfg)
_blank_slate_minimize_config(cfg)
enabled = sorted(_get_platform_tools(cfg, "cli"))
disabled = cfg.get("agent", {}).get("disabled_toolsets") or []
defs = model_tools.get_tool_definitions(
enabled_toolsets=enabled,
disabled_toolsets=disabled,
quiet_mode=True,
)
names = sorted(
{(d.get("function") or {}).get("name") or d.get("name") for d in defs}
)
assert names == ["patch", "process", "read_file", "search_files",
"terminal", "write_file"]
class TestBlankSlateMinimizeConfig:
def test_optional_features_turned_off(self):