microsoft / microsoft/agent-framework-go
[dotnet-code] Consolidate messageworkflow text helper
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 618
- Forks
- 56
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 122
Description
> [!TIP]
> **Your pull request is ready to create! 🎉 ✅**
>
> Everything is OK—the changes have been pushed to branch `dotnet-code-messageworkflow-text-helper-20260917223131-285b459e563c0a4a`. Please review the changes, including any protected files, before creating the pull request.
>
> **[Create the pull request](https://github.com/microsoft/agent-framework-go/compare/main...dotnet-code-messageworkflow-text-helper-20260917223131-285b459e563c0a4a?expand=1&title=%5Bdotnet-code%5D%20Consolidate%20messageworkflow%20text%20helper)**
>
> The original pull request description is below.
---
## Summary
Consolidates the internal string-to-message construction used by message workflow accumulation and forwarding into one unexported helper. This mirrors the .NET chat forwarding shape where string inputs are converted to a chat message in one place, making future .NET-to-Go ports easier to compare without changing behavior.
## .NET Reference
- `dotnet/src/Microsoft.Agents.AI.Workflows/ChatForwardingExecutor.cs` - converts string messages to chat messages for forwarding routes.
## Public API and Behavior
No public Go API changed. No intentional behavior change was made.
## Tests
- `go test ./message/messageworkflow`
## Notes
Rejected candidates from the random .NET sample: `dotnet/src/Microsoft.Agents.AI.Workflows/MessageMerger.cs` already closely matches the Go response/message merge state structure; `dotnet/src/Microsoft.Agents.AI.Workflows/ScopeId.cs` already matches Go scope equality/hash semantics closely enough that a code change would have been churn. The required upstream git fetch was attempted but blocked by the environment permission boundary, so the .NET reference was inspected through the read-only GitHub MCP content tool instead. No open `[dotnet-code]` PR was found in the current repository PR list.
---
> [!NOTE]
> GitHub Actions is not permitted to create or approve pull requests in this repository.
> The changes have been pushed to branch `dotnet-code-messageworkflow-text-helper-20260917223131-285b459e563c0a4a` and are ready to review.
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](https://github.github.com/gh-aw/reference/faq/#why-is-my-create-pull-request-workflow-failing-with-github-actions-is-not-permitted-to-create-or-approve-pull-requests)
Show patch preview (41 of 55 lines)
```diff
From a8c30d360b377543dfcebe1a5418d4ded1c0743a Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 15e68364d23450bb00f1c846218038b2c1152ada
From: "github-actions[bot]"
Date: Thu, 17 Sep 2026 22:31:31 +0000
Subject: [PATCH] [dotnet-code] Consolidate messageworkflow text message helper
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
message/messageworkflow/messageforwarding.go | 5 +----
message/messageworkflow/messageworkflow.go | 12 ++++++++----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/message/messageworkflow/messageforwarding.go b/message/messageworkflow/messageforwarding.go
index 7b1848e..4e4daa6 100644
--- a/message/messageworkflow/messageforwarding.go
+++ b/message/messageworkflow/messageforwarding.go
@@ -56,10 +56,7 @@ func ConfigureForwarding(executor *workflow.Executor, options *ForwardingOptions
func forwardStringMessage(role message.Role) func(*workflow.Context, any) (any, error) {
return func(ctx *workflow.Context, msg any) (any, error) {
- return struct{}{}, ctx.SendMessage("", &message.Message{
- Role: role,
- Contents: []message.Content{&message.TextContent{Text: msg.(string)}},
- })
+ return struct{}{}, ctx.SendMessage("", newTextMessage(role, msg.(string)))
}
}
diff --git a/message/messageworkflow/messageworkflow.go b/message/messageworkflow/messageworkflow.go
index 404b3ff..5b0714e 100644
--- a/message/messageworkflow/messageworkflow.go
+++ b/message/messageworkflow/messageworkflow.go
@@ -119,10 +119,14 @@ func Configure(executor *workflow.Executor, options *Options) {
func accumulateStringMessage(state *MessageState, role message.Role) func(*workflow.Context, any) (any, error) {
return func(ctx *workflow.Context, msg any) (any, error) {
- return appendTurnMessages(ctx, state, &message.Message{
- Role: role,
- Contents: []message.Content{&message.TextContent{Text: msg.(string)}},
- })
+ return appendTurnMessages(ctx, state
... (truncated)
```
> Generated by [.NET-to-Go Code Portability Refactoring Agent](https://github.com/microsoft/agent-framework-go/actions/runs/35281948427) · copilot · gpt55 · 105.3 AIC · ⌖ 12.4 AIC · ⊞ 14.5K · [◷](https://github.com/search?q=repo%3Amicrosoft%2Fagent-framework-go+%22gh-aw-workflow-id%3A+dotnet-code-portability-nightly%22&type=pullrequests)
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
Review message/messageworkflow/messageforwarding.go and message/messageworkflow/messageworkflow.go, where the proposed helper consolidation is shown. Run go test ./message/messageworkflow and compare the behavior with the referenced .NET ChatForwardingExecutor.cs implementation. Done means the internal string-to-message construction is consolidated without public API or intentional behavior changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100