Skip to content

fix(agent): invalidate skills prompt cache when disabled skills change#12645

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-cb8b59ec
Apr 19, 2026
Merged

fix(agent): invalidate skills prompt cache when disabled skills change#12645
teknium1 merged 1 commit into
mainfrom
hermes/hermes-cb8b59ec

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Toggling skills.disabled in config.yaml now takes effect immediately without a gateway restart.

Root cause: build_skills_system_prompt() loaded the disabled set after the LRU cache lookup, so once the prompt was cached the disabled list was never re-consulted. Users paid for dead tokens (~1.7k/turn on a 92-skill, 17-disabled setup) until the process was restarted.

Salvages #7473 by @Dusk1e onto current main with authorship preserved.

Changes

  • agent/prompt_builder.py: resolve disabled set before cache key; include tuple(sorted(disabled)) in cache_key.
  • tests/agent/test_prompt_builder.py: regression test test_rebuilds_prompt_when_disabled_skills_change.

Validation

Before After
Targeted tests 111 pass 112 pass (new regression test)
E2E: toggle disabled mid-process stale prompt returned new prompt rebuilt, same-config still cache-hits

Closes #12294. Credit also to @jjjojoj (#12367) for independently identifying the same root cause.

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.

Bug: disabled skills still appear in system prompt due to stale LRU cache

2 participants