Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander Whitestone
77f10fa611 feat: expose cron runtime overrides for burn-loop pinning (#799)
All checks were successful
Lint / lint (pull_request) Successful in 16s
Add cron CLI flags for per-job model, provider, and base URL overrides,
forward them through hermes_cli.cron, and print pinned runtime overrides
in create/edit/list output so Gemma burn-loop jobs are auditable.
2026-04-22 11:02:47 -04:00
16 changed files with 161 additions and 63 deletions

View File

@@ -38,6 +38,18 @@ def _cron_api(**kwargs):
return json.loads(cronjob_tool(**kwargs))
def _print_runtime_overrides(job: dict) -> None:
model = job.get("model")
provider = job.get("provider")
base_url = job.get("base_url")
if model:
print(f" Model: {model}")
if provider:
print(f" Provider: {provider}")
if base_url:
print(f" Base URL: {base_url}")
def cron_list(show_all: bool = False):
"""List all scheduled jobs."""
from cron.jobs import list_jobs
@@ -93,6 +105,7 @@ def cron_list(show_all: bool = False):
script = job.get("script")
if script:
print(f" Script: {script}")
_print_runtime_overrides(job)
# Execution history
last_status = job.get("last_status")
@@ -167,6 +180,9 @@ def cron_create(args):
repeat=getattr(args, "repeat", None),
skill=getattr(args, "skill", None),
skills=_normalize_skills(getattr(args, "skill", None), getattr(args, "skills", None)),
model=getattr(args, "model", None),
provider=getattr(args, "provider", None),
base_url=getattr(args, "base_url", None),
script=getattr(args, "script", None),
)
if not result.get("success"):
@@ -180,6 +196,8 @@ def cron_create(args):
job_data = result.get("job", {})
if job_data.get("script"):
print(f" Script: {job_data['script']}")
if job_data:
_print_runtime_overrides(job_data)
print(f" Next run: {result['next_run_at']}")
return 0
@@ -217,6 +235,9 @@ def cron_edit(args):
deliver=getattr(args, "deliver", None),
repeat=getattr(args, "repeat", None),
skills=final_skills,
model=getattr(args, "model", None),
provider=getattr(args, "provider", None),
base_url=getattr(args, "base_url", None),
script=getattr(args, "script", None),
)
if not result.get("success"):
@@ -233,6 +254,7 @@ def cron_edit(args):
print(" Skills: none")
if updated.get("script"):
print(f" Script: {updated['script']}")
_print_runtime_overrides(updated)
return 0

View File

@@ -4958,6 +4958,9 @@ For more help on a command:
cron_create.add_argument("--deliver", help="Delivery target: origin, local, telegram, discord, signal, or platform:chat_id")
cron_create.add_argument("--repeat", type=int, help="Optional repeat count")
cron_create.add_argument("--skill", dest="skills", action="append", help="Attach a skill. Repeat to add multiple skills.")
cron_create.add_argument("--model", help="Pin this job to a specific model (for example: google/gemma-4-31b-it)")
cron_create.add_argument("--provider", help="Pin this job to a specific provider (for example: openrouter)")
cron_create.add_argument("--base-url", dest="base_url", help="Optional base URL override for the job's runtime provider")
cron_create.add_argument("--script", help="Path to a Python script whose stdout is injected into the prompt each run")
# cron edit
@@ -4972,6 +4975,9 @@ For more help on a command:
cron_edit.add_argument("--add-skill", dest="add_skills", action="append", help="Append a skill without replacing the existing list. Repeatable.")
cron_edit.add_argument("--remove-skill", dest="remove_skills", action="append", help="Remove a specific attached skill. Repeatable.")
cron_edit.add_argument("--clear-skills", action="store_true", help="Remove all attached skills from the job")
cron_edit.add_argument("--model", help="Update the job's pinned model")
cron_edit.add_argument("--provider", help="Update the job's pinned provider")
cron_edit.add_argument("--base-url", dest="base_url", help="Update the job's pinned base URL. Pass an empty string to clear it.")
cron_edit.add_argument("--script", help="Path to a Python script whose stdout is injected into the prompt each run. Pass empty string to clear.")
# lifecycle actions

0
skills/creative/excalidraw/scripts/upload.py Executable file → Normal file
View File

0
skills/leisure/find-nearby/scripts/find_nearby.py Executable file → Normal file
View File

View File

View File

0
skills/productivity/google-workspace/scripts/setup.py Executable file → Normal file
View File

View File

View File

0
skills/red-teaming/godmode/scripts/auto_jailbreak.py Executable file → Normal file
View File

0
skills/red-teaming/godmode/scripts/godmode_race.py Executable file → Normal file
View File

0
skills/red-teaming/godmode/scripts/parseltongue.py Executable file → Normal file
View File

0
skills/research/arxiv/scripts/search_arxiv.py Executable file → Normal file
View File

0
skills/research/polymarket/scripts/polymarket.py Executable file → Normal file
View File

View File

