Skip to content

Python: fix: stop treating backtick-quoted paths as resource references in Fi…#4382

Closed
max-montes wants to merge 1 commit intomicrosoft:mainfrom
max-montes:fix/skills-provider-backtick-parsing
Closed

Python: fix: stop treating backtick-quoted paths as resource references in Fi…#4382
max-montes wants to merge 1 commit intomicrosoft:mainfrom
max-montes:fix/skills-provider-backtick-parsing

Conversation

@max-montes
Copy link

fix: Stop treating backtick-quoted paths as resource references in
FileAgentSkillsProvider

Backtick-quoted filenames in SKILL.md bodies (e.g. config.json) were incorrectly
treated as resource file references by _RESOURCE_LINK_RE. When those files did not
exist in the skill directory, the entire skill was excluded with a warning.

Backticks are standard markdown inline code formatting and do not imply the referenced
file exists locally. Only explicit markdown links [text](path) should be validated
as resource references.

Changes:

Fixes #4369

Motivation and Context

FileAgentSkillsProvider incorrectly treats backtick-quoted filenames (e.g.
config.json) in SKILL.md as resource file references. When those files don't exist in
the skill directory, the entire skill is excluded. This makes it impossible to use
standard markdown inline code formatting to mention filenames in skill documentation
without also providing those files on disk. Fixes #4369.

Description

Updated _RESOURCE_LINK_RE to only match explicit markdown link syntax
([text](path/file.ext)), removing the backtick alternative. Backticks are standard
markdown code formatting and should not imply a file exists locally.

Updated two existing tests to reflect the new behavior and added an integration-level
test that verifies a skill with backtick-quoted filenames (that don't exist on disk)
still loads successfully.

Note: The .NET implementation has the same regex in FileAgentSkillLoader.cs
(line 48) and is affected by the same bug. Will open a separate issue for the .NET fix
after this PR lands.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution
    Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? Minor behavioral change: skills that relied on
    backtick-quoted paths to register resources will need to switch to markdown link syntax
    ([text](path)). Pre-GA.

…leAgentSkillsProvider

Backtick-quoted filenames in SKILL.md bodies (e.g. `config.json`) were
incorrectly treated as resource file references by _RESOURCE_LINK_RE. When
those files did not exist in the skill directory, the entire skill was
excluded with a warning.

Backticks are standard markdown inline code formatting and do not imply
the referenced file exists locally. Only explicit markdown links
([text](path)) should be validated as resource references.

Changes:
- Update _RESOURCE_LINK_RE regex to match only markdown link syntax
- Update tests to verify backtick paths are ignored
- Add integration test for the reported scenario (issue microsoft#4369)

Fixes microsoft#4369

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 2, 2026 04:21
@github-actions github-actions bot changed the title fix: stop treating backtick-quoted paths as resource references in Fi… Python: fix: stop treating backtick-quoted paths as resource references in Fi… Mar 2, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue in the Python FileAgentSkillsProvider where backtick-quoted filenames in SKILL.md (inline code formatting like `config.json`) were incorrectly treated as resource references and could cause the entire skill to be excluded if the referenced files didn’t exist. The change narrows resource detection to explicit Markdown link syntax only, aligning behavior with standard Markdown semantics and resolving issue #4369.

Changes:

  • Update _RESOURCE_LINK_RE to match only Markdown links ([text](path/file.ext)) and stop extracting backtick-quoted paths as resources.
  • Update unit tests for _extract_resource_paths to ensure backtick-quoted filenames are ignored while Markdown links are still extracted.
  • Add an integration-level test ensuring skills still load when SKILL.md contains non-existent backtick-quoted filenames, as long as linked resources are valid.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/packages/core/agent_framework/_skills.py Restricts resource extraction to Markdown link syntax by removing backtick matching from _RESOURCE_LINK_RE.
python/packages/core/tests/core/test_skills.py Updates existing tests to reflect new extraction rules and adds coverage for the reported scenario (issue #4369).

@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _skills.py2251195%155–156, 169–170, 280–282, 317–318, 398, 585
TOTAL22222275887% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4715 247 💤 0 ❌ 0 🔥 1m 16s ⏱️

@max-montes
Copy link
Author

@max-montes please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@max-montes
Copy link
Author

Closing this in favor of #4387, which restructures the skills module and addresses the backtick parsing issue as part of a broader refactor. Happy to help review or test if useful!

@max-montes max-montes closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: FileAgentSkillsProvider incorrectly treats backtick-quoted text in SKILL.md as resource references

3 participants