workflow_id is propagated to tasks via the _workflow_id_ctx ContextVar, which is only set inside execute_block for the duration of a block's execution. Tasks submitted directly via function_task(...) outside of any block context receive workflow_id = None, even when the submission code runs logically within a named workflow. The workflow_scope() async context manager exists but must be manually wrapped by every caller; there is no mechanism for the engine to automatically associate directly submitted tasks with a parent workflow context.
workflow_id is propagated to tasks via the _workflow_id_ctx ContextVar, which is only set inside execute_block for the duration of a block's execution. Tasks submitted directly via function_task(...) outside of any block context receive workflow_id = None, even when the submission code runs logically within a named workflow. The workflow_scope() async context manager exists but must be manually wrapped by every caller; there is no mechanism for the engine to automatically associate directly submitted tasks with a parent workflow context.