[dotnet-port-api] Port skills source context from .NET - #1048
Conversation
Port .NET skills-source invocation context from microsoft/agent-framework#6797 by threading agent/session metadata through Go skills sources and filters, and by adding cache isolation options for per-context caching. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The provider cache wait path can call buildContext while holding the provider mutex, which can unnecessarily block concurrent invocations and should be refactored.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Ports the upstream .NET “invocation-aware skills source context” change into the Go SDK so skills sources, provider-level filters, and caching can be aware of the invoking agent/session and optionally isolate caches per invocation context.
Changes:
- Introduces
skills.SourceContextand updatesskills.Source/skills.SourceFuncto accept it. - Threads
SourceContextthroughskills.NewContextProvider, updatesSkillFiltersignature, and addsCacheIsolationKeySelectorfor per-context cache buckets (default remains shared). - Updates file-based skills source signature, adjusts/extends skills provider tests, and refreshes the feature comparison doc entry.
File summaries
| File | Description |
|---|---|
| agent/skills/skills.go | Adds SourceContext and updates the public source interface/function adapter to accept invocation context. |
| agent/skills/provider.go | Threads source context into loading/filtering and adds optional cache isolation with per-key caching state. |
| agent/skills/provider_test.go | Adds coverage for source-context propagation and cache-isolation behavior; updates filter signature usage. |
| agent/skills/fsskills/source.go | Updates file-based source to accept SourceContext (currently unused). |
| agent/skills/fsskills/source_test.go | Updates tests to call Skills(ctx, skills.SourceContext{}). |
| agent/skills/fsskills/source_script_test.go | Updates script-related source tests to use the new source signature. |
| agent/skills/frontmatter_source_test.go | Updates in-memory/frontmatter source test invocation for new signature. |
| docs/dotnet-go-sdk-feature-comparison.md | Updates the Skills row to reflect invocation-aware source/filter/caching context support. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Copilot resolve merge conflicts and address PR feedback |
…s-source-context-20260707-ecc3c8b630fbd621 # Conflicts: # agent/skills/fsskills/source.go # agent/skills/fsskills/source_test.go # agent/skills/provider.go # agent/skills/provider_test.go # agent/skills/skills.go Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
Resolved the merge conflicts and addressed the provider cache feedback in |
|
Scope: public API, user-visible behavior Changed Go contract: Upstream evidence reviewed:
Result: aligned. This is a faithful, semantically equivalent port of the linked upstream .NET change. The breaking change to
|
Summary
Port the
.NETskills-source context change from microsoft/agent-framework#6797 so Go skill sources and provider-level filters can receive invocation-aware context.This updates the public
agent/skillssource API to pass a newskills.SourceContextcontaining the current agent and session, threads that context throughskills.NewContextProvider, and addsCacheIsolationKeySelectorso cached skill discovery can be isolated per context when needed while preserving the existing shared-cache default. File-based sources were updated to the new signature, the affected skills tests were updated, and the feature comparison doc now reflects the new invocation-aware skills support.Upstream commit: microsoft/agent-framework@09fbccf
Ported .NET PRs
Breaking Changes
Yes.
Old behavior/API:
skills.Sourceandskills.SourceFuncexposedSkills(context.Context) ([]*skills.Skill, error).skills.ContextProviderOptions.SkillFilteracceptedfunc(*skills.Skill) bool.New behavior/API:
skills.Sourceandskills.SourceFuncnow exposeSkills(context.Context, skills.SourceContext) ([]*skills.Skill, error).skills.ContextProviderOptions.SkillFilternow acceptsfunc(*skills.Skill, skills.SourceContext) bool.skills.ContextProviderOptions.CacheIsolationKeySelectorcan opt specific invocations into isolated cache buckets while keeping the default shared-cache behavior.This breaking change is acceptable for the beta Go SDK because it directly aligns the public skills extension surface with upstream
.NETand enables context-aware skill discovery/filtering without redesigning the broader agent lifecycle.Tests and Examples
go test ./agent/skills/....go test ./....Notes
fsskills.Sourceaccepts the newskills.SourceContextbut currently ignores it, preserving existing discovery behavior while matching the new public interface.Partialbecause Go still lacks the class-based/DI-backed skills support present in.NET.Closes #440