From 2b046cff604b77917fd0644d1d4be5b210dcd1e3 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Fri, 21 Aug 2026 15:13:14 -0700 Subject: [PATCH 1/3] feat(web-api): add session_status to chat.stopStream Adds the optional session_status argument to chat.stopStream (sync, async, legacy), which sets the agent session's lifecycle status after stopping the stream (defaults to active). Co-Authored-By: Claude --- slack_sdk/web/async_client.py | 2 ++ slack_sdk/web/client.py | 2 ++ slack_sdk/web/legacy_client.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index 24e93b4ef..69e4f1251 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -3003,6 +3003,7 @@ async def chat_stopStream( blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Stops a streaming conversation. @@ -3016,6 +3017,7 @@ async def chat_stopStream( "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index 6149a092a..b8ffba765 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2993,6 +2993,7 @@ def chat_stopStream( blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -3006,6 +3007,7 @@ def chat_stopStream( "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index d03c2c8ae..4c7a9ab16 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -3004,6 +3004,7 @@ def chat_stopStream( blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Stops a streaming conversation. @@ -3017,6 +3018,7 @@ def chat_stopStream( "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) From 599ee184de52dfef011fc3986aa88f7b08936818 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 26 Aug 2026 15:58:56 -0700 Subject: [PATCH 2/3] feat(web-api): thread session_status through chat_stream stop() helpers Forward the session_status arg added to chat.stopStream through the sync and async chat_stream stop() convenience helpers, with docstring entries and forwarding assertions in the helper tests. Co-Authored-By: Claude --- slack_sdk/web/async_chat_stream.py | 3 +++ slack_sdk/web/chat_stream.py | 3 +++ tests/slack_sdk/web/test_chat_stream.py | 2 ++ tests/slack_sdk_async/web/test_async_chat_stream.py | 2 ++ 4 files changed, 10 insertions(+) diff --git a/slack_sdk/web/async_chat_stream.py b/slack_sdk/web/async_chat_stream.py index 20e3fd98b..9e415fde1 100644 --- a/slack_sdk/web/async_chat_stream.py +++ b/slack_sdk/web/async_chat_stream.py @@ -158,6 +158,7 @@ async def stop( chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, + session_status: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Stop the stream and finalize the message. @@ -169,6 +170,7 @@ async def stop( what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + session_status: The status of the agent session associated with this stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -217,6 +219,7 @@ async def stop( blocks=blocks, chunks=flushings, metadata=metadata, + session_status=session_status, **kwargs, ) self._state = "completed" diff --git a/slack_sdk/web/chat_stream.py b/slack_sdk/web/chat_stream.py index 9f97ac7cc..045c65adf 100644 --- a/slack_sdk/web/chat_stream.py +++ b/slack_sdk/web/chat_stream.py @@ -148,6 +148,7 @@ def stop( chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stop the stream and finalize the message. @@ -159,6 +160,7 @@ def stop( what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + session_status: The status of the agent session associated with this stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -207,6 +209,7 @@ def stop( blocks=blocks, chunks=flushings, metadata=metadata, + session_status=session_status, **kwargs, ) self._state = "completed" diff --git a/tests/slack_sdk/web/test_chat_stream.py b/tests/slack_sdk/web/test_chat_stream.py index 841de9c38..8be6364a3 100644 --- a/tests/slack_sdk/web/test_chat_stream.py +++ b/tests/slack_sdk/web/test_chat_stream.py @@ -139,6 +139,7 @@ def test_streams_a_long_message(self): ) ], markdown_text="*", + session_status="processing", token="xoxb-chat_stream_test_token2", ) @@ -176,6 +177,7 @@ def test_streams_a_long_message(self): json.dumps(stop_request.get("chunks")), '[{"text": "**", "type": "markdown_text"}]', ) + self.assertEqual(stop_request.get("session_status"), "processing") self.assertEqual(stop_request.get("token"), "xoxb-chat_stream_test_token2") self.assertEqual(stop_request.get("ts"), "123.123") diff --git a/tests/slack_sdk_async/web/test_async_chat_stream.py b/tests/slack_sdk_async/web/test_async_chat_stream.py index 5d5ccf344..522fffd06 100644 --- a/tests/slack_sdk_async/web/test_async_chat_stream.py +++ b/tests/slack_sdk_async/web/test_async_chat_stream.py @@ -142,6 +142,7 @@ async def test_streams_a_long_message(self): ) ], markdown_text="*", + session_status="processing", token="xoxb-chat_stream_test_token2", ) @@ -179,6 +180,7 @@ async def test_streams_a_long_message(self): json.dumps(stop_request.get("chunks")), '[{"text": "**", "type": "markdown_text"}]', ) + self.assertEqual(stop_request.get("session_status"), "processing") self.assertEqual(stop_request.get("token"), "xoxb-chat_stream_test_token2") self.assertEqual(stop_request.get("ts"), "123.123") From a4422e515ed5c1a44f416c84f867c022c9a68061 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 26 Aug 2026 16:58:07 -0700 Subject: [PATCH 3/3] docs: use canonical session_status description in chat_stream stop() helpers Match the wording java (#1634) and node (#2708) carry for the arg: "The session status to set after stopping the stream." Co-Authored-By: Claude --- slack_sdk/web/async_chat_stream.py | 2 +- slack_sdk/web/chat_stream.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/slack_sdk/web/async_chat_stream.py b/slack_sdk/web/async_chat_stream.py index 9e415fde1..f5848b31e 100644 --- a/slack_sdk/web/async_chat_stream.py +++ b/slack_sdk/web/async_chat_stream.py @@ -170,7 +170,7 @@ async def stop( what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. - session_status: The status of the agent session associated with this stream. + session_status: The session status to set after stopping the stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: diff --git a/slack_sdk/web/chat_stream.py b/slack_sdk/web/chat_stream.py index 045c65adf..4adbc848a 100644 --- a/slack_sdk/web/chat_stream.py +++ b/slack_sdk/web/chat_stream.py @@ -160,7 +160,7 @@ def stop( what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. - session_status: The status of the agent session associated with this stream. + session_status: The session status to set after stopping the stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: