Skip to content

The agent that grows with you

fix(buzz): scoped requirements gate resolves the profile's buzz section like the runtime loader (#125985, salvage #126060)

liuhao1024079ff12f96bc
diff --git a/plugins/platforms/buzz/adapter.py b/plugins/platforms/buzz/adapter.py
index c9bc1c99d21..548bdae8143 100644
--- a/plugins/platforms/buzz/adapter.py
+++ b/plugins/platforms/buzz/adapter.py
@@ -1822,12 +1822,17 @@ def _profile_buzz_extra() -> dict:
if not _profile_scoped():
return {}
try:
+ from gateway.config_loader import platform_section
from hermes_constants import get_hermes_home
from hermes_cli.config import read_user_config_raw
cfg = read_user_config_raw(Path(get_hermes_home()) / "config.yaml")
except Exception:
return {}
- buzz = ((cfg.get("gateway") or {}).get("platforms") or {}).get("buzz") if isinstance(cfg, dict) else None
+ if not isinstance(cfg, dict):
+ return {}
+ # Same seam the runtime loader hands this plugin's YAML hook: a nested-only read missed the
+ # documented top-level ``platforms.buzz`` shape and failed configured profiles closed (#125985).
+ buzz, _ = platform_section(cfg, "buzz", (cfg.get("gateway") or {}).get("platforms"))
extra = buzz.get("extra", buzz) if isinstance(buzz, dict) else None
return extra if isinstance(extra, dict) else {}
diff --git a/tests/gateway/test_buzz_adapter.py b/tests/gateway/test_buzz_adapter.py
index bc468e07ea1..50278d08125 100644
--- a/tests/gateway/test_buzz_adapter.py
+++ b/tests/gateway/test_buzz_adapter.py
@@ -302,6 +302,48 @@ class TestMultiplexProfileScope:
finally:
reset_hermes_home_override(token)
+ def test_check_requirements_scoped_reads_toplevel_platforms_buzz(
+ self, multiplex_scope, default_profile_env, tmp_path
+ ):
+ """Loader parity (#125985): the documented top-level platforms.buzz shape passes the
+ scoped gate, and an unconfigured sibling profile still fails closed (A→B→A)."""
+ import hermes_yaml as yaml
+ from hermes_constants import (
+ reset_hermes_home_override,
+ set_hermes_home_override,
+ )
+
+ home_a = tmp_path / "s6probe-a"
+ home_a.mkdir()
+ creds = home_a / "creds.json"
+ creds.write_text(json.dumps({"nsec": "nsec1profile"}), encoding="utf-8")
+ (home_a / "config.yaml").write_text(
+ yaml.safe_dump(
+ {
+ "platforms": {
+ "buzz": {
+ "enabled": True,
+ "extra": {
+ "relay_url": "https://profile.relay",
+ "credentials_file": str(creds),
+ },
+ }
+ }
+ }
+ ),
+ encoding="utf-8",
+ )
+ home_b = tmp_path / "s6probe-b"
+ home_b.mkdir()
+
+ for home, expected in ((home_a, True), (home_b, False), (home_a, True)):
+ multiplex_scope()
+ token = set_hermes_home_override(str(home))
+ try:
+ assert check_requirements() is expected
+ finally:
+ reset_hermes_home_override(token)
+
def test_env_enablement_scoped_returns_none(self, multiplex_scope, default_profile_env):
"""Scoped env enablement must not fabricate Buzz for a profile from
the default profile's env values."""