fix(agent): invalidate skills prompt cache when disabled skills change#12645
Merged
Conversation
This was referenced Apr 19, 2026
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.
Toggling
skills.disabledin 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; includetuple(sorted(disabled))in cache_key.tests/agent/test_prompt_builder.py: regression testtest_rebuilds_prompt_when_disabled_skills_change.Validation
Closes #12294. Credit also to @jjjojoj (#12367) for independently identifying the same root cause.