The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(relay): fall back to descriptor platform for unfurl stamping
Ben Barclaybe5c75165f7b
diff --git a/gateway/relay/adapter.py b/gateway/relay/adapter.pyindex f1bf4bdeaf8..b11abd33715 100644--- a/gateway/relay/adapter.py+++ b/gateway/relay/adapter.py@@ -1974,7 +1974,10 @@ class RelayAdapter(BasePlatformAdapter):effective_reply_to = self._apply_slack_thread_anchor(chat_id, reply_to, send_metadata)- _unfurl = self._slack_unfurl_hints(self._platform_by_chat.get(str(chat_id)))+ _unfurl = self._slack_unfurl_hints(+ self._platform_by_chat.get(str(chat_id))+ or getattr(self.descriptor, "platform", None)+ )if _unfurl:send_metadata.update(_unfurl)result = await self._transport.send_outbound(@@ -2473,7 +2476,10 @@ class RelayAdapter(BasePlatformAdapter):effective_reply_to = self._apply_slack_thread_anchor(chat_id, reply_to, media_metadata)- _media_unfurl = self._slack_unfurl_hints(self._platform_by_chat.get(str(chat_id)))+ _media_unfurl = self._slack_unfurl_hints(+ self._platform_by_chat.get(str(chat_id))+ or getattr(self.descriptor, "platform", None)+ )if _media_unfurl:media_metadata.update(_media_unfurl)action: Dict[str, Any] = {diff --git a/tests/gateway/relay/test_relay_slack_unfurl.py b/tests/gateway/relay/test_relay_slack_unfurl.pyindex e986c7674cf..7cdf1b3a54a 100644--- a/tests/gateway/relay/test_relay_slack_unfurl.py+++ b/tests/gateway/relay/test_relay_slack_unfurl.py@@ -143,6 +143,16 @@ class TestSendStampsUnfurl:await a.send("chan-1", "see https://example.com")assert "unfurl_links" not in a._transport.sent["metadata"]+ @pytest.mark.asyncio+ async def test_send_falls_back_to_descriptor_platform(self):+ """No inbound frame yet (e.g. gateway restart): _platform_by_chat is+ empty, so the platform must resolve from the negotiated descriptor —+ the same fallback the streaming gate and delivery resolver use."""+ a = _slack_adapter({"slack": {"unfurl_links": False}})+ assert not a._platform_by_chat+ await a.send("chan-1", "see https://example.com")+ assert a._transport.sent["metadata"]["unfurl_links"] is False+class TestSendForPlatformStampsUnfurl:@pytest.mark.asyncio