Skip to content

feat(cron): --skill and --profile for agent jobs, cron.max_concurrent - #619

Merged
ajianaz merged 4 commits into
developfrom
feat/cron-skills-profile-concurrency
Nov 11, 2026
Merged

ajianaz merged 4 commits into
developfrom
feat/cron-skills-profile-concurrency

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What

This is the closing PR of #579. Agent cron jobs now take --skill and --profile on tole cron create and tole cron edit. A profiled run applies the profile under the unattended-safety rules. A new user-config key, cron.max_concurrent, sets how many runs one tick executes at once.

Why

Closes #579 (epic #577). The issue's surface lists --skill and cron.max_concurrent, and epic #583 asked for tole cron create --profile. Validation on save, with a broken job recorded blocked before any token is spent, now covers skills and profiles too.

Changes

  • --skill / --profile: these were already global flags (--skill for run, --profile for feat(config): profiles with model tiers, allowlist, memory room and skills #584), and clap shares one id per flag name. So tole cron create and tole cron edit take the global flags rather than defining their own.
    • main.rs passes them in as cron::JobGlobals.
    • Startup no longer resolves --profile for tole cron, because cron records the name in the job and checks it against the user config itself.
    • Any other cron action given these flags is refused.
  • cron/setup.rs (new):
    • Skill entries: a skill name found from the job's workdir (project, then user-global skills) or a SKILL.md file. A file entry is saved as an absolute path.
    • On save: both skills and profile are validated. A broken entry, or a profile the user config does not define, is an error. A script job refuses both flags.
    • On claim: resolve(job) loads them again. A skill that is gone or broken records blocked with code skill_missing; a profile no longer defined records profile_missing. No token is spent either way.
    • Pinned content (review fix, 468a4c7): an unattended run, which may hold --allow Write pre-authorization, must follow the instructions the owner chose, not what a git pull or a cloned repo's skills/ put there later.
    • AgentSetup:
      • The system prompt is the profile's persona plus one # Skill: section per skill (the job's skills, then the profile's). With neither, the run is unchanged.
      • The model is the job's --model pin, else the profile's default tier, else the environment's model.
      • The memory loop runs in the profile's room, only for a profiled job while TOLE_MEMORY=uteke and the binary are present.
      • Secrets are Profile::granted(job grants). A job has no grant list, so a profile's grants give a cron run nothing.
  • cron/agent.rs: with a profile, CronApprover auto-approves a Write only when BOTH the job's --allow and the profile's allow cover it, so the result is never wider than either list. Anything else is parked (serve --cron) or refused (cron tick) as before. run_agent takes the resolved AgentSetup.
  • cron/tick.rs: the claim step resolves the setup (and blocks on failure) and passes it to the run.
  • cron.max_concurrent:
    • The [cron] key is user layer only, like daily_token_cap. It accepts 1 to 64; anything else is a config error.
    • It is used by tole cron tick (whose --max-concurrent now defaults to it, then 4) and by the tole serve --cron ticker instead of the fixed 4.
    • tole cron status prints runs per tick: at most N, and tole config check shows the key.
    • The name contains no secret-like word, so the secret-name guard needs no exemption.
  • Docs: README (an example and the config row), the scheduled-jobs section of the threat model, the automation design surface, epics, and CHANGELOG.

Testing

All run locally on head ac18d02 (e14a348, the merge of develop 4f73cff (#591), the pinning fix 468a4c7, and a merge of develop fb95ac8 (#585)):

  • cargo test --workspace passes: 1484 passed, 0 failed (83 suites).
  • cargo test -p tole-core --no-default-features passes: 505 passed, 0 failed.
  • cargo test -p tole-cli --no-default-features passes: 427 passed, 0 failed.
  • cargo fmt --all -- --check passes.
  • cargo clippy --workspace --all-targets -- -D warnings passes, and so does cargo clippy -p tole-cli --no-default-features -- -D warnings. --all-targets without default features fails on a dead helper in tests/config_apply.rs, a file this PR does not touch.
  • cora review --no-llm --base origin/develop (cora v0.20.0): "No issues found". The LLM review is CI Cora Review.
  • Smoke test: tests/cron_profile_e2e.rs runs the real tole binary with CODECORA_HOME, TOLE_CRON_DIR, a mock provider that records request bodies, and a fake uteke that logs its argv.

The first workspace run on 8d06d75 hit 1 config_trust failure: a leftover /tmp/tole-trust-e2e-<pid>-N directory from a reused pid on the shared machine. That file is untouched here, and the test passed on the rerun above.

New tests:

  • cron::setup::tests:
    • skill_entries_are_names_or_files_validated_on_save
    • a_run_gets_its_skills_in_the_system_prompt_and_is_blocked_when_one_is_gone
    • a_profile_sets_persona_model_and_grants_nothing
  • config::tests::cron_max_concurrent_is_bounded_and_user_layer_only
  • tests/cron_profile_e2e.rs:
    • a_profiled_job_runs_with_persona_model_skills_and_memory_room: the system message is the persona plus the skill, the model is the profile's, the job pin wins, and uteke is called with room profile-ops.
    • writes_need_both_the_job_and_the_profile_allow_list: the Write runs when both lists allow it, and settles awaiting_approval when only one does.
    • bad_skills_and_profiles_are_refused_on_save_and_block_the_run_later: create, edit and script refusals; other actions refuse the flags; blocked with no provider request.
    • max_concurrent_comes_from_the_user_config: the default 4, the config value, and an out-of-range value as an error.
    • a_skill_changed_after_save_blocks_the_run_until_edit_re_pins_it (review fix): name, file and profile skills unchanged run; changed after save they are blocked with no provider request; an edit of another field keeps the pin; edit --skill re-pins and the run uses the new text. Red against 8d06d75: the changed skill ran ok.
    • required_approval_blocks_an_unapproved_name_entry (review fix): blocked under required until tole skills approve. Red against 8d06d75: it ran.
  • cron::setup::tests::a_run_gets_its_skills_in_the_system_prompt_and_is_blocked_when_one_is_gone now also covers unpinned skills (skill_changed), the approval gate (skill_not_approved), and a changed skill.

Red/green: each behavior was broken on purpose, the named test was seen failing, the file was restored, and the test passed again. All 22 mutants were killed (16, plus 6 for the pinning fix):

Broken variant Test that failed
run not blocked when a skill or profile is gone bad_skills_and_profiles… (e2e)
profile allow list ignored writes_need_both… (e2e)
job allow list ignored writes_need_both… (e2e)
persona left out of the system prompt a_profile_sets_persona…
skills left out of the system prompt a_run_gets_its_skills…
profile model ignored a_profile_sets_persona…
profile model beats the job pin a_profile_sets_persona…
profile grants passed through unfiltered a_profile_sets_persona…
memory room not the profile's a_profiled_job_runs… (e2e)
profile not validated on save bad_skills_and_profiles… (e2e)
skills not validated on save bad_skills_and_profiles… (e2e)
script job accepts --skill/--profile bad_skills_and_profiles… (e2e)
edit ignores --profile bad_skills_and_profiles… (e2e)
--profile accepted on other cron actions bad_skills_and_profiles… (e2e)
max_concurrent ignores the config max_concurrent_comes… (e2e)
max_concurrent bound not enforced cron_max_concurrent_is_bounded…
changed skill not detected a_skill_changed… (e2e)
approval gate ignored for name entries required_approval… (e2e)
edit --skill does not re-pin a_skill_changed… (e2e)
every edit re-pins a_skill_changed… (e2e)
changed profile skill not detected a_skill_changed… (e2e)
unpinned skills allowed a_run_gets_its_skills…

Related Issues

Closes #579. Epic #577; the profile part is from epic #583 (#584).

Checklist

  • Branch name follows convention (feat/cron-skills-profile-concurrency)
  • Branch is from develop
  • Commit messages follow Conventional Commits
  • No secrets or credentials committed
  • One logical change per PR

Agent jobs take the global --skill (repeatable: a skill name found from
the workdir, or a SKILL.md file) and --profile NAME on cron create and
cron edit. Both are validated on save and again when a run is claimed:
a skill that is gone or broken, or a profile the user config no longer
defines, records the run blocked before any token is spent.

A profiled run gets the profile's persona and skills in its system
prompt, its default-tier model (below the job's --model pin) and its
memory room (when TOLE_MEMORY=uteke). A Write is auto-approved only when
both the job's --allow and the profile's allow list cover it; secrets
are Profile::granted(job grants), and a job grants none.

New user-config key cron.max_concurrent (1 to 64, default 4) for cron
tick and the serve --cron ticker; tick --max-concurrent overrides it and
cron status shows it.

Closes #579.
…rofile-concurrency

# Conflicts:
#	CHANGELOG.md
#	crates/tole-cli/src/main.rs
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

An unattended run resolved a skill name with load_skill at every claim,
so it followed whatever the workdir held then (a git pull, a cloned
repo's skills/) and ignored TOLE_SKILL_APPROVAL=required. Saving a job
now pins a content hash per skill entry (skill_hashes beside skills: the
#591 package hash for a name, the file's bytes hash for a SKILL.md path)
and per profile skill (profile_skill_hashes). At claim a skill whose
hash differs records the run blocked (skill_changed), with no tokens
spent; cron edit --skill (or --profile) re-pins, any other edit keeps
the pins. With approval required a name entry must be an owner-approved
package, else the run is blocked (skill_not_approved). The skill text
is parsed from the bytes that were hashed, and skill files are read
with a 1 MiB cap.
…rofile-concurrency

# Conflicts:
#	CHANGELOG.md
@ajianaz
ajianaz merged commit 7c9fe6a into develop Nov 11, 2026
19 of 20 checks passed
@ajianaz
ajianaz deleted the feat/cron-skills-profile-concurrency branch November 20, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cron): tole cron CLI, cron tick, serve ticker, agent and script modes

2 participants