Repository navigation
skills: improve parity and add composable sources - #1338
Conversation
Add explicit source context, structured JSON script arguments, composable source decorators, and owned-source cleanup. Align filtering, error propagation, and feature activation with core upstream behavior. Port core behavior tests, update catalog mappings, and refresh the skills examples with session filtering, selective approvals, and constructor-injected dependencies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The symbol mapping overstates test coverage by pairing an upstream direct-source test with a Go provider test that omits the agent-field check, contrary to the direct-port requirement.
1 open issue
What changed in this PR
This PR makes the Go skills subsystem session-aware and adds composable sources, improving upstream parity while preserving structured JSON script arguments.
Changes:
- Adds aggregation, caching, filtering, deduplication, and explicit source ownership and cleanup.
- Rebuilds tools per invocation, propagates loader errors, and marks skills-provider telemetry only for nonempty results.
- Expands regression coverage and catalog mappings, and updates examples for selective approval and dependency injection.
| File | Description |
|---|---|
internal/telemetry/featureusage_activation_test.go |
Covers filtered, empty, and failed skills activation. |
examples/02-agents/skills/step05_skills_with_dependencies/main.go |
Adds shared-service dependency injection example. |
examples/02-agents/skills/step04_skills_auto_approval/main.go |
Demonstrates selective approval and session resumption. |
examples/02-agents/skills/step03_mixed_skills/main.go |
Composes cached sources with session filtering. |
examples/02-agents/skills/step02_code_defined_skills/main.go |
Uses named JSON script arguments. |
examples/02-agents/skills/internal/skillhelpers/subprocess_script_runner.go |
Decodes raw JSON into subprocess arguments. |
examples/02-agents/skills/internal/skillhelpers/approval.go |
Adds reusable approval-resumption helper. |
docs/feature-usage-telemetry.md |
Clarifies skills activation criteria. |
agent/skills/source.go |
Implements reusable source composition and cleanup. |
agent/skills/source_test.go |
Tests source ordering, caching, concurrency, and lifecycle. |
agent/skills/skills.go |
Adds source context, JSON callbacks, and Unicode length validation. |
agent/skills/skills_test.go |
Updates source signature coverage. |
agent/skills/script_tool.go |
Forwards JSON arguments without numeric precision loss. |
agent/skills/provider.go |
Integrates sources, invocation-scoped tools, and ownership. |
agent/skills/provider_test.go |
Expands context, lifecycle, JSON, and error coverage. |
agent/skills/provider_internal_test.go |
Updates cache panic and script callback tests. |
agent/skills/fsskills/source.go |
Adapts file sources and runners to new signatures. |
agent/skills/fsskills/source_test.go |
Updates file discovery tests for source context. |
agent/skills/fsskills/source_script_test.go |
Tests JSON forwarding, metadata, and path validation. |
agent/skills/frontmatter_source_test.go |
Adds validation boundary and Unicode tests. |
agent/skills/doc.go |
Documents source composition and lifecycle behavior. |
agent/harness/harness_test.go |
Updates custom-source harness integration. |
_catalog/dotnet-go-sdk-symbol-mapping.json |
Refreshes API assessments and upstream test pairs. |
Review effort: Balanced
Call FilteringSource.Skills directly and verify the supplied agent, session, and skill identity. Point the upstream test pair at this direct port while retaining the provider integration regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Audit the 250 paired core skills tests against the pinned upstream bodies. Retarget sixteen cache-source pairs to direct source tests, including shared-list identity, agent-based isolation, cancellation, retry, and refresh behavior. Retarget the empty scripts collection pair to a direct nil-collection assertion. Keep the existing provider and named-lookup regressions. Preserve catalog metadata, API assessments, and test identities; add no example tests or production API changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Audited the 250 paired core skills tests against .NET revision Fixed 17 additional overstated pairs in 4d1d8b1:
All previous provider and lookup regressions remain. The paired core count stays at 250; catalog provenance and API assessments are unchanged. No production API changes or example tests were added. No additional mismatches were confirmed in the other 233 pairs. Validation: full skills component suite, 20 shuffled runs of affected/direct and retained integration regressions, vet, golangci-lint v2.15.0, strict catalog test-pair checks, and a JSON invariant check limiting catalog edits to these 17 pair targets. |
API consistency review
Changed Go contractThe Upstream evidence reviewed
AssessmentI did not find a parity issue. The Go changes match the .NET shapes I checked: session-aware source context, raw JSON script arguments, and composable aggregating and decorator sources. I did not open the Go diff hunks or the upstream decorator, provider and builder files. The PR's claim that the 27 new test pairs match upstream tests is therefore unchecked. The Go-specific differences (
|

Summary
Breaking API changes
Source.Skills,SourceFunc, filters, and cache selectors use explicitSourceContextagent/session values.Script.RunandScriptRunnerreceivejson.RawMessagerather than positional string slices.NewContextProviderreturns a concrete*ContextProviderwithClose; registered source ownership is opt-in.Compared with .NET Agent Framework at
0c9944cc9f577d51277ac7c55dbc388b60a577af. MCP, hosted integrations, and reflection/inline factories remain out of scope.Validation