fix(cli): discover pip-installed plugins via entry points in list/enable/disable - #34533
Closed
annguyenNous wants to merge 1 commit into
Closed
fix(cli): discover pip-installed plugins via entry points in list/enable/disable#34533annguyenNous wants to merge 1 commit into
annguyenNous wants to merge 1 commit into
Conversation
…ble/disable The runtime PluginManager.discover_and_load() scans importlib.metadata entry points (hermes_agent.plugins group) to find pip-installed plugins, but the CLI commands (hermes plugins list, enable, disable) only scanned bundled and user filesystem directories. This caused pip-installed plugins to be invisible in CLI output and impossible to enable/disable by name, even though they loaded correctly at runtime. Add entry-point scanning to both _discover_all_plugins() and _plugin_exists() so CLI discovery matches runtime discovery. Fixes the class of bugs where a pip-installed platform adapter (e.g. discord, mattermost) works at runtime but doesn't appear in 'hermes plugins list' or respond to 'hermes plugins enable'.
Collaborator
Contributor
|
already impl |
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.
Problem
The runtime
PluginManager.discover_and_load()scansimportlib.metadataentry points (hermes_agent.pluginsgroup) to find pip-installed plugins, but the CLI commands (hermes plugins list,enable,disable) only scanned bundled and user filesystem directories.This caused pip-installed plugins to be invisible in CLI output and impossible to enable/disable by name, even though they loaded correctly at runtime. Users installing platform adapters (discord, mattermost, etc.) via
pip install hermes-agent[discord]would seeNo adapter available for discordinhermes gateway runbut couldn't diagnose viahermes plugins listbecause the plugin didn't appear.Fix
Add entry-point scanning to both
_discover_all_plugins()and_plugin_exists()inhermes_cli/plugins_cmd.py:_discover_all_plugins()— After scanning bundled and user directories, also checkimportlib.metadata.entry_points(group="hermes_agent.plugins")and add any entries not already found via filesystem scan._plugin_exists()— After checking bundled and user directories, also check entry points sohermes plugins enable <name>works for pip-installed plugins.Both additions use the same entry-point selection pattern as
PluginManager._scan_entry_points()(Python 3.12+select()/ dict fallback / list comprehension), wrapped intry/except Exceptionfor graceful degradation.Before vs After
hermes plugins listhermes plugins enable discordPlugin 'discord' not foundhermes plugins info discordTests
No new tests added — the fix is mechanical (adds a discovery source that already exists in the runtime loader). Existing plugin CLI tests should continue to pass since the change is additive.
Fixes #34511 (related — same class of discovery gap, though that specific issue was about missing plugin.yaml manifests in the PyPI wheel).