Skip to content

.NET: Preserve nested executor identity in workflow lifecycle events #7763

Description

Description

Workflow executor lifecycle events currently expose only ExecutorId and Data. WorkflowHostExecutor forwards child ExecutorInvokedEvent, ExecutorCompletedEvent, and ExecutorFailedEvent instances to the parent workflow unchanged.

This makes executor identity ambiguous when parallel nested workflows use the same locally scoped child executor ID. For example:

Parent
├─ SecurityPipeline
│  └─ Analyze
└─ StylePipeline
   └─ Analyze

Both subworkflows may execute concurrently and legitimately define their local executor as Analyze. The parent event stream then receives overlapping lifecycle events such as:

ExecutorInvokedEvent("Analyze")
ExecutorInvokedEvent("Analyze")
ExecutorCompletedEvent("Analyze")
ExecutorCompletedEvent("Analyze")

A consumer cannot determine which terminal event corresponds to which started executor. Message data, event ordering, generated response/message IDs, and timestamps are not reliable correlation mechanisms under concurrency.

The workflow event contract should preserve enough identity when forwarding nested executor events for consumers to distinguish them. Possible designs include:

  • a qualified executor path such as SecurityPipeline/Analyze;
  • separate scope/path metadata while retaining the local ExecutorId;
  • a stable per-invocation correlation ID when start/terminal pairing is required.

The solution should support parallel nested workflows without requiring consumers to infer scope from event ordering or maintain unsafe FIFO correlation. This was identified while adding workflow executor step events to AG-UI in PR #7738, but the missing identity is a general workflow event-contract issue.

Code Sample

Workflow CreateAnalysisWorkflow(string pipelineId)
{
    ExecutorBinding analyze = AnalyzeAsync.BindAsExecutor("Analyze");
    return new WorkflowBuilder(analyze).WithOutputFrom(analyze).Build();
}

ExecutorBinding security = CreateAnalysisWorkflow("SecurityPipeline")
    .BindAsExecutor("SecurityPipeline");
ExecutorBinding style = CreateAnalysisWorkflow("StylePipeline")
    .BindAsExecutor("StylePipeline");

Workflow parent = new WorkflowBuilder(start)
    .AddFanOutEdge(start, [security, style])
    .Build();

// Expected: forwarded child lifecycle events retain enough scope to distinguish
// SecurityPipeline/Analyze from StylePipeline/Analyze.

Language/SDK

.NET

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETUsage: [Issues, PRs], Target: .Net

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions