Skip to content

[dotnet-port-api] Port skill tool auto-approval helpers - #1045

Merged
Quim Muntal (qmuntal) merged 4 commits into
mainfrom
copilot/dotnet-port-api-skills-auto-approval-20260709-0a5188c6deb256e2
Sep 15, 2026
Merged

Quim Muntal (qmuntal) merged 4 commits into
mainfrom
copilot/dotnet-port-api-skills-auto-approval-20260709-0a5188c6deb256e2

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

Summary

Ported the narrow public API portion of the upstream AgentSkillsProvider approval change from microsoft/agent-framework#6729 by adding exported skill-tool name constants plus reusable skills.ReadOnlyToolsAutoApprovalRule and skills.AllToolsAutoApprovalRule helpers in Go. This also adds a focused skills auto-approval sample and updates the feature-comparison note.

The upstream source of truth for this port is commit e3b64fdc4749256fa2d559be18a41f1a008dd7f6. Go already matched the broader behavioral part of that .NET change because all three skill tools already required approval by default, so this PR keeps scope to the missing exported helper surface.

Ported .NET PRs

Breaking Changes

No. Go already required approval for load_skill, read_skill_resource, and run_skill_script by default, so this PR only adds exported constants, reusable auto-approval helpers, tests, and a sample.

Tests and Examples

  • Ran go test ./agent/skills ./agent/harness/toolapproval ./examples/02-agents/skills/...
  • Added examples/02-agents/skills/step04_skills_auto_approval
  • Added focused tests for skills.ReadOnlyToolsAutoApprovalRule and skills.AllToolsAutoApprovalRule

Notes

  • The broader .NET PR also removed .NET-specific ScriptApproval members and updated hosted scenarios; those removals do not map to an equivalent Go API change because Go already exposes per-tool disable knobs instead.
  • Nearby upstream skills changes such as skills source context and reusable public skills source types were already tracked separately and were intentionally not bundled into this narrow PR.

Generated by .NET to Go API Porting Agent · 839.7 AIC · ⌖ 38.9 AIC · ⊞ 21.7K ·

Closes #457

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 9, 2026 20:25
@github-actions github-actions Bot added area:agent Changes files in the agent area area:examples Changes files in the examples area size:large At most 300 changed lines across at most 10 files labels Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new “approve all skills tools” helper and sample should include an explicit warning about auto-approving script execution to reduce unsafe copy/paste usage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Ports the public API surface for skills tool auto-approval helpers from the upstream .NET change, adding exported tool-name constants and reusable auto-approval rule helpers in agent/skills, plus updating docs and providing a sample demonstrating usage.

Changes:

  • Added exported skill tool-name constants and two reusable auto-approval rule helpers (ReadOnlyToolsAutoApprovalRule, AllToolsAutoApprovalRule).
  • Updated skills provider tests to use the new constants and added focused tests for the new helper rules.
  • Added an example demonstrating skills tool auto-approval usage and updated the .NET/Go feature comparison note.
File summaries
File Description
agent/skills/provider.go Exports tool-name constants, adds auto-approval helper rules, and uses constants for tool registration.
agent/skills/provider_test.go Adds coverage for the new auto-approval helpers and updates existing tool-name references to constants.
docs/dotnet-go-sdk-feature-comparison.md Documents the new exported constants and reusable auto-approval helpers as part of skills parity notes.
examples/02-agents/skills/step04_skills_auto_approval/main.go New sample demonstrating skills tool auto-approval configuration.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread agent/skills/provider.go
Comment thread examples/02-agents/skills/step04_skills_auto_approval/main.go Outdated
@github-actions github-actions Bot added kind:code Changes production behavior or code kind:docs Changes documentation or comments kind:examples Changes examples or example-support metadata kind:tests Changes tests, fixtures, or test infrastructure pending-auto-risk public-api-change Pull Request changes public APIs labels Sep 9, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by Go API Consistency Review Agent for #1045 · copilot · auto · 70.1 AIC · ⌖ 6.71 AIC · ⊞ 9.6K

Comment thread agent/skills/provider.go Outdated
@michelle-clayton-work

Copy link
Copy Markdown
Contributor Author

Copilot address PR feedbackl

Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>

Copilot AI commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Copilot address PR feedbackl

Addressed in 5b3dad5: added trusted-skills/script warnings to the helper docs and sample, and aligned the rules with the current auto-approval context API. Targeted tests and CodeQL pass.

@github-actions

This comment has been minimized.

Comment thread agent/skills/provider.go Outdated
Comment on lines +25 to +29
LoadSkillToolName = "load_skill"
// ReadSkillResourceToolName is the name of the tool that reads a skill resource.
ReadSkillResourceToolName = "read_skill_resource"
// RunSkillScriptToolName is the name of the tool that runs a skill script.
RunSkillScriptToolName = "run_skill_script"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexport this for now, not sure they provide enough value.

@github-actions

Copy link
Copy Markdown
Contributor

Scope: public API, examples

Changed Go contract: New exported skills.ReadOnlyToolsAutoApprovalRule and skills.AllToolsAutoApprovalRule (toolapproval.AutoApprovalRule funcs) in agent/skills/provider.go; new examples/02-agents/skills/step04_skills_auto_approval sample; doc update in docs/dotnet-go-sdk-feature-comparison.md.

Upstream evidence reviewed: dotnet/src/Microsoft.Agents.AI/Skills/AgentSkillsProvider.cs (commit e3b64fdc4749256fa2d559be18a41f1a008dd7f6, upstream PR microsoft/agent-framework#6729) — public const string LoadSkillToolName, ReadSkillResourceToolName, RunSkillScriptToolName, and static ReadOnlyToolsAutoApprovalRule/AllToolsAutoApprovalRule properties built on those public constants.

Result: findings reported (one gap; behavior otherwise aligned).

The auto-approval rule helpers themselves match .NET semantics well (read-only vs. all-tools approval, same tool set, same "unmatched call → false, let other rules decide" contract). One gap: .NET makes the three skill tool names (LoadSkillToolName, ReadSkillResourceToolName, RunSkillScriptToolName) public constants on AgentSkillsProvider specifically so consumers can reference them when composing their own custom auto-approval rules or tool-name checks. The Go port defines the equivalent constants (loadSkillToolName, readSkillResourceToolName, runSkillScriptToolName in agent/skills/provider.go) as unexported, so Go users writing a custom toolapproval.AutoApprovalRule for skills tools must hardcode the string literals instead of referencing a stable exported symbol — a minor but real public-API parity gap versus the upstream port this PR is based on. See inline comment for the specific location.

Generated by Go API Consistency Review Agent for #1045 · copilot · auto · 41.9 AIC · ⌖ 8.14 AIC · ⊞ 9.6K ·

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by Go API Consistency Review Agent for #1045 · copilot · auto · 41.9 AIC · ⌖ 8.14 AIC · ⊞ 9.6K

Comment thread agent/skills/provider.go
@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Sep 15, 2026
Merged via the queue into main with commit 4b46045 Sep 15, 2026
28 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the copilot/dotnet-port-api-skills-auto-approval-20260709-0a5188c6deb256e2 branch September 15, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Changes files in the agent area area:examples Changes files in the examples area kind:code Changes production behavior or code kind:docs Changes documentation or comments kind:examples Changes examples or example-support metadata kind:tests Changes tests, fixtures, or test infrastructure public-api-change Pull Request changes public APIs size:large At most 300 changed lines across at most 10 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dotnet-port-api] Port skill tool auto-approval helpers

4 participants