Bug Description
build_skills_system_prompt() returns a cached skill index before re-reading the disabled-skills config. If config.yaml changes in-process (for example disabling a skill from settings/UI or a long-lived gateway reload path), the prompt can keep advertising the old skill list until the cache is cleared or the process restarts.
Affected files / lines
agent/prompt_builder.py:599-619 — cache lookup returns early
agent/prompt_builder.py:621 — get_disabled_skill_names() runs only after the early return path
Why this is a bug
The cache key includes skills dir, external dirs, tool filters, and platform hint, but not the disabled-skill config state. That means a config-only change can leave the in-process system prompt stale.
This is especially visible in long-lived gateway/CLI processes where skill visibility may change without a full restart.
Minimal reproduction
source venv/bin/activate
python - <<'PY'
import os, tempfile, textwrap
from pathlib import Path
from agent.prompt_builder import build_skills_system_prompt, clear_skills_system_prompt_cache
with tempfile.TemporaryDirectory() as td:
home = Path(td)
os.environ['HERMES_HOME'] = str(home)
d = home / 'skills' / 'demo'
d.mkdir(parents=True)
(d / 'SKILL.md').write_text(textwrap.dedent('''\
---
name: demo
description: demo skill
---
body
'''))
clear_skills_system_prompt_cache()
p1 = build_skills_system_prompt()
(home / 'config.yaml').write_text('skills:\n disabled:\n - demo\n')
p2 = build_skills_system_prompt()
clear_skills_system_prompt_cache()
p3 = build_skills_system_prompt()
print('demo in p1:', 'demo skill' in p1)
print('demo in p2:', 'demo skill' in p2)
print('demo in p3:', 'demo skill' in p3)
PY
Current output:
demo in p1: True
demo in p2: True
demo in p3: False
Expected Behavior
After config.yaml disables a skill, the next build_skills_system_prompt() call in the same process should stop listing that skill.
Actual Behavior
The stale cached prompt is returned until clear_skills_system_prompt_cache() is called or the process restarts.
Suggested investigation direction
- Either include disabled-skill config state in the cache key, or
- move the disabled-skill read ahead of the early-return path, or
- invalidate the prompt cache when skills config changes.
Bug Description
build_skills_system_prompt()returns a cached skill index before re-reading the disabled-skills config. Ifconfig.yamlchanges in-process (for example disabling a skill from settings/UI or a long-lived gateway reload path), the prompt can keep advertising the old skill list until the cache is cleared or the process restarts.Affected files / lines
agent/prompt_builder.py:599-619— cache lookup returns earlyagent/prompt_builder.py:621—get_disabled_skill_names()runs only after the early return pathWhy this is a bug
The cache key includes skills dir, external dirs, tool filters, and platform hint, but not the disabled-skill config state. That means a config-only change can leave the in-process system prompt stale.
This is especially visible in long-lived gateway/CLI processes where skill visibility may change without a full restart.
Minimal reproduction
Current output:
Expected Behavior
After
config.yamldisables a skill, the nextbuild_skills_system_prompt()call in the same process should stop listing that skill.Actual Behavior
The stale cached prompt is returned until
clear_skills_system_prompt_cache()is called or the process restarts.Suggested investigation direction