Skip to content

[dotnet-port-fixes] Fix approval request checkpoint resume #599

Description

@github-actions

Summary

Fix workflow/agentworkflow so checkpointed pending approval requests keep their concrete request kind after a session JSON round-trip. The host now identifies request content from the persisted PortableValue.TypeID before decoding, which prevents checkpointed ToolApprovalRequestContent payloads from being misread as empty function calls and restores the original inner RequestID when the approval response is routed back into the workflow.

This was selected as a narrow parity port from the upstream workflow session fix because Go already covered the function-call resume path but was missing the corresponding approval-request restore behavior and regression coverage.

Upstream commit: 737042fc9372d5b934157638bc9171fd6840b138

Ported .NET PRs

Breaking Changes

No.

Tests and Examples

  • go test ./workflow/...
  • go test ./...
  • Added TestNew_SerializedSessionResumesApprovalRequestFromCheckpoint in workflow/agentworkflow/workflow_test.go
  • No examples changed

Notes

The existing Go regression already covered serialized-session resume for function-call requests. This PR narrows the parity port to the approval-request path that still lost the original inner request ID after restore.

Generated by .NET to Go Fixes and Test Porting Agent · 1.1K AIC · ⌖ 48.7 AIC · ⊞ 21.7K ·


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-port-fixes-approval-session-1784778198-b3de5fdb82a1333c.

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 (131 of 131 lines)
From 46ebca4bd543b10026e9d60c55c30b86d1e071fd Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Thu, 23 Jul 2026 03:43:18 +0000
Subject: [PATCH] Fix approval request checkpoint resume

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 workflow/agentworkflow/workflow.go      | 12 ++--
 workflow/agentworkflow/workflow_test.go | 81 +++++++++++++++++++++++++
 2 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/workflow/agentworkflow/workflow.go b/workflow/agentworkflow/workflow.go
index 8d9f0e8e2..210b063f9 100644
--- a/workflow/agentworkflow/workflow.go
+++ b/workflow/agentworkflow/workflow.go
@@ -451,11 +451,15 @@ func requestDataContent(req *workflow.ExternalRequest) (message.Content, bool) {
 	if req == nil {
 		return nil, false
 	}
-	if data, ok := req.Data.As(reflect.TypeFor[*message.FunctionCallContent]()); ok {
-		return data.(*message.FunctionCallContent), true
+	if req.Data.TypeID.Match(reflect.TypeFor[*message.ToolApprovalRequestContent]()) {
+		if data, ok := req.Data.As(reflect.TypeFor[*message.ToolApprovalRequestContent]()); ok {
+			return data.(*message.ToolApprovalRequestContent), true
+		}
 	}
-	if data, ok := req.Data.As(reflect.TypeFor[*message.ToolApprovalRequestContent]()); ok {
-		return data.(*message.ToolApprovalRequestContent), true
+	if req.Data.TypeID.Match(reflect.TypeFor[*message.FunctionCallContent]()) {
+		if data, ok := req.Data.As(reflect.TypeFor[*message.FunctionCallContent]()); ok {
+			return data.(*message.FunctionCallContent), true
+		}
 	}
 	content, ok := req.Data.Any().(message.Content)
 	return content, ok
diff --git a/workflow/agentworkflow/workflow_test.go b/workflow/agentworkflow/workflow_test.go
index 13e253c59..0d8f4b589 100644
--- a/workflow/agentworkflow/workflow_test.go
+++ b/workflow/agentworkflow/workflow_test.go
@@ -250,6 +250,87 @@ func TestNew_SerializedSessionResumesFromCheckpoint(t *testing.T) {
 	}
 }
 
+func TestNew_Ser
... (truncated)

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