Repository navigation
fix(toolsets): validate configured plugin toolsets before discovery finishes - #111322
budokai-msi wants to merge 1 commit into
Conversation
…inishes
`validate_toolset()` resolved plugin toolset names against the live tool
registry, which is empty until plugin discovery completes. Plugin discovery
is started on a background thread to overlap the rest of CLI startup, so any
fast path that validates configured toolset names first — `hermes chat` does,
via `_init_toolsets` — compared them against an empty set and printed
Warning: Unknown toolsets: dsh
for a perfectly valid, explicitly enabled plugin toolset. The name is
correct; only the timing was wrong, so the warning was unactionable noise on
every launch (and the plugin's tools still loaded once discovery landed).
Resolve declared plugin keys without joining discovery:
`hermes_cli.plugins.get_plugin_toolset_keys_nowait()` already exists for
exactly this — it serves last launch's persisted key set while a background
scan is in flight and blocks via `discover_plugins()` only when there is no
scan to wait on, with a persisted-cache staleness contract that is harmless
for callers that only validate names.
`get_toolset()` deliberately keeps reading the live registry alone: name
validation must not invent tooling, so a declared-but-not-yet-loaded plugin
toolset still resolves to zero tools. A regression test pins that, alongside
the validation itself.
Related: #84499 and #89345 are open PRs for the same startup race (plugin toolsets flagged unknown before background discovery finishes; issue #86231). This PR resolves declared keys via |
|
Independent reproduction on a different install shape; the timing analysis here matches what I see. git install on Debian 13, hermes-agent 0.21.x. A plugin registers its own toolset ( One data point on the shape of the fix: a local workaround that exempts names produced by the config resolver ( |
Symptom
An explicitly enabled plugin toolset is reported as unknown on every CLI launch:
dshis a real, valid, enabled plugin toolset (hermes tools listshows it asenabled, and its tool registers correctly). The name is right; only the timing
is wrong.
Root cause
validate_toolset()resolved plugin toolset names against the live toolregistry:
Plugin discovery runs on a background thread to overlap the rest of CLI
startup (
plugins.start_background_plugin_discovery()), and plugins registertheir toolsets during that load. The CLI validates configured toolset names on
its own fast path (
cli.HermesCLI._init_toolsets, viahermes_cli/main.py:cmd_chat), so when it gets there first the registry isstill empty and every configured plugin toolset looks unknown:
The warning is unactionable: there is nothing wrong with the config, and the
plugin's tools do load once discovery lands.
Fix
Resolve declared plugin keys without joining discovery.
hermes_cli.plugins.get_plugin_toolset_keys_nowait()already exists for exactlythis case — it serves last launch's persisted key set while a background scan is
in flight, and blocks via
discover_plugins()only when there is no scan towait on. Its persisted-cache staleness contract is explicitly safe for callers
that only validate names, which is all this does.
get_toolset()deliberately keeps reading the live registry alone, so the fixcannot invent tooling: a declared-but-not-yet-loaded plugin toolset still
resolves to zero tools. A regression test pins that.
Test plan
scripts/run_tests.sh tests/tools/test_toolsets.py→ 28 passed, 0 failedNew coverage:
False→ warning);mistaken for capability.
Verified on the affected host
hermes chat -q "..."no longer prints the warning, with the plugin enabled andits tool working.