Repository navigation
fix: defer toolset validation to after plugin discovery (#71650) - #71742
Closed
JonthanaHanh wants to merge 1 commit into
Closed
JonthanaHanh wants to merge 1 commit into
JonthanaHanh wants to merge 1 commit into
Conversation
…#71650) validate_platform_toolsets() runs inside migrate_config() during early startup, before discover_plugins() populates the tool registry. Plugin- registered toolsets (e.g. "beads" from a third-party plugin) always trigger a false-positive "unknown toolset" warning on every startup. Fix: when the registry has no plugin toolsets yet (plugins not loaded), store warnings in a deferred buffer instead of printing them. After discover_plugins() in _prepare_agent_startup(), re-validate with the now-populated registry and emit only truly invalid toolset names. The "hermes config migrate" standalone path is unaffected: if plugins are already loaded (registry populated), warnings emit inline as before.
Related: #71729 and #29774 address the same false warning by discovering plugins before validation, while this patch defers warnings and revalidates after discovery. These have different startup timing and failure trade-offs; maintainer decision needed rather than a duplicate closure. |
Collaborator
|
Thanks for isolating the plugin-registry timing concern. This automated hermes-sweeper review found that current
Closing as already implemented on current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validate_platform_toolsets()runs insidemigrate_config()during early startup, beforediscover_plugins()populates the tool registry. Plugin-registered toolsets (e.g.beadsfrom a third-party plugin) always trigger a false-positive "unknown toolset" warning on every startup.Fixes #71650
Root Cause
The startup sequence is:
migrate_config()→ callsvalidate_platform_toolsets()→ checksvalidate_toolset()→_get_plugin_toolset_names()returns empty set (plugins not loaded yet)discover_plugins()→ plugins register their toolsets in the registryAny plugin-registered toolset listed in
platform_toolsetsconfig triggers the warning at step 1 because the registry is empty at that point.Fix
hermes_cli/config.py: Whenmigrate_config()detects that the tool registry has no plugin toolsets yet, store warnings in a module-level deferred buffer (_deferred_toolset_warnings) instead of printing them. When plugins are already loaded (e.g. standalonehermes config migrate), emit inline as before.hermes_cli/main.py: In_prepare_agent_startup(), afterdiscover_plugins()completes, re-validateplatform_toolsetswith the now-populated plugin registry and emit only truly invalid toolset names.Behavior
hermes config migrate(plugins loaded)Test Plan
test_toolset_validation.pytests passplatform_toolsetsconfig, verify no false-positive warning on startup