Skip to content

fix(skills): rebuild PathTrigger from agent-server skill paths (OHE-3565) - #1016

Merged
hieptl merged 1 commit into
mainfrom
hieptl/ohe-3565
Oct 27, 2026
Merged

hieptl merged 1 commit into
mainfrom
hieptl/ohe-3565

Conversation

@hieptl

@hieptl hieptl commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

  • A human has tested these changes.

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/skills response, which load_skills_from_agent_server() converts back into SDK Skill objects. _convert_skill_info_to_skill() only knew keyword and task triggers, and the local SkillInfo had no paths, so a path skill came back with trigger=None. On the agent-server, rules are injected only for skills whose trigger is a PathTrigger (LocalConversation._maybe_inject_path_rules → AgentContext.get_tool_use_suffix → Skill.match_path_trigger), so nothing ever matched. The /api/skills response itself also lacked the globs; OpenHands/software-agent-sdk#5723 adds SkillInfo.paths there.

Summary

  • skill_loader.SkillInfo.paths: list[str] (default []) reads the globs from the agent-server response.
  • _convert_skill_info_to_skill() builds PathTrigger(paths=...) when they are present, checked before the keyword/task branches as in the SDK loader. The SDK's Skill validator then forces disable_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.
  • Responses without 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.py and uv 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 on main.
  • uv run pytest tests/unit/app_server/test_skill_loader.py: 75 tests pass.
  • Conversion check with the pinned SDK 1.58.1: a response entry with "paths": ["app/repositories/**"] converts to a Skill whose trigger is PathTrigger, disable_model_invocation is True, match_path_trigger("app/repositories/payment_repository.py") returns the glob and match_path_trigger("app/services/x.py") returns None. The skill round-trips through model_dump_json() / model_validate_json(), which is how it travels in the start request. Entries without paths still produce KeywordTrigger, TaskTrigger or None as before.
  • End to end (once an SDK release with #5723 is pinned here): repeat the issue's repro. The agent-server log shows 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

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-3e801c9

…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.
@hieptl hieptl added the type: fix A bug fix label Oct 25, 2026
@hieptl hieptl self-assigned this Oct 25, 2026
@hieptl
hieptl marked this pull request as ready for review October 25, 2026 04:21
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  openhands/app_server/app_conversation
  skill_loader.py 892
Project Total  

This report was generated by python-coverage-comment-action

@tofarr tofarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🍰

@hieptl
hieptl merged commit cf736bb into main Oct 27, 2026
23 checks passed
@hieptl
hieptl deleted the hieptl/ohe-3565 branch October 27, 2026 11:54
@openhands-release-bot openhands-release-bot Bot added the released: 1.81.0 Shipped in 1.81.0 label Oct 28, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.81.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released: 1.81.0 Shipped in 1.81.0 type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants