Skip to content

[dotnet-code] Consolidate delivery mapping construction #979

Description

@github-actions

Summary

Centralized internal DeliveryMapping construction behind unexported helpers and reused them in the workflow edge, input, and response delivery paths. This mirrors the corresponding .NET DeliveryMapping shape where construction is centralized, making future .NET-to-Go ports easier to compare without changing runtime behavior.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/DeliveryMapping.cs - centralizes delivery mapping initialization through constructors for single and multiple envelopes/targets.

Public API and Behavior

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

Tests

go test ./workflow/internal/execution

Notes

Rejected candidates from the random sample:

  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StateScope.cs mapped to Go state internals that were already structurally close and risked behavior-sensitive churn around nil/delete semantics.
  • dotnet/src/Microsoft.Agents.AI.Abstractions/FeatureIndex.cs did not have a useful corresponding Go internal abstraction to clean up without inventing a feature placeholder.
  • dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs mapped to declarative conversion logic not clearly present in this Go checkout, so changing it would have been speculative.

Generated by .NET-to-Go Code Portability Refactoring Agent · gpt55 · 62.3 AIC · ⌖ 11.9 AIC · ⊞ 23.2K ·


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 copilot/dotnet-code-delivery-mapping-1788388227-c60872f5139c3e3b.

Click here to create the pull request

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 (77 of 77 lines)
From 88369d6e7d9c18df415418b8e49e7241c68065b2 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 2 Sep 2026 22:30:27 +0000
Subject: [PATCH] Consolidate delivery mapping construction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 workflow/internal/execution/edgerunner.go | 15 +++------------
 workflow/internal/execution/run.go        | 11 +++++++++++
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/workflow/internal/execution/edgerunner.go b/workflow/internal/execution/edgerunner.go
index 7d348204e..925045c6f 100644
--- a/workflow/internal/execution/edgerunner.go
+++ b/workflow/internal/execution/edgerunner.go
@@ -259,10 +259,7 @@ func (em *EdgeRunner) PrepareDeliveryForEdge(ctx context.Context, edge workflow.
 		return nil, nil
 	}
 	span.SetDeliveryStatus(observability.DeliveryStatusDelivered)
-	return &DeliveryMapping{
-		Targets:   targets,
-		Envelopes: envelopes,
-	}, nil
+	return newDeliveryMapping(envelopes, targets), nil
 }
 
 func (em *EdgeRunner) filterEnvelopesForTarget(ctx context.Context, envelopes []*MessageEnvelope, target *workflow.Executor) ([]*MessageEnvelope, error) {
@@ -399,10 +396,7 @@ func (em *EdgeRunner) PrepareDeliveryForInput(ctx context.Context, envelope *Mes
 		return nil, nil
 	}
 	span.SetDeliveryStatus(observability.DeliveryStatusDelivered)
-	return &DeliveryMapping{
-		Targets:   []*workflow.Executor{target},
-		Envelopes: []*MessageEnvelope{envelope},
-	}, nil
+	return newSingleDeliveryMapping(envelope, target), nil
 }
 
 // PrepareDeliveryForResponse prepares delivery of an external response to
@@ -438,10 +432,7 @@ func (em *EdgeRunner) PrepareDeliveryForResponse(ctx context.Context, response *
 		return nil, nil
 	}
 	span.SetDeliveryStatus(observability.DeliveryStatusDelivered)
-	return &DeliveryMapping{
-		Targets:   []*workflow.Executor{target},
-		Envelopes: []*MessageEnvelope{envelope},
-	}, nil
+	return newSingleDeliveryM
... (truncated)

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