You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hermes prompt-size over-counts tools by not respecting enabled/disabled toolsets #41445
hermes prompt-size --platform <platform> reports a tool count that is higher than the actual number of tools available in a real session for that platform.
Steps to Reproduce
Configure toolsets via hermes tools for the feishu platform (e.g. disable some toolsets like web, tts, delegation)
Run hermes prompt-size --platform feishu
Compare the reported tool count with the actual tools visible in a feishu session
Expected Behavior
The tool count and tool-schema byte size should match what is actually sent to the model in a real gateway session for that platform.
Actual Behavior
prompt-size reports 37 tools (52.1 KB tool schemas), but the actual feishu session only has 31 tools — a discrepancy of 6 tools.
Root Cause
In hermes_cli/prompt_size.py, _build_inspection_agent() constructs an offline AIAgent with only platform=platform but does not pass enabled_toolsets or disabled_toolsets:
In contrast, the actual gateway resolves toolsets via _get_platform_tools(user_config, platform_key) and passes both enabled_toolsets and disabled_toolsets to AIAgent.__init__().
Suggested Fix
_build_inspection_agent() should call _get_platform_tools() (and read disabled_toolsets from config) the same way the gateway does, so the diagnostic reflects the real tool surface.
This is fixed by #41461 — it passes enabled_toolsets (from _get_platform_tools()) and disabled_toolsets (from agent.disabled_toolsets config) to the inspection agent, so the reported tool count matches what the gateway actually sends.
_build_inspection_agent() in hermes_cli/prompt_size.py reads agent.disabled_toolsets from config but does not call _get_platform_tools(cfg, platform) to resolve platform_toolsets filtering.
This means enabled_toolsets=None is passed to AIAgent, which causes _compute_tool_definitions() (model_tools.py:386-390) to fall through to the "default: start with everything" branch — including ALL tools from ALL toolsets — and only subtract disabled_toolsets afterward.
In contrast, the interactive CLI (cli_commands_mixin.py:463) and gateway (gateway/run.py) both call _get_platform_tools() first, getting a restricted toolset list that respects platform_toolsets configuration.
Fix
Add _get_platform_tools() resolution in _build_inspection_agent():
This mirrors the interactive CLI path so the diagnostic reflects the real tool surface.
Note on "same output" for profiles
When ~/.hermes/active_profile is set (e.g. to auditor), both hermes prompt-size and hermes -p auditor prompt-size load the same config, so outputs are identical — this is expected behavior, not a bug in profile resolution.
Activity
liuhao1024 commentedon Jun 7, 2026
This is fixed by #41461 — it passes
enabled_toolsets(from_get_platform_tools()) anddisabled_toolsets(fromagent.disabled_toolsetsconfig) to the inspection agent, so the reported tool count matches what the gateway actually sends.529349029 commentedon Jun 25, 2026
Root cause confirmed
_build_inspection_agent()inhermes_cli/prompt_size.pyreadsagent.disabled_toolsetsfrom config but does not call_get_platform_tools(cfg, platform)to resolveplatform_toolsetsfiltering.This means
enabled_toolsets=Noneis passed toAIAgent, which causes_compute_tool_definitions()(model_tools.py:386-390) to fall through to the "default: start with everything" branch — including ALL tools from ALL toolsets — and only subtractdisabled_toolsetsafterward.In contrast, the interactive CLI (
cli_commands_mixin.py:463) and gateway (gateway/run.py) both call_get_platform_tools()first, getting a restricted toolset list that respectsplatform_toolsetsconfiguration.Fix
Add
_get_platform_tools()resolution in_build_inspection_agent():This mirrors the interactive CLI path so the diagnostic reflects the real tool surface.
Note on "same output" for profiles
When
~/.hermes/active_profileis set (e.g. toauditor), bothhermes prompt-sizeandhermes -p auditor prompt-sizeload the same config, so outputs are identical — this is expected behavior, not a bug in profile resolution.fix(prompt-size): respect enabled/disabled toolsets per platform
fix(prompt-size): respect enabled/disabled toolsets per platform
fix(prompt-size): respect enabled/disabled toolsets per platform
fix(prompt-size): respect enabled/disabled toolsets per platform
fix(prompt-size): respect enabled/disabled toolsets per platform
fix(prompt-size): respect enabled/disabled toolsets per platform