fix(a2a): eager-load explicitly enabled bundled platform plugins - #80630
Closed
akashshah-dev wants to merge 2 commits into
Closed
fix(a2a): eager-load explicitly enabled bundled platform plugins#80630akashshah-dev wants to merge 2 commits into
akashshah-dev wants to merge 2 commits into
Conversation
Bundled platform plugins (kind=platform, source=bundled) were always registered via _register_deferred_platform: the module and its register() — which also registers the plugin's client tools — were imported only when the gateway connected to that platform, i.e. AFTER agent sessions had already composed their toolset. For plugins with client tools (e.g. a2a's a2a_call/a2a_list/a2a_discover/ a2a_history/a2a_orchestrate) this meant the tools were registered too late and never appeared in any session. Explicitly-enabled bundled platforms now load eagerly at discovery (matched on manifest name, manifest key, or path-derived key like 'platforms/a2a'), so their tools are registered before sessions compose. Non-enabled platforms keep the lazy loader — startup cost unchanged.
- Path-derived key: use relative_to().as_posix() so the candidate matches canonical forward-slash enable keys on Windows too (str(relative_to) yields backslashes there and never matched). - Defensively coerce enabled to a set before intersection so the loader never TypeErrors on a list/tuple from any call path. - Narrow the path-key except to (OSError, ValueError) and debug-log the fallback instead of silently swallowing all exceptions.
Contributor
|
This was generated by AI during triage. Summary: Problems:
Solution: Checked against |
Contributor
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.
What does this PR do?
Fixes a bug where client tools from explicitly enabled bundled platform plugins (such as the A2A plugin) were unavailable in agent sessions because they were registered after toolset composition.
Bundled platform plugins that are explicitly enabled are now loaded eagerly during plugin discovery, ensuring their tools and hooks are registered before sessions are created. Bundled platforms that are not enabled continue to use lazy loading to avoid importing unnecessary platform SDKs.
Issues
The A2A plugin's five client tools (a2a_call, a2a_list, a2a_discover,
a2a_history, a2a_orchestrate) never appear in agent sessions, even with
the plugin enabled and the a2a toolset explicitly listed in
platform_toolsets.
Fixes
In the plugin-discovery loop, explicitly-enabled bundled platform plugins
now load eagerly (_load_plugin) so their tools/hooks are in the registry
before any session composes its toolset. Enabled-ness is matched against
the manifest name, manifest key, or the path-derived key (e.g.
platforms/a2a) — the form hermes plugins enable actually saves.
Non-enabled bundled platforms keep the lazy path, so plain hermes
invocations don't start importing heavy platform SDKs (telegram, slack,
...) they never use.
Type of Change
Changes Made
Eagerly load explicitly enabled bundled platform plugins during plugin discovery.
Preserve lazy loading for bundled platform plugins that are not enabled.
Match enabled plugins using the manifest name, manifest key, or path-derived key (e.g.
platforms/a2a) to align with howhermes plugins enablestores configuration.Improve robustness by:
as_posix()for cross-platform path normalization.enabledvalues.except Exceptionwith a narrowed(OSError, ValueError)catch and debug logging.Added regression tests covering eager loading, plugin discovery, and startup behavior.
How to Test
Enable the A2A plugin and configure the
a2aplatform toolset.Start Hermes and verify that the A2A client tools (
a2a_call,a2a_list,a2a_discover,a2a_history,a2a_orchestrate) are available in the agent session.Run:
Expected result: 165 passed, 0 failed.
Notes
This PR only changes plugin loading behavior.
During validation, the following runtime configuration was also required for the A2A tools to appear in gateway-hosted sessions, but these configuration requirements are not introduced by this PR:
tools.tool_search.enabled: off(otherwise plugin tools are exposed through the Tool Search bridge).platform_toolsets.<platform>(e.g.a2a) configured alongside theclitoolset, since gateway sessions use the platform-specific toolset.