Skip to content

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

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

fromslack_boltimportAppfromslack_boltimportAssistant, Sayassistant=Assistant() # default store or custom — same result@assistant.thread_starteddefhandle_thread_started(say, save_thread_context, payload):
thread_context=payload["assistant_thread"]["context"]
save_thread_context(thread_context) say("Hi!")
@assistant.thread_context_changeddefhandle_context_changed(save_thread_context, payload):
new_context=payload["assistant_thread"]["context"]
save_thread_context(new_context) @assistant.user_messagedefhandle_user_message(say, get_thread_context):
ctx=get_thread_context() # should work nowprint(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.

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

codecovBot commented Mar 6, 2026

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.

@WilliamBergaminWilliamBergamin 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.

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.

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

@WilliamBergaminWilliamBergamin 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.

Nice fix 🚀 🥇

Left 2 non blocking comment let me know what you think

Comment threadslack_bolt/context/get_thread_context/async_get_thread_context.py Outdated
Comment threadslack_bolt/context/get_thread_context/get_thread_context.py Outdated
@rayterrill

Copy link
Copy Markdown

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

@srtaalej
srtaalej merged commit f11dbfb into mainMar 23, 2026
16 checks passed
@srtaalej
srtaalej deleted the ale-fix-get-thread-context branch March 23, 2026 17:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't workingsemver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetThreadContext returns None in user_message handler

3 participants

@srtaalej@rayterrill@WilliamBergamin