fix: async interceptor should_intercept must be sync + temporal example fixes#734
Merged
skrawcz merged 1 commit intoapache:stefan/add-more-lifecyclesfrom Apr 10, 2026
Conversation
The async interceptor base classes (ActionExecutionInterceptorHookAsync, StreamingActionInterceptorHookAsync) declared should_intercept as async, but callers use it inside lambdas that cannot be awaited. An async should_intercept would return a coroutine object (always truthy), silently matching every action regardless of the predicate logic. Also fixes: - StreamingActionInterceptorHookAsync.intercept_stream_run_and_update now correctly declared as async (matches isasyncgenfunction check) - Temporal example: replace nonexistent get_hooks() with call_all_lifecycle_hooks_async(), fix worker hook signatures
skrawcz
approved these changes
Apr 10, 2026
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
Fixes bugs in the interceptor lifecycle hooks introduced in #602:
should_intercepton async interceptor classes was declaredasync def, but callers use it inside lambdas passed toget_first_matching_hook()which cannotawait. An asyncshould_interceptreturns a coroutine object (always truthy), silently matching every action regardless of the predicate logic. Changed todefwith a note explaining why.StreamingActionInterceptorHookAsync.intercept_stream_run_and_updatewasdefbut the caller checksisasyncgenfunction, so it needs to beasync defto match.worker_adapter_set.get_hooks()which doesn't exist onLifecycleAdapterSet. Replaced withcall_all_lifecycle_hooks_async().strfor action and**kwargsinstead ofActionand**future_kwargs.Test plan
should_intercept)async def should_interceptin codebase