You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extracted unexported workflow helpers for resettable-executor detection and ownership-conflict errors. This keeps the Go ownership/reset flow structurally closer to the .NET Workflow implementation, where resettable detection and ownership conflict handling are separated from the main ownership transition path.
No public Go API changed. No intentional behavior change was made.
Tests
go test ./workflow/...
Notes
Rejected candidates from the random .NET sample:
dotnet/src/Microsoft.Agents.AI.Workflows/DirectEdgeData.cs - Go already centralizes direct-edge connection construction; adding matching source/sink fields would change the public Edge shape.
dotnet/src/Microsoft.Agents.AI/Skills/Decorators/DeduplicatingAgentSkillsSource.cs - Go already has a narrow deduplicateSkillsByName helper with matching first-wins behavior.
dotnet/src/Microsoft.Agents.AI.Abstractions/AgentSessionStateBag.cs - closest Go session state changes would touch public session semantics, so this was left unchanged.
Checked open [dotnet-code] PRs before editing; the readable existing PR was unrelated, and no open PR matched workflow ownership/resettable internals.
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/workflow-ownership-helpers-4ed47954f005f27e.
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 (97 of 97 lines)
From caf679eaa378d9b0f39ecb89a0159fa411267eb0 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 28 Aug 2026 22:30:38 +0000
Subject: [PATCH] refactor workflow ownership helpers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
workflow/workflow.go | 48 ++++++++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/workflow/workflow.go b/workflow/workflow.go
index af2160adf..7ea506264 100644
--- a/workflow/workflow.go+++ b/workflow/workflow.go@@ -182,6 +182,30 @@ func sameOwnershipToken(left any, right any) bool {
return leftOK && rightOK && leftType == rightType && leftPtr == rightPtr
}
+func (w *Workflow) hasResettableExecutors() bool {+ for _, binding := range w.executorBindings {+ if binding.ResetFunc != nil {+ return true+ }+ }+ return false+}++func ownershipConflictError(subworkflow bool, owner *workflowOwner) error {+ switch {+ case subworkflow && owner.subworkflow:+ return errors.New("cannot use a Workflow as a subworkflow of multiple parent workflows")+ case subworkflow && !owner.subworkflow:+ return errors.New("cannot use a running Workflow as a subworkflow")+ case !subworkflow && owner.subworkflow:+ return errors.New("cannot directly run a Workflow that is a subworkflow of another workflow")+ case !subworkflow && !owner.subworkflow:+ return errors.New("cannot use a Workflow that is already owned by another runner or parent workflow")+ default:+ panic("unreachable")+ }+}+
// Name returns the optional human-readable workflow name.
func (w *Workflow) Name() string {
if w == nil {
@@ -337,12 +361,7 @@ func (w *Workflow) describeOutputYields() ([]reflect.Type, error) {
// HasResettableExecutors reports whether any executor binding can reset shared
// resources between workflow runs.
func (w *Workflow) HasResettableExecutors() bool {
- for _, binding := range w.executorBindings {- if b
... (truncated)
Summary
Extracted unexported workflow helpers for resettable-executor detection and ownership-conflict errors. This keeps the Go ownership/reset flow structurally closer to the .NET
Workflowimplementation, where resettable detection and ownership conflict handling are separated from the main ownership transition path..NET Reference
dotnet/src/Microsoft.Agents.AI.Workflows/Workflow.cs- workflow ownership, resettable executor checks, and conflict error selection.Public API and Behavior
No public Go API changed. No intentional behavior change was made.
Tests
go test ./workflow/...Notes
Rejected candidates from the random .NET sample:
dotnet/src/Microsoft.Agents.AI.Workflows/DirectEdgeData.cs- Go already centralizes direct-edge connection construction; adding matching source/sink fields would change the publicEdgeshape.dotnet/src/Microsoft.Agents.AI/Skills/Decorators/DeduplicatingAgentSkillsSource.cs- Go already has a narrowdeduplicateSkillsByNamehelper with matching first-wins behavior.dotnet/src/Microsoft.Agents.AI.Abstractions/AgentSessionStateBag.cs- closest Go session state changes would touch public session semantics, so this was left unchanged.Checked open
[dotnet-code]PRs before editing; the readable existing PR was unrelated, and no open PR matched workflow ownership/resettable internals.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/workflow-ownership-helpers-4ed47954f005f27e.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 (97 of 97 lines)