The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): skip nested registry resolves only on a plugin deadline worker
kshitijk4poorb3f699600422
diff --git a/gateway/platform_registry.py b/gateway/platform_registry.pyindex 167cbe202bd..a4505068fd2 100644--- a/gateway/platform_registry.py+++ b/gateway/platform_registry.py@@ -219,7 +219,9 @@ class PlatformRegistry:event = self._inflight.get(scoped_key)load_key = scoped_keyif event is None and name not in entries and self._loading.get():- return # nested walk inside a loader: the outer walk resolves siblings+ from hermes_cli.plugins_loader import in_plugin_load_worker+ if in_plugin_load_worker():+ return # nested walk on a deadline worker: the outer walk resolves siblingsif event is None and name not in entries:loader = deferred.pop(name, None)if event is None and loader is None and name not in entries:diff --git a/tests/gateway/test_platform_registry.py b/tests/gateway/test_platform_registry.pyindex 13276410621..9e7f40622a1 100644--- a/tests/gateway/test_platform_registry.py+++ b/tests/gateway/test_platform_registry.py@@ -3,6 +3,8 @@import threadingfrom unittest.mock import MagicMock+import pytest+from gateway.platform_registry import PlatformRegistry, PlatformEntryfrom gateway.config import Platform, GatewayConfigfrom hermes_cli import plugins_loader@@ -681,11 +683,14 @@ class TestMigratedPlatformWiring:)-def test_registry_walk_from_plugin_load_worker_does_not_wait_on_parent(monkeypatch):- """register() re-walking the registry on its deadline worker must not block on its own or a sibling load."""- monkeypatch.setattr(plugins_loader, "_resolve_plugin_load_timeout", lambda: 0.5)[email protected]("timeout, nested_sees_sibling", [(0.5, False), (0, True)])+def test_registry_walk_from_plugin_load_worker_does_not_wait_on_parent(monkeypatch, timeout, nested_sees_sibling):+ """register() re-walking the registry on its deadline worker must not block on its own or a sibling load;+ with the deadline disabled (inline loads) a nested get() must still load the sibling, as on main."""+ monkeypatch.setattr(plugins_loader, "_resolve_plugin_load_timeout", lambda: timeout)reg = PlatformRegistry()abandoned = []+ nested = []class Ctx:def _abandon_load(self):@@ -696,6 +701,8 @@ def test_registry_walk_from_plugin_load_worker_does_not_wait_on_parent(monkeypatdef make_loader(name):def register():reg.plugin_entries()+ if name == "reentrant":+ nested.append(reg.get("sibling") is not None)reg.register(PlatformEntry(name=name, label=name, adapter_factory=lambda cfg: None,check_fn=lambda: True, source="plugin"))@@ -708,4 +715,5 @@ def test_registry_walk_from_plugin_load_worker_does_not_wait_on_parent(monkeypatreg.register_deferred(name, make_loader(name))assert sorted(e.name for e in reg.plugin_entries()) == ["reentrant", "sibling"]+ assert nested == [nested_sees_sibling]assert abandoned == []