Skip to content

[dotnet-code] Consolidate workflow idle status helper #906

Description

@github-actions

Summary

Consolidates the internal workflow execution status decision that maps unserviced requests to PendingRequests and otherwise to Idle. This mirrors the compact .NET HasUnservicedRequests ? PendingRequests : Idle shape and reduces duplicated status-transition logic for future ports.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/LockstepRunEventStream.cs - uses a single pending-request status expression in the lockstep run stream.

Public API and Behavior

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

Tests

  • go test ./workflow/internal/execution

Notes

Rejected candidates inspected from the random sample:

  • dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponse.cs / agent/response.go - Go response text and update aggregation were already closely aligned; further changes risked churn.
  • dotnet/src/Microsoft.Agents.AI.Workflows/RequestInfoEvent.cs / workflow/event.go - event wrapper shape was already minimal and equivalent.
  • dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Models/MessageContentPart.cs / message/content.go - provider/content model differences did not reveal a safe small internal cleanup.

Open [dotnet-code] PRs checked before editing; none appeared to cover the workflow idle-status candidate.

Generated by .NET-to-Go Code Portability Refactoring Agent · gpt55 · 71.6 AIC · ⌖ 13.1 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 dotnet-code-run-status-helper-b01a50a0ecc05c62.

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 (84 of 84 lines)
From ca088def449ba829f8738aa709c2ac3779eac5fb Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Mon, 24 Aug 2026 22:39:44 +0000
Subject: [PATCH] Consolidate workflow idle status helper

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 workflow/internal/execution/eventstream.go | 31 ++++++++--------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/workflow/internal/execution/eventstream.go b/workflow/internal/execution/eventstream.go
index dcee7726c..71324be76 100644
--- a/workflow/internal/execution/eventstream.go
+++ b/workflow/internal/execution/eventstream.go
@@ -233,11 +233,7 @@ func (s *streamingRunEventStream) runLoop() {
 		}
 
 		// Update status based on what's waiting
-		if s.stepRunner.HasUnservicedRequests() {
-			s.setStatus(RunStatusPendingRequests)
-		} else {
-			s.setStatus(RunStatusIdle)
-		}
+		s.setStatus(idleOrPendingRequestsStatus(s.stepRunner))
 
 		// Signal completion to consumer so they can check status and decide whether to continue
 		// Increment epoch so next consumer iteration gets a new completion signal
@@ -492,11 +488,7 @@ func (l *lockstepRunEventStream) TakeEventStream(ctx context.Context, blockOnPen
 
 		defer func() {
 			// Update status
-			if l.stepRunner.HasUnservicedRequests() {
-				l.setStatus(RunStatusPendingRequests)
-			} else {
-				l.setStatus(RunStatusIdle)
-			}
+			l.setStatus(idleOrPendingRequestsStatus(l.stepRunner))
 		}()
 
 		l.setStatus(RunStatusRunning)
@@ -547,11 +539,7 @@ func (l *lockstepRunEventStream) TakeEventStream(ctx context.Context, blockOnPen
 			}
 
 			// Update status
-			if l.stepRunner.HasUnservicedRequests() {
-				l.setStatus(RunStatusPendingRequests)
-			} else {
-				l.setStatus(RunStatusIdle)
-			}
+			l.setStatus(idleOrPendingRequestsStatus(l.stepRunner))
 
 			// Check if we should break
 			status := l.getStatus()
@@ -579,11 +567,7 @@ func (l *lockstepRunEventStream) TakeEventStream
... (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