Skip to content

skills: improve parity and add composable sources - #1338

Merged
Quim Muntal (qmuntal) merged 3 commits into
mainfrom
agent-skills-parity
Oct 29, 2026
Merged

Quim Muntal (qmuntal) merged 3 commits into
mainfrom
agent-skills-parity

Conversation

@qmuntal

Copy link
Copy Markdown
Member

Summary

  • Make skill sources and filters session-aware, and pass structured JSON values to scripts without losing numeric precision.
  • Add reusable aggregation, caching, filtering, and deduplication sources; compose them in the provider with explicit source ownership and cleanup.
  • Propagate content/resource loader errors, rebuild tools per invocation, and activate skills telemetry only for nonempty results.
  • Add 27 core upstream test pairs, update catalog assessments, and refresh the mixed-source, selective-approval, and dependency-injection examples. No example tests are included.

Breaking API changes

  • Source.Skills, SourceFunc, filters, and cache selectors use explicit SourceContext agent/session values.
  • Script.Run and ScriptRunner receive json.RawMessage rather than positional string slices.
  • NewContextProvider returns a concrete *ContextProvider with Close; 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

  • Agent, telemetry, function-tool, and OpenAI provider regression suites pass.
  • Skills examples build and pass vet; no live Azure requests were made.
  • Lint passes with golangci-lint v2.15.0.
  • Strict catalog API reconciliation and test-pair checks pass.

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>
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner October 29, 2026 16:49
Copilot AI balanced review requested due to automatic review settings October 29, 2026 16:49
@github-actions github-actions Bot added area:agent Changes files in the agent area area:examples Changes files in the examples area area:internal Changes files in the internal area labels Oct 29, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added parity-approved Go API consistency review found no parity issues public-api-change Pull Request changes public APIs labels Oct 29, 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 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>
@github-actions

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>
@qmuntal

Copy link
Copy Markdown
Member Author

Audited the 250 paired core skills tests against .NET revision 0c9944cc9f577d51277ac7c55dbc388b60a577af, comparing setup, primary entrypoints, cases, and assertions rather than test names.

Fixed 17 additional overstated pairs in 4d1d8b1:

  • 16 cache-source pairs now target direct CachingSource.Skills tests. The ports check shared-list identity, agent-based isolation, cancellation/restart, retries, and refresh behavior.
  • The inline Scripts_WhenNoneAdded_ReturnsNullAsync pair now checks the nil scripts collection itself, instead of only a missing named lookup.

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.

@github-actions

Copy link
Copy Markdown
Contributor

API consistency review

Result Scope
aligned public API, user-visible behavior, examples

Changed Go contract

The agent/skills package changes in four places. Source and filter calls now take an explicit SourceContext with agent and session. Script.Run and ScriptRunner now receive json.RawMessage. The PR adds aggregating, caching, filtering and deduplicating sources. NewContextProvider now returns *ContextProvider with Close and opt-in source ownership. The PR also changes the skills examples.

Upstream evidence reviewed

Implementation Source Contract checked
.NET AgentSkillsSourceContext.cs The context carries the agent and a nullable session, matching Go's SourceContext.
.NET AgentSkillScript.cs RunAsync takes raw JSON arguments in either object or array form, matching Go's json.RawMessage.
.NET Skills directory listing Aggregating and decorator sources (caching, filtering, dedup), the provider and its builder exist upstream.

Assessment

I 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 (Close instead of Dispose, opt-in ownership) are idiomatic. Existing labels parity-approved and public-api-change are already correct, so no label changes are needed.

Generated by Go API Consistency Review Agent for #1338 · copilot · auto · 27.4 AIC · ⌖ 0.618 AIC · ⊞ 4.9K · ◷

@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit a2a205d Oct 29, 2026
23 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the agent-skills-parity branch October 29, 2026 21:11
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 area:internal Changes files in the internal area parity-approved Go API consistency review found no parity issues public-api-change Pull Request changes public APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants