microsoft / microsoft/agent-framework
.NET: Preserve nested executor identity in workflow lifecycle events
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 2d 45m
- Merged PRs (30d)
- 358
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:
```text
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:
```text
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
```csharp
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at WorkflowHostExecutor and the forwarding paths for ExecutorInvokedEvent, ExecutorCompletedEvent, and ExecutorFailedEvent. Review the workflow executor step events introduced in PR #7738 and define the event-contract change needed for consumers to distinguish nested executors running in parallel. Done means forwarded lifecycle events preserve enough scope or correlation identity without relying on ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100