@@ -429,20 +429,15 @@ def activate(
429429 f"Failed converting activation exception: { inner_err } "
430430 )
431431
432- def is_non_cancellation_completion (command ):
432+ def is_completion (command ):
433433 return (
434434 command .HasField ("complete_workflow_execution" )
435435 or command .HasField ("continue_as_new_workflow_execution" )
436436 or command .HasField ("fail_workflow_execution" )
437+ or command .HasField ("cancel_workflow_execution" )
437438 )
438439
439- # We do also warn in the case of workflow cancellation, but this is done
440- # when handling the workflow cancellation, since we also cancel update
441- # handlers at that time.
442- if any (
443- is_non_cancellation_completion (c )
444- for c in self ._current_completion .successful .commands
445- ):
440+ if any (map (is_completion , self ._current_completion .successful .commands )):
446441 self ._warn_if_unfinished_handlers ()
447442
448443 return self ._current_completion
@@ -1856,7 +1851,6 @@ async def _run_top_level_workflow_function(self, coro: Awaitable[None]) -> None:
18561851 err
18571852 ):
18581853 self ._add_command ().cancel_workflow_execution .SetInParent ()
1859- self ._warn_if_unfinished_handlers ()
18601854 # Cancel update tasks, so that the update caller receives an
18611855 # update failed error. We do not currently cancel signal tasks
18621856 # since (a) doing so would require a workflow flag and (b) the
0 commit comments