Repository navigation
[dotnet-port-api] Support optional workflow orphan validation - #1272
Quim Muntal (qmuntal) merged 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
| // Build validates the assembled graph and returns the immutable [Workflow]. | ||
| // By default, Build checks for orphaned executors. Pass false to skip that | ||
| // check while retaining all other validation. | ||
| func (wb *Builder) Build(validateOrphans ...bool) (*Workflow, error) { |
There was a problem hiding this comment.
Don't like variadic args just to express one optional argument. Better keep Build() as is, and add a new method BuildWithOptions(opts BuildOptions). And fow now define type BuildOptions{ValidateOrphans bool}. Make Build call BuildWithOptions(BuildOptions{ValidateOrphans : true}).
|
Copilot fix comments. |
Co-authored-by: qmuntal <3747816+qmuntal@users.noreply.github.com>
Updated in commit |
There was a problem hiding this comment.
🟡 Changes recommended
Disabling orphan checks also bypasses type-compatibility validation, and the public API differs from the PR description.
1 open finding
What changed in this PR
Adds configurable orphan validation while preserving Build() defaults.
Changes:
- Adds
BuildOptionsandBuildWithOptions. - Tests orphan-validation opt-out behavior.
| File | Description |
|---|---|
workflow/builder.go |
Adds configurable validation. |
workflow/builder_test.go |
Tests skipping orphan checks. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: qmuntal <3747816+qmuntal@users.noreply.github.com>
API consistency review
Changed Go contract
Upstream evidence reviewed
No Python AssessmentThis revision supersedes the earlier variadic- Warning Firewall blocked 3 domainsThe following domains were blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "proxy.golang.org"
- "storage.googleapis.com"
- "sum.golang.org"See Network Configuration for more information.
|

Summary
Port the assessed
partialMicrosoft.Agents.AI.Workflows.WorkflowBuilder.Build(bool validateOrphans = true)capability. GoBuilder.Buildnow preserves default orphan validation, accepts an optional false value to skip only orphan checks, and reports an explicit error for more than one argument. Focused tests cover both the opt-out and invalid argument count.Ported .NET PRs
None. The contract was verified directly from pinned .NET source at
0c9944cc9f577d51277ac7c55dbc388b60a577af(Microsoft.Agents.AI.Workflowscatalog version1.22.0.0, informational version1.22.0+0c9944cc9f577d51277ac7c55dbc388b60a577af). The pinned implementation documentsBuild(bool validateOrphans = true)and routes the flag to validation.Breaking Changes
None intended. Existing
Build()calls retain the default validation behavior. The compatible variadic Go signature additionally supportsBuild(false)and rejects multiple validation arguments explicitly.Tests and Examples
go test ./workflowgo test ./workflow/...gofmt -w workflow/builder.go workflow/builder_test.gogit diff --checkNotes
Microsoft.Agents.AI.Workflows.WorkflowBuilder.Build(bool) -> Workflow, assessedpartial; expected post-merge assessment ismapped/covered.36 partial,54 unmapped), with no unreviewed placeholders.repo:microsoft/agent-framework-go WorkflowBuilder Build validate orphans orphan executors) and PR query (repo:microsoft/agent-framework-go WorkflowBuilder Build validateOrphans orphan executors) were run before editing and repeated before publication; both returned no results.microsoft/agent-framework-go#1265claims the exact public capability. An older related reference was integrity-filtered and was not used to justify this selected change.Warning
Firewall blocked 3 domains
The following domains were blocked by the firewall during workflow execution:
proxy.golang.orgstorage.googleapis.comsum.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.