-
Notifications
You must be signed in to change notification settings - Fork 132
Fix AGENTS.md not being loaded when skills directories don't exist #1624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit fixes a bug where third-party skill files like AGENTS.md, .cursorrules, CLAUDE.md, and GEMINI.md were not being loaded when the .openhands/skills or .openhands/microagents directories don't exist. The root cause was that load_project_skills() only called load_skills_from_dir() when the skills directories existed, but the third-party file loading logic was inside load_skills_from_dir(). The fix modifies load_project_skills() to: 1. First, load third-party skill files directly from the work directory using find_third_party_files() (which already does case-insensitive matching) 2. Then, load skills from .openhands/skills and .openhands/microagents directories if they exist 3. Merge all skills, avoiding duplicates This ensures third-party skill files are always loaded, regardless of whether the skills directories exist. Tests added: - test_load_project_skills_agents_md_without_skills_directory - test_load_project_skills_agents_md_case_insensitive - test_load_project_skills_multiple_third_party_files - test_load_project_skills_third_party_with_skills_directory Co-authored-by: openhands <[email protected]>
Coverage Report •
|
||||||||||||||||||||
|
@OpenHands please address the two review comments in this PR |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
…ndant code 1. Changed broad 'except Exception' to 'except (SkillError, OSError)' in load_project_skills() to only catch expected exceptions (addresses neubig's comment about over-broad catches) 2. Removed redundant third-party file loading from load_skills_from_dir() since load_project_skills() now handles this directly (addresses enyst's comment about duplicate code at line 567) 3. Updated tests to use load_project_skills() instead of load_skills_from_dir() for testing third-party file loading behavior Co-authored-by: openhands <[email protected]>
|
I've addressed both review comments in PR #1624 and pushed the changes: Changes Made1. Narrowed Exception Handling (neubig's comment)
2. Removed Redundant Code (enyst's comment)
3. Updated Tests
Verification
The commit has been pushed to the |
|
Ah! This was exactly what I was looking for, when I asked about the other place. We have some code somewhere that makes sure that |
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
|
@OpenHands please fix the failing actions on PR #1624 at branch There's error with sdk-tests |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
The tests were using load_skills_from_dir() which no longer loads third-party files (claude.md, gemini.md) from the work directory. After the refactoring, third-party file loading was moved to load_project_skills() to ensure they are loaded even when the .openhands/skills directory doesn't exist. Updated tests to use load_project_skills(root) instead of load_skills_from_dir(skills_dir) to properly test the vendor-specific file gating functionality. Co-authored-by: openhands <[email protected]>
SummaryI fixed the failing sdk-tests in PR #1624 by updating the test file ProblemThe tests were failing because they were using FixChanged the tests to use
Verification
Changes pushedCommit |
enyst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Summary
This PR fixes a bug where third-party skill files like AGENTS.md, .cursorrules, CLAUDE.md, and GEMINI.md were not being loaded when the
.openhands/skillsor.openhands/microagentsdirectories don't exist.Related issue: OpenHands/OpenHands-CLI#300
Problem
The
load_project_skills()function only calledload_skills_from_dir()when the skills directories existed. However, the third-party file loading logic (which usesfind_third_party_files()) was insideload_skills_from_dir().This meant that if a project had an AGENTS.md file but no
.openhands/skillsdirectory, the AGENTS.md file would never be loaded.Solution
Modified
load_project_skills()to:find_third_party_files()(which already does case-insensitive matching).openhands/skillsand.openhands/microagentsdirectories if they existThis ensures third-party skill files are always loaded, regardless of whether the skills directories exist.
Tests Added
test_load_project_skills_agents_md_without_skills_directory: Main bug fix test - verifies AGENTS.md is loaded even when.openhands/skillsdoesn't existtest_load_project_skills_agents_md_case_insensitive: Verifies case-insensitive file matchingtest_load_project_skills_multiple_third_party_files: Tests loading multiple third-party filestest_load_project_skills_third_party_with_skills_directory: Verifies no duplicates when both AGENTS.md and skills directory exist@xingyaoww can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:fd873a4-pythonRun
All tags pushed for this build
About Multi-Architecture Support
fd873a4-python) is a multi-arch manifest supporting both amd64 and arm64fd873a4-python-amd64) are also available if needed