fix(cli): guard disabled_toolsets on partial CLI instances

show_banner/_show_status call get_tool_definitions with disabled_toolsets,
but test and early-init paths build HermesCLI via __new__ without running
__init__, so self.disabled_toolsets was missing and CI failed with
AttributeError in test_cli_context_warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
aydnOktay
2026-08-28 16:47:18 +03:00
committed by kshitij
parent 2494eadb39
commit e2d738f89d
3 changed files with 5 additions and 5 deletions

View File

@@ -134,7 +134,7 @@ class CLIInfoMixin:
from model_tools import get_toolset_for_tool
tools = get_tool_definitions(
enabled_toolsets=self.enabled_toolsets,
disabled_toolsets=self.disabled_toolsets, quiet_mode=True)
disabled_toolsets=getattr(self, "disabled_toolsets", None), quiet_mode=True)
availability = compute_toolset_availability(self.enabled_toolsets)
tmap = _toolset_map(tools, availability, get_toolset_for_tool)
save_banner_snapshot(tools, self.enabled_toolsets, availability, tmap)
@@ -148,7 +148,7 @@ class CLIInfoMixin:
# Cold path: compute live, then persist the snapshot for the next launch.
from model_tools import get_toolset_for_tool
tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,
disabled_toolsets=self.disabled_toolsets, quiet_mode=True)
disabled_toolsets=getattr(self, "disabled_toolsets", None), quiet_mode=True)
availability = compute_toolset_availability(self.enabled_toolsets)
build_welcome_banner(tools=tools, availability=availability, **banner_kw)
try:
@@ -357,7 +357,7 @@ class CLIInfoMixin:
# Pre-assembly list: /tools is a discovery surface, so it must show the full catalog
# including tools deferred behind the tool_search bridge (users verify MCP installs here).
tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,
disabled_toolsets=self.disabled_toolsets, quiet_mode=True,
disabled_toolsets=getattr(self, "disabled_toolsets", None), quiet_mode=True,
skip_tool_search_assembly=True)
if not tools:
print("(;_;) No tools available")

View File

@@ -83,7 +83,7 @@ class CLILoopsMixin:
cc.print(_build_compact_banner())
else:
tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,
disabled_toolsets=self.disabled_toolsets, quiet_mode=True)
disabled_toolsets=getattr(self, "disabled_toolsets", None), quiet_mode=True)
agent = getattr(self, "agent", None)
ctx_len = None
if agent and hasattr(agent, "context_compressor"):

View File

@@ -217,7 +217,7 @@ class CLISessionMixin:
tool_status = "tools deferred"
else:
tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,
disabled_toolsets=self.disabled_toolsets, quiet_mode=True)
disabled_toolsets=getattr(self, "disabled_toolsets", None), quiet_mode=True)
tool_status = f"{len(tools) if tools else 0} tools"
model_short = self.model.split("/")[-1] if "/" in self.model else self.model