Skip to content

fix: make send_toast an async function#2809

Open
Br1an67 wants to merge 1 commit intoChainlit:mainfrom
Br1an67:fix/issue-2803-send-toast-async
Open

fix: make send_toast an async function#2809
Br1an67 wants to merge 1 commit intoChainlit:mainfrom
Br1an67:fix/issue-2803-send-toast-async

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 1, 2026

What

Make send_toast an async method in both BaseChainlitEmitter and ChainlitEmitter.

Closes #2803

Why

send_toast calls self.emit() which is async, but was not declared async itself. This means the coroutine returned by emit() was never awaited. The existing tests already expect send_toast to be awaitable (await emitter.send_toast(...)).

Changes

  • backend/chainlit/emitter.py: Added async to both send_toast definitions and await the emit() call

Testing

  • All 3 existing test_send_toast* tests pass

Summary by cubic

Make send_toast async in BaseChainlitEmitter and ChainlitEmitter, and await emit() to prevent unawaited coroutine errors. Aligns with existing tests that await send_toast and ensures toast messages are properly emitted.

Written for commit fb81652. Summary will update on new commits.

The send_toast method calls self.emit() which is async, but was not
declared async itself, causing the coroutine to never be awaited.
This aligns with the existing test expectations which already use await.
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. backend Pertains to the Python backend. labels Mar 1, 2026
@dosubot dosubot bot added the bug Something isn't working label Mar 1, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug Report: allow sending toast notifications #1736

1 participant