fix(gateway): registered_names() honors profile scope like is_registered()

The salvaged registered_names() from PR #71582 predates the scoped
platform registry: it read only the process-global _entries/_deferred
maps, but plugin platforms register their deferred loaders under a
profile scope. Result: `hermes tools enable a2a --platform a2a` still
rejected the platform. Union the current-scope maps with the global
ones, mirroring is_registered()'s semantics, under the registry lock.
This commit is contained in:
Teknium
2026-08-14 20:51:26 -07:00
parent 25857671f7
commit 366fd70f98

View File

@@ -581,8 +581,22 @@ class PlatformRegistry:
return [e for e in self.all_entries() if e.source == "plugin"]
def registered_names(self) -> set[str]:
"""Return concrete and deferred platform names without loading adapters."""
return self._entries.keys() | self._deferred.keys()
"""Return concrete and deferred platform names without loading adapters.
Mirrors ``is_registered()``'s scope semantics: names registered under
the current profile scope AND process-global names both count. Plugin
platforms register deferred loaders under a profile scope, so reading
only the global maps would miss every plugin platform.
"""
with self._lock:
scope = self.current_scope_key()
entries, deferred = self._scope_maps(scope)
return (
entries.keys()
| deferred.keys()
| self._entries.keys()
| self._deferred.keys()
)
def is_registered(self, name: str) -> bool:
# A deferred (not-yet-imported) platform still counts as registered --