Add assistant middleware inheritance option#1519
Open
Cr1stal wants to merge 5 commits into
Open
Conversation
ee9fb84 to
18fae4a
Compare
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in
auto_inherit_app_middlewareoption forAssistantandAsyncAssistant.When this option is enabled, Assistant handlers are registered as normal App listeners instead of running inside the Assistant middleware's private listener dispatch. This lets assistant-specific handlers participate in the same global middleware pipeline as other app listeners while preserving the existing default behavior for
Assistant().This addresses #1346 by allowing app-level authorization, auditing, rate limiting, or enrichment middleware to affect assistant flows. Assistant listeners are inserted into an app-level priority block before catch-all listeners, and the priority block preserves registration order when multiple assistants are registered.
The implementation keeps sync and async behavior mirrored and keeps assistant-specific listener middleware responsible for attaching assistant helpers.
Testing
./scripts/format.sh --no-install./scripts/lint.sh --no-install./scripts/run_tests.sh tests/slack_bolt/app/test_app_assistant_middleware.py./scripts/run_mypy.sh --no-install./scripts/install_all_and_run_tests.sh(920 passed,81 warnings; mypy:Success: no issues found in 234 source files)Category
slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.