Bug Description
When a plugin registers a tool into an existing built-in toolset, the tool can exist in the live registry but still be missing from session tool definitions.
Observed case:
- plugin:
image_advanced
- tool:
image_generate_advanced
- target toolset:
image_gen
The plugin was enabled and loaded successfully, and the tool was present in the live registry under image_gen, but new sessions exposed only image_generate and not image_generate_advanced.
Steps to Reproduce
- Enable the bundled standalone plugin
image_advanced.
- Start a fresh Hermes session with
image_gen enabled.
- Verify these three layers:
registry.get_tool_names_for_toolset('image_gen')
toolsets.resolve_toolset('image_gen')
model_tools.get_tool_definitions(enabled_toolsets=['image_gen'])
- Observe that the registry layer includes
image_generate_advanced, while resolved toolsets and final tool definitions do not.
Expected Behavior
If a plugin registers a tool into an existing built-in toolset, that tool should be included in:
get_toolset(...)
resolve_toolset(...)
- final session tool definitions
Actual Behavior
Built-in toolsets are returned directly from static TOOLSETS, so plugin-added tools for that same toolset are dropped during resolution.
Example from a real run:
registry.get_tool_names_for_toolset('image_gen') -> ['image_generate', 'image_generate_advanced']
resolve_toolset('image_gen') -> ['image_generate']
get_tool_definitions(enabled_toolsets=['image_gen']) -> only image_generate
Root Cause
toolsets.get_toolset(name) returns the static built-in definition immediately when name in TOOLSETS.
That means it never merges in live registry membership for plugin-added tools targeting the same toolset.
So the system correctly loads the plugin and registers the tool, but the toolset resolver silently discards it.
Minimal Fix
For built-in toolsets, merge:
- static
TOOLSETS[name]['tools']
- live
registry.get_tool_names_for_toolset(name)
before returning the toolset definition.
Notes
I verified a local patch that makes get_toolset('image_gen'), resolve_toolset('image_gen'), and get_tool_definitions(enabled_toolsets=['image_gen']) all include both tools.
I also added a regression test covering the case where a plugin adds a tool to an existing built-in toolset.
Bug Description
When a plugin registers a tool into an existing built-in toolset, the tool can exist in the live registry but still be missing from session tool definitions.
Observed case:
image_advancedimage_generate_advancedimage_genThe plugin was enabled and loaded successfully, and the tool was present in the live registry under
image_gen, but new sessions exposed onlyimage_generateand notimage_generate_advanced.Steps to Reproduce
image_advanced.image_genenabled.registry.get_tool_names_for_toolset('image_gen')toolsets.resolve_toolset('image_gen')model_tools.get_tool_definitions(enabled_toolsets=['image_gen'])image_generate_advanced, while resolved toolsets and final tool definitions do not.Expected Behavior
If a plugin registers a tool into an existing built-in toolset, that tool should be included in:
get_toolset(...)resolve_toolset(...)Actual Behavior
Built-in toolsets are returned directly from static
TOOLSETS, so plugin-added tools for that same toolset are dropped during resolution.Example from a real run:
registry.get_tool_names_for_toolset('image_gen')->['image_generate', 'image_generate_advanced']resolve_toolset('image_gen')->['image_generate']get_tool_definitions(enabled_toolsets=['image_gen'])-> onlyimage_generateRoot Cause
toolsets.get_toolset(name)returns the static built-in definition immediately whenname in TOOLSETS.That means it never merges in live registry membership for plugin-added tools targeting the same toolset.
So the system correctly loads the plugin and registers the tool, but the toolset resolver silently discards it.
Minimal Fix
For built-in toolsets, merge:
TOOLSETS[name]['tools']registry.get_tool_names_for_toolset(name)before returning the toolset definition.
Notes
I verified a local patch that makes
get_toolset('image_gen'),resolve_toolset('image_gen'), andget_tool_definitions(enabled_toolsets=['image_gen'])all include both tools.I also added a regression test covering the case where a plugin adds a tool to an existing built-in toolset.