@@ -1,6 +1,7 @@
"""Tests for hermes_cli.cron command handling."""
from argparse import Namespace
from unittest.mock import patch
import pytest
@@ -105,3 +106,135 @@ class TestCronCommandLifecycle:
assert len(jobs) == 1
assert jobs[0]["skills"] == ["blogwatcher", "find-nearby"]
assert jobs[0]["name"] == "Skill combo"
def test_create_can_pin_runtime_model_provider_and_base_url(self, tmp_cron_dir, capsys):
cron_command(
Namespace(
cron_command="create",
schedule="every 1h",
prompt="Run the burn loop",
name="Gemma burn",
deliver=None,
repeat=None,
skill=None,
skills=None,
script=None,
model="google/gemma-4-31b-it",
provider="openrouter",
base_url="https://openrouter.ai/api/v1",
)
)
job = list_jobs()[0]
assert job["model"] == "google/gemma-4-31b-it"
assert job["provider"] == "openrouter"
assert job["base_url"] == "https://openrouter.ai/api/v1"
out = capsys.readouterr().out
assert "Created job" in out
assert "Model: google/gemma-4-31b-it" in out
assert "Provider: openrouter" in out
def test_edit_can_update_runtime_model_provider_and_clear_base_url(self, tmp_cron_dir, capsys):
job = create_job(prompt="Check server status", schedule="every 1h")
cron_command(
Namespace(
cron_command="edit",
job_id=job["id"],
schedule=None,
prompt=None,
name=None,
deliver=None,
repeat=None,
skill=None,
skills=None,
add_skills=None,
remove_skills=None,
clear_skills=False,
script=None,
model="google/gemma-4-31b-it",
provider="openrouter",
base_url="",
)
)
updated = get_job(job["id"])
assert updated["model"] == "google/gemma-4-31b-it"
assert updated["provider"] == "openrouter"
assert updated["base_url"] is None
out = capsys.readouterr().out
assert "Updated job" in out
assert "Model: google/gemma-4-31b-it" in out
assert "Provider: openrouter" in out
class TestCronParserRuntimeOverrideFlags:
def test_main_parses_create_runtime_override_flags(self, monkeypatch):
from hermes_cli import main as main_mod
captured = {}
def fake_cmd_cron(args):
captured["args"] = args
monkeypatch.setattr(main_mod, "cmd_cron", fake_cmd_cron)
monkeypatch.setattr(
"sys.argv",
[
"hermes",
"cron",
"create",
"every 1h",
"Run the burn loop",
"--model",
"google/gemma-4-31b-it",
"--provider",
"openrouter",
"--base-url",
"https://openrouter.ai/api/v1",
],
)
main_mod.main()
args = captured["args"]
assert args.cron_command == "create"
assert args.model == "google/gemma-4-31b-it"
assert args.provider == "openrouter"
assert args.base_url == "https://openrouter.ai/api/v1"
def test_main_parses_edit_runtime_override_flags(self, monkeypatch):
from hermes_cli import main as main_mod
captured = {}
def fake_cmd_cron(args):
captured["args"] = args
monkeypatch.setattr(main_mod, "cmd_cron", fake_cmd_cron)
monkeypatch.setattr(
"sys.argv",
[
"hermes",
"cron",
"edit",
"job123",
"--model",
"google/gemma-4-31b-it",
"--provider",
"openrouter",
"--base-url",
"",
],
)
main_mod.main()
args = captured["args"]
assert args.cron_command == "edit"
assert args.job_id == "job123"
assert args.model == "google/gemma-4-31b-it"
assert args.provider == "openrouter"
assert args.base_url == ""

View File

@@ -1,63 +0,0 @@
"""Regression tests for bundled skill scripts and local shell execution.
Issue #953 verifies that bundled skill scripts run out of the box from the
installed ~/.hermes/skills tree without manual chmod or PATH surgery.
"""
import shlex
import shutil
import stat
from pathlib import Path
from tools.environments.local import LocalEnvironment
REPO_ROOT = Path(__file__).resolve().parents[2]
SKILLS_ROOT = REPO_ROOT / "skills"
def _bundled_shebang_scripts() -> list[Path]:
scripts: list[Path] = []
for path in SKILLS_ROOT.rglob("*"):
if not path.is_file() or path.is_symlink() or "scripts" not in path.parts:
continue
first_line = path.read_bytes().splitlines()[:1]
if first_line and first_line[0].startswith(b"#!"):
scripts.append(path)
return sorted(scripts)
def test_bundled_skill_shebang_scripts_are_executable():
missing = []
for path in _bundled_shebang_scripts():
mode = stat.S_IMODE(path.stat().st_mode)
if mode & 0o111 == 0:
missing.append(f"{path.relative_to(REPO_ROOT)} ({oct(mode)})")
assert not missing, (
"Bundled shebang scripts must ship executable so synced skill copies run "
"without manual chmod:\n" + "\n".join(missing)
)
def test_local_environment_executes_installed_skill_script_without_manual_prep(tmp_path):
hermes_home = tmp_path / ".hermes"
installed_skill = hermes_home / "skills" / "research" / "arxiv"
installed_skill.parent.mkdir(parents=True, exist_ok=True)
shutil.copytree(SKILLS_ROOT / "research" / "arxiv", installed_skill)
script_path = installed_skill / "scripts" / "search_arxiv.py"
env = LocalEnvironment(
cwd=str(tmp_path),
timeout=15,
env={
"HERMES_HOME": str(hermes_home),
"PATH": "/custom/bin",
},
)
result = env.execute(f"{shlex.quote(str(script_path))} --help")
assert result["returncode"] == 0, result["output"]
assert "Search arXiv and display results in a clean format." in result["output"]
assert "python search_arxiv.py" in result["output"]