FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(assistant): get_thread_context calls store.find() for user_message events by srtaalej · Pull Request #1453 · slackapi/bolt-python · GitHub

fix(assistant): get_thread_context calls store.find() for user_message events - #1453

Merged
srtaalej merged 8 commits into
mainfrom
ale-fix-get-thread-context
Mar 23, 2026
Merged

fix(assistant): get_thread_context calls store.find() for user_message events#1453
srtaalej merged 8 commits into
mainfrom
ale-fix-get-thread-context

Conversation

srtaalej commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes get_thread_context() returning None in user_message handlers when assistant_thread is present in the payload but only contains an action_token (no context).
Closes #1452

Testing

from slack_bolt import App
from slack_bolt import Assistant, Say

assistant = Assistant()  # default store or custom — same result

@assistant.thread_started
def handle_thread_started(say, save_thread_context, payload):
    thread_context = payload["assistant_thread"]["context"]
    save_thread_context(thread_context) 
    say("Hi!")

@assistant.thread_context_changed
def handle_context_changed(save_thread_context, payload):
    new_context = payload["assistant_thread"]["context"]
    save_thread_context(new_context) 

@assistant.user_message
def handle_user_message(say, get_thread_context):
    ctx = get_thread_context()  # should work now
    print(ctx)

app = App(token="xoxb-...", signing_secret="...")
app.use(assistant)

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.

srtaalej self-assigned this Mar 6, 2026
srtaalej requested a review from a team as a code owner March 6, 2026 17:26
srtaalej added bug Something isn't working semver:patch labels Mar 6, 2026

codecov Bot commented Mar 6, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.31%. Comparing base (98a8f59) to head (99e38ac).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1453   +/-   ##
=======================================
  Coverage   91.31%   91.31%           
=======================================
  Files         229      229           
  Lines        7266     7266           
=======================================
  Hits         6635     6635           
  Misses        631      631           

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

WilliamBergamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Look good 💯

Left one comment around testing, what do you think about leaving the current tests unchanged and instead add new tests for this case?

"event_ts": "1726133700.887259",
"channel_type": "im",
"assistant_thread": {"XXX": "YYY"},
"assistant_thread": {"action_token": "10647138185092.960436384805.afce3599"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What do you think about leaving the old test cases untouched and adding new ones for this logic?

srtaalej requested a review from WilliamBergamin March 9, 2026 16:06

WilliamBergamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice fix 🚀 🥇

Left 2 non blocking comment let me know what you think

Copy link
Copy Markdown

@srtaalej any idea when we can expect a fix for this? 🙏

srtaalej merged commit f11dbfb into main Mar 23, 2026
16 checks passed
srtaalej deleted the ale-fix-get-thread-context branch March 23, 2026 17:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetThreadContext returns None in user_message handler

3 participants


Back | FazBrowse Home | New Git URL