Skip to content

[dotnet-code] Clarify edge runner kind internals #1050

Description

@github-actions

Tip

Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch dotnet-code-edge-kind-internals-20260909222836-5dd8b328a27fec17. Please review the changes, including any protected files, before creating the pull request.

Create the pull request

The original pull request description is below.


Summary

Introduces a small unexported edge-kind helper in the workflow edge runner and routes telemetry/stateful-edge setup through it. This keeps the Go internals closer to the .NET workflow model's explicit EdgeKind classification while preserving the existing public API and runtime behavior.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI.Workflows/Edge.cs - defines explicit EdgeKind values for direct, fan-out, and fan-in workflow edges.
  • dotnet/src/Microsoft.Agents.AI.Workflows/EdgeData.cs - keeps edge data tied to a connection representation used by the edge kind.

Public API and Behavior

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

Tests

  • go test ./workflow/internal/execution ./workflow

Notes

Random .NET sample inspection covered workflow edge/run internals and shared agent JSON utilities. I rejected Run.cs because the corresponding Go run handle code already has distinct lifecycle responsibilities and any cleanup risked behavior churn. I rejected AgentJsonUtilities.cs because the Go JSON helper is already a narrow generic utility and changing serializer defaults would not be portability-only. Visible open PR checks did not show an open [dotnet-code] PR covering the workflow edge candidate; two lower-integrity PR records were unavailable to inspect. The required direct git fetch of microsoft/agent-framework was blocked by the environment, so the .NET files were inspected through the configured GitHub read bridge instead.


Note

GitHub Actions is not permitted to create or approve pull requests in this repository.

The changes have been pushed to branch dotnet-code-edge-kind-internals-20260909222836-5dd8b328a27fec17 and are ready to review.

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

Show patch preview (63 of 69 lines)
From fdae6e6462ff0c39bb35fd539c8f022aadc7abb7 Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 9d651fe2d2ed5e64c30cf67d1ac637a1097ff62c
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 9 Sep 2026 22:29:33 +0000
Subject: [PATCH] [dotnet-code] Clarify edge runner kind internals

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 workflow/internal/execution/edgerunner.go | 27 +++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/workflow/internal/execution/edgerunner.go b/workflow/internal/execution/edgerunner.go
index 925045c..c04ab37 100644
--- a/workflow/internal/execution/edgerunner.go
+++ b/workflow/internal/execution/edgerunner.go
@@ -33,6 +33,14 @@ type statefulEdgeState struct {
 	unseen          map[string]struct{}
 }
 
+type edgeKind int
+
+const (
+	directEdge edgeKind = iota
+	fanOutEdge
+	fanInEdge
+)
+
 func newStatefulEdgeState(sourceIDs []string) *statefulEdgeState {
 	state := &statefulEdgeState{
 		sourceIDs: sourceIDs,
@@ -134,7 +142,7 @@ func NewEdgeRunner(wf *workflow.Workflow, tracer StepTracer, ensureExecutor func
 	var statefulEdges map[int]*statefulEdgeState
 	for _, edges := range wf.Edges() {
 		for _, edge := range edges {
-			if len(edge.Connection.SourceIDs) <= 1 {
+			if kindOfEdge(edge) != fanInEdge {
 				continue
 			}
 			if statefulEdges == nil {
@@ -458,11 +466,22 @@ func edgeGroupMetadata(edge workflow.Edge) observability.EdgeGroupMetadata {
 }
 
 func edgeGroupType(edge workflow.Edge) string {
-	if len(edge.Connection.SourceIDs) > 1 {
+	switch kindOfEdge(edge) {
+	case fanInEdge:
 		return "FanInEdgeRunner"
+	case fanOutEdge:
+		return "FanOutEdgeRunner"
+	default:
+		return "DirectEdgeRunner"
+	}
+}
+
+func kindOfEdge(edge workflow.Edge) edgeKind {
+	if len(edge.Connection.SourceIDs) > 1 {
+		return fanInEdge
 	}
 	if len(edge.Connection.SinkIDs) > 1 || edge.Assigner != nil {
-		return "FanOutEdgeRunner"
+		return fanOutEdge
 	}
-	return "D
... (truncated)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by .NET-to-Go Code Portability Refactoring Agent · copilot · gpt55 · 107.7 AIC · ⌖ 13.6 AIC · ⊞ 18.4K ·

Activity

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