Skip to content

The agent that grows with you

fix(plugins): preserve force-path platform sweep + scoped plugin-source listing after rebase

Tekniumb9542f8e1fd7
diff --git a/agent/secret_sources/registry.py b/agent/secret_sources/registry.py
index 1881820d2ae..bbc52089e84 100644
--- a/agent/secret_sources/registry.py
+++ b/agent/secret_sources/registry.py
@@ -215,13 +215,22 @@ def list_sources(*, scope: Optional[str] = None) -> List[SecretSource]:
def list_plugin_sources() -> List[SecretSource]:
- """Return sources registered outside the bundled bootstrap set."""
+ """Return sources registered outside the bundled bootstrap set.
+
+ Includes both legacy global plugin registrations (``_SOURCE_ORIGINS ==
+ "plugin"``) and the current scope's profile-keyed registrations — every
+ scoped entry is plugin-registered by definition, since bundled sources
+ register with ``scope=None`` (#64229 profile isolation).
+ """
_ensure_builtin_sources()
- return [
- source
- for name, source in _SOURCES.items()
- if _SOURCE_ORIGINS.get(name) == "plugin"
- ]
+ with _REGISTRY_LOCK:
+ merged: Dict[str, SecretSource] = {
+ name: source
+ for name, source in _SOURCES.items()
+ if _SOURCE_ORIGINS.get(name) == "plugin"
+ }
+ merged.update(_SCOPED_SOURCES.get(hermes_home_key(), {}))
+ return list(merged.values())
def _ensure_builtin_sources() -> None:
diff --git a/hermes_cli/plugins.py b/hermes_cli/plugins.py
index 21ac1e71be6..06a78452b60 100644
--- a/hermes_cli/plugins.py
+++ b/hermes_cli/plugins.py
@@ -3155,6 +3155,17 @@ class PluginManager:
# The handles are authoritative for global registries, while the
# manager-local containers are also reset to clear legacy/manual
# state that predates the ledger.
+ #
+ # Platform names may exist in _plugin_platform_names without a
+ # ledger entry (state predating the ledger, or set manually in
+ # long-lived processes). Main's force path always unregistered
+ # them from the global registry — keep that sweep so disabled
+ # plugins can't leak parsers/send handlers into the next
+ # discovery pass.
+ from gateway.platform_registry import platform_registry
+
+ for platform_name in tuple(self._plugin_platform_names):
+ platform_registry.unregister(platform_name)
self._ownership_ledger.clear()
self._plugins.clear()
self._hooks.clear()