Skip to content

[dotnet-code] Consolidate skill member lookup internals #763

Description

@github-actions

Summary

Consolidates the duplicated read_skill_resource and run_skill_script skill/member lookup flow behind an unexported helper. This keeps Go's skills provider internals easier to compare against the .NET provider's shared skill tool handling while preserving the existing tool response strings.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsProvider.cs - skill provider tool registration plus load/resource/script lookup methods.

Public API and Behavior

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

Tests

  • go test ./agent/skills
  • Added TestProvider_SkillMemberLookupErrors to preserve resource/script lookup error strings through the shared helper.

Notes

Rejected sampled candidates:

  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/DirectEdgeRunner.cs mapped to Go edge dispatch, but Go already centralizes direct/fan-out/fan-in routing in workflow/internal/execution/edgerunner.go, so a tiny alignment risked churn.
  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/OutputFilter.cs mapped to workflow/inproc/outputfilter.go, which was already small and structurally close.
  • dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsProviderBuilder.cs has no matching public builder surface in Go, so adding one would violate the portability-only/no-public-API-change scope.

Generated by .NET-to-Go Code Portability Refactoring Agent · 703.1 AIC · ⌖ 43.9 AIC · ⊞ 20.8K ·


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-skill-member-lookup-13e4dd201be47d31.

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 (163 of 163 lines)
From bc44ddf2a865945bac57da109d00286e0b7626c7 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 28 Jul 2026 22:44:35 +0000
Subject: [PATCH] Consolidate skill member lookup internals

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/skills/provider.go      | 47 +++++++++++++++-------------
 agent/skills/provider_test.go | 59 +++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 22 deletions(-)

diff --git a/agent/skills/provider.go b/agent/skills/provider.go
index 4031b8274..ee01dbfe8 100644
--- a/agent/skills/provider.go
+++ b/agent/skills/provider.go
@@ -449,20 +449,10 @@ func (p *providerState) loadSkill(ctx context.Context, skills providedSkillSet,
 }
 
 func (p *providerState) readSkillResource(ctx context.Context, skills providedSkillSet, skillName, resourceName string) any {
-	if lookupError := validateSkillName(skillName); lookupError != "" {
-		return lookupError
-	}
-	if strings.TrimSpace(resourceName) == "" {
-		return "Error: Resource name cannot be empty."
-	}
-	resolved, lookupError := skills.lookupSkill(skillName)
+	_, resource, lookupError := resolveSkillItem(skills, skillName, resourceName, "Resource", providedSkill.lookupResource)
 	if lookupError != "" {
 		return lookupError
 	}
-	resource, ok := resolved.lookupResource(resourceName)
-	if !ok {
-		return fmt.Sprintf("Error: Resource '%s' not found in skill '%s'.", resourceName, skillName)
-	}
 	if resource.Read == nil {
 		p.logger.Error("Failed to read resource from skill", "resourceName", resourceName, "skillName", skillName, "error", "resource reader is nil")
 		return fmt.Sprintf("Error: Failed to read resource '%s' from skill '%s'.", resourceName, skillName)
@@ -476,20 +466,10 @@ func (p *providerState) readSkillResource(ctx context.Context, skills providedSk
 }
 
 func (p *providerState) runSkillScript(ctx context.Context, skills providedSkillSet, skillName, scriptName string, argume
... (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