Repository navigation
feat(cron): --skill and --profile for agent jobs, cron.max_concurrent - #619
Merged
Merged
Conversation
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
🔍 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This is the closing PR of #579. Agent cron jobs now take
--skilland--profileontole cron createandtole 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
--skillandcron.max_concurrent, and epic #583 asked fortole cron create --profile. Validation on save, with a broken job recordedblockedbefore any token is spent, now covers skills and profiles too.Changes
--skill/--profile: these were already global flags (--skillforrun,--profilefor feat(config): profiles with model tiers, allowlist, memory room and skills #584), and clap shares one id per flag name. Sotole cron createandtole cron edittake the global flags rather than defining their own.main.rspasses them in ascron::JobGlobals.--profilefortole cron, because cron records the name in the job and checks it against the user config itself.cronaction given these flags is refused.cron/setup.rs(new):resolve(job)loads them again. A skill that is gone or broken recordsblockedwith codeskill_missing; a profile no longer defined recordsprofile_missing. No token is spent either way.--allowWrite pre-authorization, must follow the instructions the owner chose, not what agit pullor a cloned repo'sskills/put there later.skill_hashesbesideskills, the feat(skills): load only owner-approved skill content hashes #591 package hash for a name entry and the file's bytes hash for a SKILL.md path. It also pins each profile skill (profile_skill_hashes, path to hash).blockedwithskill_changedand spends no tokens. So does a profile skill that was not in the profile when the job was saved, or skills with no pins at all.cron edit --skill(or--profile) re-pins; editing any other field keeps the pins.TOLE_SKILL_APPROVAL=requireda name entry must be an owner-approved package (feat(skills): load only owner-approved skill content hashes #591), elseblockedwithskill_not_approved. File entries are owner-named, as with--skillin feat(skills): load only owner-approved skill content hashes #591.skills::read_file_capped.AgentSetup:# Skill:section per skill (the job's skills, then the profile's). With neither, the run is unchanged.--modelpin, else the profile's default tier, else the environment's model.TOLE_MEMORY=utekeand the binary are present.Profile::granted(job grants). A job has no grant list, so a profile'sgrantsgive a cron run nothing.cron/agent.rs: with a profile,CronApproverauto-approves a Write only when BOTH the job's--allowand the profile'sallowcover it, so the result is never wider than either list. Anything else is parked (serve --cron) or refused (cron tick) as before.run_agenttakes the resolvedAgentSetup.cron/tick.rs: the claim step resolves the setup (and blocks on failure) and passes it to the run.cron.max_concurrent:[cron]key is user layer only, likedaily_token_cap. It accepts 1 to 64; anything else is a config error.tole cron tick(whose--max-concurrentnow defaults to it, then 4) and by thetole serve --cronticker instead of the fixed 4.tole cron statusprintsruns per tick: at most N, andtole config checkshows the key.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 --workspacepasses: 1484 passed, 0 failed (83 suites).cargo test -p tole-core --no-default-featurespasses: 505 passed, 0 failed.cargo test -p tole-cli --no-default-featurespasses: 427 passed, 0 failed.cargo fmt --all -- --checkpasses.cargo clippy --workspace --all-targets -- -D warningspasses, and so doescargo clippy -p tole-cli --no-default-features -- -D warnings.--all-targetswithout default features fails on a dead helper intests/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.tests/cron_profile_e2e.rsruns the realtolebinary withCODECORA_HOME,TOLE_CRON_DIR, a mock provider that records request bodies, and a fakeutekethat logs its argv.The first workspace run on 8d06d75 hit 1
config_trustfailure: a leftover/tmp/tole-trust-e2e-<pid>-Ndirectory 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_savea_run_gets_its_skills_in_the_system_prompt_and_is_blocked_when_one_is_gonea_profile_sets_persona_model_and_grants_nothingconfig::tests::cron_max_concurrent_is_bounded_and_user_layer_onlytests/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 roomprofile-ops.writes_need_both_the_job_and_the_profile_allow_list: the Write runs when both lists allow it, and settlesawaiting_approvalwhen 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;blockedwith 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 areblockedwith no provider request; an edit of another field keeps the pin;edit --skillre-pins and the run uses the new text. Red against 8d06d75: the changed skill ranok.required_approval_blocks_an_unapproved_name_entry(review fix):blockedunderrequireduntiltole 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_gonenow 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):
bad_skills_and_profiles…(e2e)writes_need_both…(e2e)writes_need_both…(e2e)a_profile_sets_persona…a_run_gets_its_skills…a_profile_sets_persona…a_profile_sets_persona…a_profile_sets_persona…a_profiled_job_runs…(e2e)bad_skills_and_profiles…(e2e)bad_skills_and_profiles…(e2e)--skill/--profilebad_skills_and_profiles…(e2e)--profilebad_skills_and_profiles…(e2e)--profileaccepted on other cron actionsbad_skills_and_profiles…(e2e)max_concurrentignores the configmax_concurrent_comes…(e2e)max_concurrentbound not enforcedcron_max_concurrent_is_bounded…a_skill_changed…(e2e)required_approval…(e2e)edit --skilldoes not re-pina_skill_changed…(e2e)a_skill_changed…(e2e)a_skill_changed…(e2e)a_run_gets_its_skills…Related Issues
Closes #579. Epic #577; the profile part is from epic #583 (#584).
Checklist
feat/cron-skills-profile-concurrency)develop