fix(gateway): key plugin adapters by PluginPlatformIdentifier in self.adapters

Previously the plugin-platform boot loop did self.adapters[plugin_name]
= adapter (string key), while built-in adapters use a Platform enum
key. The mismatch escaped review because the in-process unit + E2E
tests don't exercise GatewayRunner.start() — they only call
_create_plugin_adapter directly.

Caught by a real `hermes gateway run` subprocess test:

    File "gateway/run.py", line 2027, in <listcomp>
        "platforms": [p.value for p in self.adapters.keys()],
    AttributeError: 'str' object has no attribute 'value'

Switching to self.adapters[adapter.platform] = adapter — adapter.platform
is the PluginPlatformIdentifier passed to BasePlatformAdapter.__init__,
which has the .value attribute every downstream consumer needs.

After the fix the same subprocess test passes 4/4 checkpoints (config
parse → plugin boot → /a2a/health 200 → /a2a/inbound 200).
This commit is contained in:
Hongming Wang 2026-05-02 03:17:45 -07:00
parent 047de4a668
commit ece9e34ec6

View File

@ -1975,10 +1975,14 @@ class GatewayRunner:
try:
success = await adapter.connect()
if success:
# Plugin platforms keyed by string in self.adapters
# (built-ins use the Platform enum). Downstream code
# treats both as opaque dict keys for routing.
self.adapters[plugin_name] = adapter
# Key by adapter.platform (a PluginPlatformIdentifier
# instance). Downstream code does ``[p.value for p in
# self.adapters.keys()]`` and similar — keying by the
# identifier (which has a .value attribute) keeps
# plugin platforms structurally compatible with the
# rest of the dict instead of mixing strings and
# enum members.
self.adapters[adapter.platform] = adapter
connected_count += 1
logger.info("%s (plugin) connected", plugin_name)
else: