-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed as duplicate of#4369
Closed as duplicate of#4369
Copy link
Description
Description
FileAgentSkillsProvider currently extracts resource paths from the full SKILL body using a broad regex, then hard-fails the entire skill when any extracted "resource" does not exist.
This creates false positives and makes valid skills unavailable.
What happens:
- Content inside fenced code blocks is scanned and matched as resource paths.
- Backtick matching is too permissive (tokens like
tcp.seq_raware treated as file paths). - If any extracted path does not exist, the whole skill is excluded.
What I expected:
- Ignore fenced code blocks when extracting resource paths.
- For backtick paths, only treat as resource path when it looks like a path (at least contains
/). - Missing resources should be non-fatal (warning), so the skill can still load; keep hard-fail for traversal/symlink security checks.
Steps to reproduce:
- Create a skill folder with a valid
SKILL.mdfrontmatter (name,description). - In the body, include a fenced code block containing
dcx.jsonor protocol-like tokens such astcp.seq_raw. - Instantiate
FileAgentSkillsProvider(skill_paths=...). - Observe that skill loading excludes this skill because non-existent "resources" were extracted from markdown content that should not be treated as resource links.
Code Sample
from pathlib import Path
from tempfile import TemporaryDirectory
from agent_framework import FileAgentSkillsProvider
with TemporaryDirectory() as d:
root = Path(d)
skill_dir = root / "packet-inspector"
skill_dir.mkdir(parents=True, exist_ok=True)
(skill_dir / "SKILL.md").write_text(
"""---
name: packet-inspector
description: Analyze packet captures.
---
Use this field: `tcp.seq_raw`
```json
{ "example": "dcx.json" }See reference.
""",
encoding="utf-8",
)
(skill_dir / "refs").mkdir(exist_ok=True)
(skill_dir / "refs" / "guide.md").write_text("ok", encoding="utf-8")
provider = FileAgentSkillsProvider(str(root))
# expected: skill is loaded
# actual: skill may be excluded due to false-positive resource extraction
### Error Messages / Stack Traces
Typical warning observed during load:
```text
Excluding skill '<skill-name>': referenced resource '<token>' does not exist
Package Versions
agent-framework-core: latest main (reproduced from current repository implementation)
Python Version
Python 3.11+
Additional Context
Current implementation points (Python):
python/packages/core/agent_framework/_skills.py_extract_resource_paths()scans entire body with_RESOURCE_LINK_RE_validate_resources()returnsFalseon first missing resource
Suggested fix direction:
- Strip fenced code blocks before resource extraction.
- Tighten backtick path detection (require
/in backtick candidate). - Treat missing resources as warning-only (do not exclude skill), while keeping path-traversal/symlink violations as exclusion conditions.
Reactions are currently unavailable