Skip to content

SlackAdapter.stream() calls AsyncWebClient.chat_stream() without await #44

Description

@patrick-chinchill

Summary

In SlackAdapter.stream(), the call to client.chat_stream(...) is not awaited before being used. slack_sdk.web.async_client.AsyncWebClient.chat_stream returns a coroutine that must be awaited to obtain the streamer object; calling .append() on an unawaited coroutine raises AttributeError (or similar) and native Slack streaming fails.

Location

src/chat_sdk/adapters/slack/adapter.py, around L2021:

streamer = client.chat_stream(**stream_kwargs)   # missing await
...
await streamer.append(markdown_text=delta, token=token)   # L2048

Expected

streamer = await client.chat_stream(**stream_kwargs)

Repro

Configure SlackAdapter, register a handler, post any agent that produces a streamed response. adapter.stream() raises before the first append.

Workaround

Subclass SlackAdapter and set stream = None as a class attribute to force the SDK's post+edit fallback path:

class MySlackAdapter(SlackAdapter):
    stream = None  # force post+edit fallback

The fallback works correctly; this is only a workaround for the native streaming path.

Impact

Any consumer using the default SlackAdapter with native streaming is affected. Post+edit fallback is usable, but loses Slack's native streaming UX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions