Skip to content

fix(assistant): improve middleware dispatch and inject kwargs in middleware#1456

Open
WilliamBergamin wants to merge 1 commit intomainfrom
set-assistant-say-in-middleware
Open

fix(assistant): improve middleware dispatch and inject kwargs in middleware#1456
WilliamBergamin wants to merge 1 commit intomainfrom
set-assistant-say-in-middleware

Conversation

@WilliamBergamin
Copy link
Contributor

Summary

  • Extracts assistant kwargs injection (say, set_status, set_title, set_suggested_prompts, get_thread_context, save_thread_context) from App._init_context / AsyncApp._init_context into
    dedicated listener middleware (AttachingAssistantKwargs / AsyncAttachingAssistantKwargs)
  • Generalizes extract_thread_ts to work for all event types (not just assistant events), populating context.thread_ts for any threaded event
  • Removes thread_ts from the default Say constructor in BoltContext.say — assistant threading is now handled entirely by the Assistant middleware

Testing

  1. Pull this branch and build the project
  2. Create a new app with bolt-python-assistant-template
  3. Use the new Bolt version in the app
  4. There should be no behavior changes 🟢

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@WilliamBergamin WilliamBergamin added this to the 1.27.1 milestone Mar 11, 2026
@WilliamBergamin WilliamBergamin self-assigned this Mar 11, 2026
@WilliamBergamin WilliamBergamin requested a review from a team as a code owner March 11, 2026 21:47
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.09%. Comparing base (72a90d2) to head (69f8f93).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
slack_bolt/middleware/assistant/assistant.py 77.77% 2 Missing ⚠️
slack_bolt/middleware/assistant/async_assistant.py 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1456      +/-   ##
==========================================
+ Coverage   90.67%   91.09%   +0.42%     
==========================================
  Files         226      228       +2     
  Lines        7205     7244      +39     
==========================================
+ Hits         6533     6599      +66     
+ Misses        672      645      -27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant