Skip to content

The agent that grows with you

fix(gateway): read the voice-channel note from the adapter that answers the source

686f6c617c9b48123be6
diff --git a/gateway/run_agent_cache.py b/gateway/run_agent_cache.py
index e30f7880fe5..1674e201f54 100644
--- a/gateway/run_agent_cache.py
+++ b/gateway/run_agent_cache.py
@@ -649,7 +649,7 @@ class GatewayAgentCacheMixin:
member/speaking churn can't touch the prompt."""
if source.platform != Platform.DISCORD:
return None
- adapter = self.adapters.get(Platform.DISCORD)
+ adapter = self._delivery_adapter_for(source)
guild_id = self._get_guild_id(event)
if not (guild_id and adapter and hasattr(adapter, "get_voice_channel_context")):
return None
diff --git a/tests/gateway/test_prompt_tail_freeze.py b/tests/gateway/test_prompt_tail_freeze.py
index b0431c72828..63838e52ae2 100644
--- a/tests/gateway/test_prompt_tail_freeze.py
+++ b/tests/gateway/test_prompt_tail_freeze.py
@@ -246,6 +246,21 @@ class TestVoiceChannelSidecarNote:
runner, _ = _vc_runner("")
assert runner._voice_channel_sidecar_note(_vc_event(), _source(), "sk") is None
+ def test_secondary_profile_reads_its_own_bot_voice_context(self):
+ # Multiplexed gateway: the voice binding lives on the adapter whose bot is
+ # in the call, so the note must be read from the adapter that answers the
+ # source -- not from the default profile's adapter map.
+ primary = _VcAdapter("")
+ secondary = _VcAdapter("**Voice:** dev-vc (2 members)")
+ runner = _make_runner(
+ adapters={Platform.DISCORD: primary},
+ _profile_adapters={"otto": {Platform.DISCORD: secondary}},
+ )
+ source = _source()
+ source._transport_adapter_ref = lambda: secondary
+ note = runner._voice_channel_sidecar_note(_vc_event(), source, "sk")
+ assert note and "dev-vc (2 members)" in note
+
# ---------------------------------------------------------------------------
# 5. Sidecar note staging: one-shot per turn