Skip to content

fix(agent): refresh skills prompt cache when disabled skills change#7473

Closed
Dusk1e wants to merge 1 commit into
NousResearch:mainfrom
Dusk1e:fix/agent-skills-prompt-cache
Closed

fix(agent): refresh skills prompt cache when disabled skills change#7473
Dusk1e wants to merge 1 commit into
NousResearch:mainfrom
Dusk1e:fix/agent-skills-prompt-cache

Conversation

@Dusk1e

@Dusk1e Dusk1e commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Cache invalidation for disabled skills in build_skills_system_prompt()

What changed

Updated the prompt cache key in build_skills_system_prompt() to include the resolved disabled-skill set.

This ensures the skills prompt is rebuilt immediately when skills.disabled changes in config.yaml, even within the same long-lived Hermes process.

Why

Previously, build_skills_system_prompt() could reuse an in-process cached skills prompt after the disabled skill configuration had changed.

The root cause was that the cache key did not account for the resolved disabled-skill set. Because of that, disabling a skill in config.yaml could still leave that skill visible in <available_skills> until the cache was manually cleared or the process was restarted.

How to reproduce

  1. Create a skill under HERMES_HOME/skills/.../SKILL.md.
  2. Call build_skills_system_prompt() once.
  3. Update config.yaml to disable that skill:
skills:
  disabled: [cached-skill]
  1. Call build_skills_system_prompt() again in the same process.

Before this fix, the disabled skill still appeared in the generated skills prompt because the old cached prompt was returned.

How to verify

Run the targeted regression test:

python -m pytest tests/agent/test_prompt_builder.py -k disabled_skills_change -q

Confirm the new regression test passes.

Then temporarily revert the cache-key change and rerun the same test:

python -m pytest tests/agent/test_prompt_builder.py -k disabled_skills_change -q

Confirm it fails without the fix.

run the full test suite:

python -m pytest tests/ -x -q

Regression test

Added test_rebuilds_prompt_when_disabled_skills_change to tests/agent/test_prompt_builder.py.

The test reproduces the original bug by:

  • building the skills prompt once
  • changing skills.disabled
  • rebuilding in the same process
  • asserting that the disabled skill no longer appears

Platform impact

This change affects platform-neutral Python logic only.

@teknium1

Copy link
Copy Markdown
Contributor

Salvaged into main via PR #12645 (merge commit fd119a1) with your authorship preserved via cherry-pick — git log shows this as your commit. Thanks for the fix and the regression test!

#12645

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants