From ece9e34ec64c25b8e355293bd4578f47548ec805 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Sat, 2 May 2026 03:17:45 -0700 Subject: [PATCH] fix(gateway): key plugin adapters by PluginPlatformIdentifier in self.adapters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 "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). --- gateway/run.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index 71cda70f..04afe1be 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -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: