Skip to content

test(agents): add SEP-2640 Skills conformance harness - #1655

Open
groupthinking wants to merge 4 commits into
mainfrom
codex/mcp-skills-conformance-1640
Open

test(agents): add SEP-2640 Skills conformance harness#1655
groupthinking wants to merge 4 commits into
mainfrom
codex/mcp-skills-conformance-1640

Conversation

@groupthinking

Copy link
Copy Markdown
Owner

Summary

Activates the pre-authorized TEST trigger in #1640 after SEP-2640 was accepted and official MCP Inspector support merged.

This is a fixture-only host conformance harness for Agent Factory. It does not enable remote skills in production or load external skill content.

What it tests

  • extension and Resources capability negotiation
  • skills/list, skills/get, resources/read, and gated resources/directory/read request shapes
  • compound identity (host-assigned server identity, URI)
  • same-name collision receipts without silent substitution
  • complete manifest, digest, byte-size, path-containment, 512-file, and 16 MiB checks
  • non-skill:// URI support as permitted by the extension
  • exact SKILL.md frontmatter reconciliation
  • explicit content-bound approval and revocation on manifest drift
  • origin-bound resource reads and dynamic-manifest denial
  • separate explicit per-skill permission for execution tools
  • durable in-memory verification and denial receipt shapes for later adapter wiring

Sources

Verification

  • Python syntax compilation: passed
  • dependency-light manual discovery/approval/digest/traversal smoke: passed
  • local pytest: unavailable in the automation runtime; repository CI is authoritative

Safety boundary

Draft only. No runtime registration, remote server connection, skill loading, tool execution, deployment, billing action, or production mutation is included. A later runtime adapter must preserve explicit approval and origin binding.

Advances #1640.

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Canceled Canceled Sep 11, 2026 7:03am UTC

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: bd976c29-b41a-457c-9001-ac8f0fa18cd8


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

🔍 PR Validation

⚠️ Large PR detected (746 lines changed)

@github-actions github-actions Bot added the python label Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA e4c20f8.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

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

A critical stale-approval flaw and multiple protocol-conformance gaps remain unresolved.

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

Pull request overview

Adds a fixture-only SEP-2640 MCP Skills conformance harness for future Agent Factory integration.

Changes:

  • Models skill discovery, manifests, approvals, verification, and receipts.
  • Adds tests covering protocol, integrity, and trust boundaries.
File summaries
File Description
tests/unit/test_mcp_skills_conformance.py Exercises conformance and security behavior.
src/youtube_extension/services/agents/mcp_skills_conformance.py Implements the in-memory conformance host.
Review details

Suppressed comments (4)

src/youtube_extension/services/agents/mcp_skills_conformance.py:168

  • Collision detection is confined to one server instance. The linked requirement also covers same-named skills from different MCP origins and local filesystem skills, but the two-origin test only compares identities and can never emit a collision receipt. Add a host-level registry/namespace fixture that combines origins and verifies no cross-origin shadowing or substitution.
        for name, identities in names.items():
            if len(identities) > 1:
                for identity in identities:

src/youtube_extension/services/agents/mcp_skills_conformance.py:184

  • GetSkillResult also requires resultType: "complete", but this path ignores it, so malformed skills/get responses pass conformance. Validate the result envelope before parsing skill.
        entry = self._parse_entry(result.get("skill"))

src/youtube_extension/services/agents/mcp_skills_conformance.py:190

  • skills/get must work for a URI absent from a partial listing and is also the specified refresh path after digest drift. Rejecting every unlisted or changed entry prevents both flows and leaves prior approval state untouched. Register an unlisted entry, and for an existing identity replace the snapshot while revoking approval when its resource fingerprint changes.
        listed = self.entries.get(identity)
        if listed is None or listed != entry:
            raise SkillsConformanceError("skills/get disagrees with skills/list")
        self._record("skills/get", "VERIFIED", entry.uri, "entry matches listing")

tests/unit/test_mcp_skills_conformance.py:79

  • This test only proves that two tuple identities differ. Because the entries live in independent single-origin hosts, neither registry sees the same-name cross-origin collision and no collision receipt is emitted, leaving the linked requirement to surface and prevent substitution across servers or local skills unimplemented. Add a host-level multi-origin registry fixture and assert both entries remain explicitly addressable with a surfaced collision.
def test_compound_identity_keeps_same_uri_from_two_origins_distinct() -> None:
    first = host().ingest_list({"skills": [raw_skill()]})[0]
    second_host = SkillsConformanceHost("other-server", capabilities())
    second = second_host.ingest_list({"skills": [raw_skill()]})[0]
    assert first.identity != second.identity
  • Files reviewed: 2/2 changed files
  • Comments generated: 7
  • Review effort level: Balanced

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

Comment on lines +187 to +189
listed = self.entries.get(identity)
if listed is None or listed != entry:
raise SkillsConformanceError("skills/get disagrees with skills/list")
Comment on lines +131 to +139
def directory_request(self, request_id: int, uri: str) -> dict[str, Any]:
if not self.directory_read_enabled:
raise SkillsConformanceError("directoryRead was not declared")
return {
"jsonrpc": "2.0",
"id": request_id,
"method": "resources/directory/read",
"params": {"uri": uri},
}
Comment on lines +143 to +145
raw_skills = result.get("skills")
if not isinstance(raw_skills, list):
raise SkillsConformanceError("skills/list result must contain skills")
Comment on lines +156 to +160
for identity, old in self.entries.items():
new = next_entries.get(identity)
if (
identity in self.approvals
and (new is None or new.approval_fingerprint() != old.approval_fingerprint())
Comment on lines +255 to +266
if resource_uri == entry.uri:
parsed = _frontmatter(content)
if parsed != entry.frontmatter:
return self._record(
"resources/read",
"DENIED",
entry.uri,
"SKILL.md frontmatter differs from entry",
resource_uri,
resource.digest,
actual,
)
Comment on lines +314 to +319
if not isinstance(frontmatter.get("name"), str) or not isinstance(
frontmatter.get("description"), str
):
raise SkillsConformanceError("frontmatter requires name and description")
if not _SKILL_NAME.fullmatch(frontmatter["name"]):
raise SkillsConformanceError("frontmatter name violates Agent Skills rules")
Comment on lines +429 to +433
try:
block = text.split("---\n", 2)[1]
parsed = yaml.safe_load(block)
except (yaml.YAMLError, IndexError) as exc:
raise SkillsConformanceError("SKILL.md frontmatter is malformed") from exc
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

⚠️ Repository reconciliation: this PR does not reference exactly one canonical issue.

Please add a Closes #<issue> reference in the PR description so it can be tracked against the delivery plan.

See governance: #898

Copy link
Copy Markdown
Owner Author

September 10 stable-spec compatibility repair

The stable Skills specification changed after this PR was opened: ext-skills commit d866efd, merged September 10, now makes both skills/list and skills/get extend the base 2026-07-28 CacheableResult.

Normative fields now enforced on this branch:

  • resultType: "complete"
  • nonnegative numeric ttlMs
  • cacheScope: "public" | "private"

Commits 493006d and e4c20f8 add validation, retain the server-provided freshness metadata, migrate existing fixtures to the corrected wire shape, and add negative cases for absent/negative/boolean TTLs and invalid scopes.

This remains fixture-only. Cache metadata is treated as a freshness/scope hint, never as integrity or approval evidence. Current-head security, CodeQL, dependency, and secret gates passed; CI and coverage are still running at the time of this receipt. No merge, runtime activation, remote skill load, or deployment was performed.

Copy link
Copy Markdown
Owner Author

Verification closure for head e4c20f8: CI, Coverage, Security, CodeQL, Dependency Review, and Secret Scan all completed successfully. CI reports 8,236 tests passed. E2E was skipped, so no runtime or deployment claim is made. PR remains open, mergeable, unmerged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-task high-priority Urgent - blocks revenue or core functionality mcp/agent python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants