Python: Stop skill discovery below skill boundaries - #6685
Closed
Lovlace777 wants to merge 2 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Stops file-based skill discovery from recursing into subdirectories once a skill boundary (SKILL.md) is found, ensuring nested content remains part of the parent skill rather than being treated as separate skill roots.
Changes:
- Update
FileSkillsSource._discover_skill_directoriesto return immediately after recording a directory containingSKILL.md. - Add a regression test covering a nested
SKILL.mdunder a parent skill boundary.
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 |
Adds an early return in directory traversal to stop descending below a directory containing SKILL.md. |
python/packages/core/tests/core/test_skills.py |
Adds a regression test asserting nested skill roots are not discovered beneath a parent SKILL.md boundary. |
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
eavanvalkenburg
approved these changes
Jun 24, 2026
Contributor
|
@Lovlace777 please answer the CLA requirement described above to proceed with the PR. |
TaoChenOSU
approved these changes
Jun 24, 2026
|
Clean fix! Returning early after finding a SKILL.md prevents descending into nested skill directories. The test with parent-skill containing nested-skill is the perfect regression case. |
Contributor
|
@Lovlace777 reminder to answer the CLA requirement so we can merge the PR |
Contributor
|
Closing as fix is no longer valid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Summary
File-based skill discovery currently keeps descending after it finds a
SKILL.md. This can treat content nested beneath a skill boundary as an independent skill root. Stop discovery at the first skill boundary so everything below it remains part of that skill.Description & Review Guide
SKILL.md, and add a regression test with a nestedSKILL.md._discover_skill_directoriesand the regression test structure.Validation
uv run pytest packages/core/tests/core/test_skills.py::TestDiscoverSkillDirectories -q— 7 passed.uv run pytest packages/core/tests/core/test_skills.py -q— passed.uv run poe test -P core— 3350 passed, 30 skipped, 2 xfailed.uv run poe syntax -P core -C— passed.uv run pyright packages/core/agent_framework/_skills.py— 0 errors.uv run pyright -p pyrightconfig.tests.json packages/core/tests/core/test_skills.py— 0 errors.git diff --check— passed.Notes
No public API, dependency, or compatibility changes. The full core Pyright sweep could not resolve locally absent optional Graphviz, OpenTelemetry exporter, Azure Agent Server, and Azure Content Understanding dependencies; focused strict checks for both changed files pass.
Related Issue
Fixes #6682
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and the title prefix in sync automatically.