The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(slack): preserve unfurl controls during streaming
Will Lynas91dbd7a6f8d0
diff --git a/plugins/platforms/slack/adapter.py b/plugins/platforms/slack/adapter.pyindex f5bb99ce927..c27a65b2d1a 100644--- a/plugins/platforms/slack/adapter.py+++ b/plugins/platforms/slack/adapter.py@@ -3333,9 +3333,14 @@ class SlackAdapter(BasePlatformAdapter):chat_type: Optional[str] = None,metadata: Optional[Dict[str, Any]] = None,) -> bool:- """Slack native streaming works in DMs, threads, and channels."""+ """Return whether Slack's native stream can preserve configured behavior."""if self._native_stream_unsupported:return False+ # Slack's chat.*Stream API contract has no unfurl controls. Route+ # explicitly configured behavior through the edit-based transport,+ # whose initial chat.postMessage carries these options.+ if _slack_unfurl_kwargs(self.config.extra):+ return Falsereturn self._app is not Nonedef _strip_stream_cursor(self, text: str) -> str:diff --git a/tests/gateway/test_slack_native_streaming.py b/tests/gateway/test_slack_native_streaming.pyindex 21f66738f09..c5d0d2bd587 100644--- a/tests/gateway/test_slack_native_streaming.py+++ b/tests/gateway/test_slack_native_streaming.py@@ -1,8 +1,9 @@"""Tests: SlackAdapter native streaming (chat.startStream/appendStream/stopStream).Behaviour contract:- * supports_draft_streaming: True when connected, False after a cached- feature-gate failure or when disconnected.+ * supports_draft_streaming: True when connected with default unfurl behavior;+ False after a cached feature-gate failure, when disconnected, or when an+ explicit unfurl control requires the chat.postMessage fallback.* send_draft first frame: chat_startStream with thread_ts + initial text;returns the stream ts as message_id.* send_draft subsequent frames: chat_appendStream with only the delta;@@ -49,6 +50,22 @@ class TestSupportsDraftStreaming:adapter, _ = _make_adapter()assert adapter.supports_draft_streaming(chat_type="dm") is True+ @pytest.mark.parametrize(+ ("unfurl_key", "configured_value"),+ [+ ("unfurl_links", False),+ ("unfurl_links", True),+ ("unfurl_media", False),+ ("unfurl_media", True),+ ],+ )+ def test_explicit_unfurl_control_disables_native_streaming(+ self, unfurl_key, configured_value+ ):+ adapter, _ = _make_adapter({unfurl_key: configured_value})++ assert adapter.supports_draft_streaming(chat_type="dm") is False+def test_unsupported_when_disconnected(self):adapter, _ = _make_adapter()adapter._app = None