Skip to content

Separate worker context activation from resumable node lifetime #272

Closed

Description

@laipz8200

Problem

Container nodes can start on one worker and resume on another. Layer hooks currently cover the logical node lifetime only: on_node_run_start runs before the initial segment and on_node_run_end runs after the final segment. A tracing layer that attaches a context on start and detaches on end therefore uses a context token on a different worker. Child execution also lacks the owning container execution identity at the activation boundary, so child spans can become siblings of the container span.

Expected behavior

Provide a framework-neutral layer context manager around each worker execution segment, including resume. Enter and exit it in the same worker context, including suspension and failures. Expose the direct owning container execution ID for child segments, consistently for Workflow Tool, Loop, and Iteration containers. Keep logical start/end hooks unchanged and leave span creation and tracing-provider integration to consumers.

Related work

This supports langgenius/dify#40277. Earlier workflow-as-tool identity work is tracked in #104; this issue concerns the subsequent cooperative worker lifecycle.

Activity

  1. self-assigned this
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions