Skip to content

Plugin-added tools are dropped when they target an existing built-in toolset #18314

@MaxMarsh301

Description

@MaxMarsh301

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

  1. Enable the bundled standalone plugin image_advanced.
  2. Start a fresh Hermes session with image_gen enabled.
  3. 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'])
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/pluginsPlugin system and bundled pluginscomp/toolsTool registry, model_tools, toolsetssweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions