Repository navigation
fix(skills): rebuild PathTrigger from agent-server skill paths (OHE-3565) - #1016
Merged
Merged
Conversation
…565) The agent-server's /api/skills response is converted back into SDK Skill objects by _convert_skill_info_to_skill(), which only knew keyword and task triggers. A skill declared with `paths:` came back with trigger=None, so the agent-server never injected it when a matching file was touched; it was only listed as an on-demand skill. - SkillInfo.paths: list[str] (default []) reads the globs the agent-server returns once OpenHands/software-agent-sdk#5723 ships. - _convert_skill_info_to_skill() builds a PathTrigger from them, checked before the keyword/task branches as in the SDK loader. Responses without paths convert exactly as before.
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
4 of 6 tasks
Contributor
|
🚀 Released in 1.81.0. |
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.
HUMAN:
AGENT:
Why
A repo skill declared with
paths:(a path-triggered rule) never fires in OpenHands Enterprise. The skill loads and the server log lists it, but editing a matching file does not inject it; it behaves like an ordinary on-demand skill.Skills reach a conversation through the sandbox agent-server's
POST /api/skillsresponse, whichload_skills_from_agent_server()converts back into SDKSkillobjects._convert_skill_info_to_skill()only knew keyword and task triggers, and the localSkillInfohad nopaths, so a path skill came back withtrigger=None. On the agent-server, rules are injected only for skills whose trigger is aPathTrigger(LocalConversation._maybe_inject_path_rules→AgentContext.get_tool_use_suffix→Skill.match_path_trigger), so nothing ever matched. The/api/skillsresponse itself also lacked the globs; OpenHands/software-agent-sdk#5723 addsSkillInfo.pathsthere.Summary
skill_loader.SkillInfo.paths: list[str](default[]) reads the globs from the agent-server response._convert_skill_info_to_skill()buildsPathTrigger(paths=...)when they are present, checked before the keyword/task branches as in the SDK loader. The SDK'sSkillvalidator then forcesdisable_model_invocation=True, so the rule is hidden from<available_skills>and injected only on file-touch, exactly like a skill the agent-server loads from disk.paths(current agent-server images) convert exactly as before.Issue Number
#748 (OHE-3565). Not marked
Fixes: the end-to-end fix also needs the SDK release that carries OpenHands/software-agent-sdk#5723 pinned here.How to Test
uv run ruff check openhands/app_server/app_conversation/skill_loader.pyanduv run ruff format --check openhands/app_server/app_conversation/skill_loader.py: clean.mypy --config-file dev_config/python/mypy.ini openhands/app_server/app_conversation/skill_loader.py: no errors in the changed file. The 6 errors it reports are in other modules and identical onmain.uv run pytest tests/unit/app_server/test_skill_loader.py: 75 tests pass."paths": ["app/repositories/**"]converts to aSkillwhose trigger isPathTrigger,disable_model_invocationisTrue,match_path_trigger("app/repositories/payment_repository.py")returns the glob andmatch_path_trigger("app/services/x.py")returnsNone. The skill round-trips throughmodel_dump_json()/model_validate_json(), which is how it travels in the start request. Entries withoutpathsstill produceKeywordTrigger,TaskTriggerorNoneas before.Rule 'storage-note' triggered by path match 'app/repositories/**' for 'app/repositories/payment_repository.py'and the edited file starts with the marker line.Video/Screenshots
Backend only; see the conversion check above.
Type
Notes
openhands-sdk/openhands-agent-serverpins move to a release that includes Skills API drops paths, so path-triggered rules never reach API clients software-agent-sdk#5723 (the pin also selects the bundled sandbox image tag). Safe to merge first: with current imagespathsis absent and behaviour is unchanged.GET /api/v1/app-conversations/{id}/skills) still reportstriggers: []for path skills, matching the agent-server contract; not changed here.Enterprise server image for this PR: