Skip to content

fix(skills): profile-aware skills resolution in long-lived runtimes (#40677) - #60180

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-bae45bfd
Jul 7, 2026
Merged

fix(skills): profile-aware skills resolution in long-lived runtimes (#40677)#60180
teknium1 merged 4 commits into
mainfrom
hermes/hermes-bae45bfd

Conversation

@teknium1

@teknium1 teknium1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Profile-local skills now resolve correctly in long-lived multi-profile runtimes (Dashboard/TUI/Desktop backend): the skills tools resolve the active profile's skills directory at call time, and slash-command worker subprocesses inherit the session's profile HERMES_HOME. Fixes #40677.

Root cause: tools/skills_tool.py and tools/skill_manager_tool.py pinned SKILLS_DIR at module import (backend boot, launch profile), and _SlashWorker spawned children with the gateway's env — so every session read/wrote the launch profile's skills regardless of the profile bound to the session.

Salvages PR #56689 (@jplew) and PR #40959 (@iamlukethedev) with authorship preserved, plus a widening commit for the sibling site.

Changes

  • tools/skills_tool.py: _skills_dir() resolves from live get_hermes_home() per call (honors explicit SKILLS_DIR monkeypatches); wired through skills_list, skill_view, category detection, trusted-dir check, rel-path reporting. (@jplew, cherry-picked)
  • tui_gateway/server.py: _SlashWorker accepts profile_home and sets HERMES_HOME in the child env; all 4 spawn sites pass session.get("profile_home"). Reapplied onto the current hermes_subprocess_env(inherit_credentials=True) env builder. (@iamlukethedev, cherry-picked)
  • tools/skill_manager_tool.py: same call-time resolution applied to skill_manage paths (_containing_skills_root, _resolve_skill_dir, _find_skill_in_other_profiles, create-result path) — sibling-site widening.
  • Tests: tests/tools/test_skills_tool_profile_scope.py (3), tests/tui_gateway/test_slash_worker_profile_home.py (4).

Validation

Check Result
New regression tests (7) pass
tests/tools/ skills suites (6 files) pass
tests/tui_gateway/ full directory pass
E2E (real imports, temp homes) env-var switch + set_hermes_home_override ContextVar path both resolve profile skills; skill_manage create writes to active profile home

Infographic

Profile-aware skills resolution

@alt-glitch alt-glitch added type/bug Something isn't working tool/skills Skills system (list, view, manage) comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have labels Jul 7, 2026
jplew and others added 4 commits July 7, 2026 04:32
…cal skill discovery (#40677)

Profile-local skills are unavailable in Dashboard/TUI/Desktop GUI because the
_SlashWorker subprocess is spawned with os.environ.copy() but does NOT receive
the profile-specific HERMES_HOME from the parent session. This causes the
subprocess to search ~/.hermes instead of the active profile's skills directory.

1. Modify _SlashWorker.__init__ to accept optional profile_home parameter
2. When profile_home is provided, set env['HERMES_HOME'] = profile_home before
   spawning the subprocess
3. Update all 4 call sites to pass profile_home=session.get('profile_home')
4. Add regression tests for profile-home propagation

- Full TUI gateway test suite: 107 tests pass
- New tests cover:
  - profile_home parameter acceptance
  - backward compatibility (None, omitted)
  - argv correctness

Fixes #40677
Same bug class as skills_tool: module-level SKILLS_DIR pinned at import
under the launch HERMES_HOME makes skill_manage() write/edit against the
wrong profile in long-lived multi-profile runtimes. Apply the same
_skills_dir() call-time resolution (honoring explicit test patches of
SKILLS_DIR) to _containing_skills_root, _resolve_skill_dir,
_find_skill_in_other_profiles, and create-result path reporting.

Refs #40677
_SlashWorker call sites now pass profile_home=; the fakes' 2-arg
__init__ raised TypeError inside the spawn guard, leaving
slash_worker=None and failing the orphan-race regression tests.
@teknium1
teknium1 force-pushed the hermes/hermes-bae45bfd branch from 18b0e0a to 604d6ab Compare July 7, 2026 11:32
@teknium1
teknium1 merged commit 4f6313e into main Jul 7, 2026
31 checks passed
@teknium1
teknium1 deleted the hermes/hermes-bae45bfd branch July 7, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Profile-local skills are unavailable in Dashboard/TUI/Desktop GUI because child processes use the root HERMES_HOME

4 participants