Skip to content

[dotnet-code] Consolidate workflow edge connection construction #469

Closed

Description

@github-actions

Summary

Consolidated workflow builder edge endpoint construction through a small unexported newEdgeConnection helper. This keeps the Go workflow edge internals closer to the .NET EdgeConnection construction shape, making future .NET-to-Go comparisons easier while leaving the exported EdgeConnection struct and behavior unchanged.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/EdgeConnection.cs - central edge connection type constructed from ordered source and sink ID lists.

Public API and Behavior

No public Go API changed. No intentional behavior change was made.

Tests

  • gofmt -w workflow/edge.go workflow/builder.go
  • go test ./workflow

Notes

Rejected sampled candidates:

  • dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/WorkflowHostExecutor.cs - closest Go equivalents are broader subworkflow hosting/runtime paths, and open PR [dotnet-code] Extract aggregate turn send helper #468 already covers adjacent aggregate-turn workflow internals.
  • dotnet/src/Microsoft.Agents.AI/Skills/File/AgentFileSkillsSourceOptions.cs - Go file-based skills surface is much smaller and does not expose equivalent internal option plumbing, so a structural cleanup would risk adding shape without existing behavior.
  • dotnet/src/Microsoft.Agents.AI.Abstractions/AgentAbstractionsJsonUtilities.cs - Go JSON utilities are spread across generic internal helpers and workflow checkpoint serialization, with no narrow corresponding production cleanup from this sample.

Additional sampled files reviewed included OpenAI hosting model/response files, durable workflow envelopes/events, and tests/samples that were skipped because they were either outside the Go implementation surface or not appropriate for production portability cleanup.

Generated by .NET-to-Go Code Portability Refactoring Agent · 409.6 AIC · ⌖ 42.9 AIC · ⊞ 20.8K · ◷


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-code-edge-connection-helper-b84489a37052b0dc.

Click here to create the pull request

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (75 of 75 lines)
From 8055c14f9d911f04440a2e12e40c8da4dabb2c84 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 10 Jul 2026 22:43:15 +0000
Subject: [PATCH] Consolidate workflow edge connection construction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 workflow/builder.go | 17 ++++-------------
 workflow/edge.go    |  7 +++++++
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/workflow/builder.go b/workflow/builder.go
index 358816d8c..ac6d3d44c 100644
--- a/workflow/builder.go
+++ b/workflow/builder.go
@@ -122,10 +122,7 @@ func (wb *Builder) AddDirectEdge(source ExecutorBinding, target ExecutorBinding,
 	if wb.err != nil {
 		return wb
 	}
-	conn := EdgeConnection{
-		SourceIDs: []string{source.ID},
-		SinkIDs:   []string{target.ID},
-	}
+	conn := newEdgeConnection([]string{source.ID}, []string{target.ID})
 	if condition == nil && slices.ContainsFunc(wb.conditionlessConnections, func(c EdgeConnection) bool {
 		return conn.Equal(c)
 	}) {
@@ -167,10 +164,7 @@ func (wb *Builder) AddFanOutEdge(source ExecutorBinding, targets []ExecutorBindi
 		}
 		sinkIDs = append(sinkIDs, target.ID)
 	}
-	conn := EdgeConnection{
-		SourceIDs: []string{source.ID},
-		SinkIDs:   sinkIDs,
-	}
+	conn := newEdgeConnection([]string{source.ID}, sinkIDs)
 	edge := Edge{
 		Connection: conn,
 		Index:      wb.edgeIdx(),
@@ -197,11 +191,8 @@ func (wb *Builder) AddFanInBarrierEdge(sources []ExecutorBinding, target Executo
 		sourceIDs = append(sourceIDs, source.ID)
 	}
 	edge := Edge{
-		Connection: EdgeConnection{
-			SourceIDs: sourceIDs,
-			SinkIDs:   []string{target.ID},
-		},
-		Index: wb.edgeIdx(),
+		Connection: newEdgeConnection(sourceIDs, []string{target.ID}),
+		Index:      wb.edgeIdx(),
 	}
 	applyEdgeOptions(&edge, opts)
 	for _, id := range sourceIDs {
diff --git a/workflow/edge.go b/workflow/edge.go
index e3fe73b1d..863032aae 100644
--- a/workflow/edge.go
+++ b/workflow/edge.go
@@ -79,6 +79,
... (truncated)

Activity

  1. michelle-clayton-work commented on Jul 13, 2026

    @michelle-clayton-work
    Contributor

    Pull request #484 is linked to this issue and will close it when merged.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions