Skip to content

The agent that grows with you

fix(cron): inject skill config into scheduled runs

Hukla43891e9f8e9e
diff --git a/cron/scheduler_prompt.py b/cron/scheduler_prompt.py
index 586a791ded0..f35e5dd95e3 100644
--- a/cron/scheduler_prompt.py
+++ b/cron/scheduler_prompt.py
@@ -130,6 +130,7 @@ def _load_cron_skill_parts(job: dict, skill_names: list[str]) -> list[str]:
from tools.skills_tool import skill_view
from tools.skill_usage import bump_use
from agent.skill_bundles import build_bundle_invocation_message, resolve_bundle_command_key
+ from agent.skill_commands import _inject_skill_config
from agent.skill_utils import normalize_skill_lookup_name
job_label = job.get("name", job.get("id"))
task_id = str(job.get("id") or "") or None
@@ -176,6 +177,7 @@ def _load_cron_skill_parts(job: dict, skill_names: list[str]) -> list[str]:
f'[IMPORTANT: The user has invoked the "{skill_name}" skill, indicating they want you to follow its instructions. The full skill content is loaded below.]',
"",
str(loaded.get("content") or "").strip()])
+ _inject_skill_config(loaded, parts)
if skipped:
parts.insert(0, (
diff --git a/tests/cron/test_cron_prompt_injection_skill.py b/tests/cron/test_cron_prompt_injection_skill.py
index ccab9d0daee..fdb396d4dab 100644
--- a/tests/cron/test_cron_prompt_injection_skill.py
+++ b/tests/cron/test_cron_prompt_injection_skill.py
@@ -138,6 +138,48 @@ class TestScanAssembledCronPrompt:
class TestBuildJobPromptScansSkillContent:
+ @pytest.mark.parametrize(
+ ("configured_value", "expected_value"),
+ [
+ ("/tmp/cron-data", "/tmp/cron-data"),
+ (None, "(not set)"),
+ ],
+ )
+ def test_cron_skill_receives_declared_config(
+ self, cron_env, configured_value, expected_value
+ ):
+ hermes_home, scheduler = cron_env
+ skill_dir = hermes_home / "skills" / "cron-config"
+ skill_dir.mkdir(parents=True)
+ (skill_dir / "SKILL.md").write_text(
+ "---\n"
+ "name: cron-config\n"
+ "description: Uses configured cron data\n"
+ "metadata:\n"
+ " hermes:\n"
+ " config:\n"
+ " - key: cron_config.data_dir\n"
+ " description: Directory used by the cron skill\n"
+ "---\n\n"
+ "Use the configured data directory.\n",
+ encoding="utf-8",
+ )
+ if configured_value is not None:
+ (hermes_home / "config.yaml").write_text(
+ "skills:\n"
+ " config:\n"
+ " cron_config:\n"
+ f" data_dir: {configured_value}\n",
+ encoding="utf-8",
+ )
+
+ prompt = scheduler._build_job_prompt(
+ {"id": "job-config", "skills": ["cron-config"], "prompt": "run"}
+ )
+
+ assert "[Skill config (from" in prompt
+ assert f"cron_config.data_dir = {expected_value}" in prompt
+
def test_builtin_style_github_api_example_is_allowed(self, cron_env):
hermes_home, scheduler = cron_env
_plant_skill(
@@ -351,4 +393,3 @@ class TestScriptOutputNotStrictScanned:
assert "\u200b" not in prompt
assert "item oneitem two" in prompt
-