Skip to content

The agent that grows with you

fix(buzz): reconcile scoped auth-tag resolution across salvaged fixes

Teknium9113cf24a913
diff --git a/plugins/platforms/buzz/adapter.py b/plugins/platforms/buzz/adapter.py
index 2af4d5e7074..b9c1b4546d8 100644
--- a/plugins/platforms/buzz/adapter.py
+++ b/plugins/platforms/buzz/adapter.py
@@ -948,14 +948,21 @@ class BuzzAdapter(BasePlatformAdapter):
# multiplex profile a missing tag fails closed to "" instead of
# attaching the default profile's tag from os.environ, while
# single-profile and unscoped default-profile reads keep the legacy
- # env behavior. ``self._auth_tag`` is populated by connect() via
+ # env behavior. connect() populates ``self._auth_tag`` via
# ``_resolve_auth_tag`` (scope-aware read + credentials-file
- # fallback, #79514).
+ # fallback, #79514); resolve lazily here as well so a re-auth on a
+ # bare adapter stays scope-correct.
+ auth_tag = getattr(self, "_auth_tag", "") or ""
+ if not auth_tag:
+ try:
+ auth_tag = _resolve_auth_tag(getattr(self, "_extra", None))
+ except ValueError:
+ auth_tag = ""
event = build_auth_event(
private_key=self._private_key,
challenge=str(message[1]),
relay_url=self._websocket_url(),
- auth_tag_json=self._auth_tag,
+ auth_tag_json=auth_tag,
)
await websocket.send(json.dumps(["AUTH", event], separators=(",", ":")))
while True:
diff --git a/tests/gateway/test_buzz_adapter.py b/tests/gateway/test_buzz_adapter.py
index 3f1b7f80e41..42ec8c913db 100644
--- a/tests/gateway/test_buzz_adapter.py
+++ b/tests/gateway/test_buzz_adapter.py
@@ -353,7 +353,7 @@ class TestMultiplexProfileScope:
cli.write_text("#!/bin/sh\n", encoding="utf-8")
calls = {}
- async def fake_exec(cli_path, args, *, relay_url, private_key, input_text=None, timeout=None):
+ async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None):
calls["relay"] = relay_url
return 0, '{"event_id": "e1"}', ""
@@ -532,7 +532,7 @@ class TestMultiplexProfileScope:
cli.write_text("#!/bin/sh\n", encoding="utf-8")
calls = {}
- async def fake_exec(cli_path, args, *, relay_url, private_key, input_text=None, timeout=None):
+ async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None):
calls["args"] = args
return 0, '{"event_id": "e1"}', ""
@@ -568,7 +568,7 @@ class TestMultiplexProfileScope:
cli = tmp_path / "buzz"
cli.write_text("#!/bin/sh\n", encoding="utf-8")
- async def fake_exec(cli_path, args, *, relay_url, private_key, input_text=None, timeout=None):
+ async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None):
raise AssertionError("CLI must not run without a resolved target")
monkeypatch.setattr(_buzz_mod, "_exec_buzz", fake_exec)