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

Activity

  1. roli-lpci commented on Aug 22, 2026

    @roli-lpci

    I would like to take this on. I reproduced the collision on current main (abe1f629) with parallel subworkflows that reuse Analyze: the parent stream emitted two unqualified Analyze lifecycle IDs. A minimal local patch qualifies forwarded nested invoked, completed, and failed event IDs as HostId.ChildId, matching the existing dot-separated request-port convention; top-level IDs and payloads remain unchanged, with no new public API. The regression is red-before/green-after, all 770 workflow unit tests pass, and the multi-target builds are clean. The compatibility boundary is that consumers matching forwarded nested events by local child ID would receive the qualified ID instead. If this direction matches the intended contract, please assign #7763 to me and I will open the draft PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions