A cron agent's frontmatter now takes `lean:` (true, or {allow, tools}) —
passed through _send_message to the sidecar, stamped meta.lean — and,
for a job on a local model, `fallback: {harness, model, effort?, wait}`.
Such a job is probed on its own thread (the scheduler fires inline): the
sidecar's new POST /local-ready wakes the EVOX2 and asks the model for
one token (which loads it), retrying up to `wait` minutes. Not ready —
asleep and not waking, down, or the GPU held by another job — fires the
job on the fallback instead, lastStatus "ok (fallback: …)", shown as an
amber "ran on fallback" chip; Settings → Cron also shows lean/fallback
chips. Regenerated the OpenAPI types for CronRunConfig.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
788 B
Python
25 lines
788 B
Python
"""A cron job's `lean:` frontmatter → the run config's lean spec (sidecar
|
|
launch.py "lean runs")."""
|
|
|
|
from cron import scheduler as cron_mod
|
|
|
|
|
|
def _cfg(fm: str) -> dict:
|
|
return cron_mod.run_config(f"---\n{fm}\n---\nThe job.\n")
|
|
|
|
|
|
def test_no_lean_key_is_a_normal_run():
|
|
assert _cfg("harness: claude\nmodel: sonnet")["lean"] is None
|
|
assert _cfg("lean: false")["lean"] is None
|
|
|
|
|
|
def test_lean_true_takes_the_defaults():
|
|
assert _cfg("lean: true")["lean"] == {}
|
|
|
|
|
|
def test_lean_mapping_keeps_the_valid_programs_and_tools():
|
|
cfg = _cfg("harness: pi\nlean:\n allow: [mail-recap, mail, 'rm -rf', 3]\n"
|
|
" tools: [Bash, Write, Agent]")
|
|
assert cfg["harness"] == "pi"
|
|
assert cfg["lean"] == {"allow": ["mail-recap", "mail"], "tools": ["Bash", "Write"]}
|