Repository navigation
feat(cli): delegation limits and the delegated-child launch contract (#585) - #621
Merged
Merged
Conversation
…585) New user-config table [delegation]: max_depth (1-3, default 2), max_live_processes, goal_budget, goal_steps and goal_minutes, user layer only, with out-of-range values refused. The child launch contract carries a delegated child's real depth and its log and node id (TOLE_DELEGATION_LOG, TOLE_DELEGATION_NODE), and agent_start takes launch options (subcommand, depth, secret names to keep) for a delegating host. A delegated child takes its allow patterns and trust presets only from the flags its parent passed (parent intersect profile): its profile's allow, the config's allow and trust and TOLE_TRUST are ignored, since any of them could be wider. The ledger file store moves from cron::store to ledger_file (still reachable as cron::store) so the delegate tool can use it without the cron module.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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
Part 2 of #585 (epic #583): the configuration, launch contract and authority rule that the
delegatetool will build on. Nothing new runs yet: no tool uses these pieces until the next PR (part 3).Part (a) of the plan came to about 1350 lines, past the ~1100 limit, so I split it in two:
delegatetool. It opens after this one merges.Why
Design
docs/profiles-collaboration-secrets.mdA8, with the owner rules in force:delegation.max_depthis 1 to 3, default 2.delegation.max_live_processesis only a machine guard. The goal budget is the cap.Changes
[delegation]config table (config.rs):max_depth,max_live_processes,goal_budget,goal_stepsandgoal_minutes. No key name containstokenorsecret.[cron]:layereddrops a project's[delegation], andconfig checkmarks itIGNORED.max_depthoutside 1–3, or any value of 0, is a config error. Unknown keys are refused.config_apply.rs):TOLE_DELEGATION_LOGandTOLE_DELEGATION_NODEtakes its allow patterns and trust presets only from the--allow/--trustflags its parent passed.allow, the config'sallow/trustandTOLE_TRUSTare ignored, since any of them could be wider than parent ∩ profile.tole-core/src/child_env.rs):ChildLaunchnow carries the child's real depth and, for a delegated child, its log and node id.child_env::delegation(env)reads them back. It trusts only an absolute log path and a node id in the delegation charset.agent_startlaunch options (tole-core/src/agents.rs):ChildOptsholds the child subcommand and its flags (e.g.mission --max-steps …), its depth, the delegation pair, extra secret names to keep, and adelegatedflag. The tree's checks replace the depth-1 refusal only when that flag is set.tole runchild at depth 1.agents_dir(root)andagent_dir(root, id).ledger_file.rs): moved fromcron/store.rs, so the delegate tool can use it without the cron module. It is still reachable ascrate::cron::store, and nothing else changed in it.CHANGELOG.mdentry, theREADME.mdconfig table, adocs/threat-model.mdlaunch-contract note under "Delegation tree (feat(core): delegation — budget carve, depth 2 (max 3), write lease and mandatory report #585)", anddocs/epics.mdE2.Testing
New tests:
config::tests::delegation_table_is_bounded_and_user_layer_onlyconfig_apply::tests::a_delegated_child_takes_allow_and_trust_only_from_its_flagschild_env::tests::a_child_reads_back_what_its_parent_launched(depth 2, the delegation pair, a relative log refused)Each rule was broken on purpose; the matching test went red, and green again once restored:
max_depthbound offdelegation_table_is_bounded_and_user_layer_onlydelegation_table_is_bounded_and_user_layer_only[delegation]kept bylayereddelegation_table_is_bounded_and_user_layer_onlya_child_reads_back_what_its_parent_launcheda_child_reads_back_what_its_parent_launcheda_delegated_child_takes_allow_and_trust_only_from_its_flagsCommands (private
CARGO_TARGET_DIR,CARGO_INCREMENTAL=0, debuginfo off):cargo fmt --all: cleancargo clippy --workspace --all-targets -- -D warnings: cleancargo test --workspace: 1489 passed, 0 failedcargo test -p tole-core --no-default-features: 507 passed, 0 failedcargo build -p tole-cli --no-default-features: okcora review --no-llm --staged: no issues foundNext PR (opens after this merges)
delegatetool:delegate/delegate_poll, withagent_start/agent_pollas deprecated aliases for one release.tole missionwith the carve as--max-steps/--max-minutes/--max-tokens, optionally--profile, and--allow= parent ∩ profile.Profile::granted.executechild takes a write lease on the canonicalized workspace or worktree, checked before it spawns.tole servekeeps the classic depth-1 tools for now, and cron registers no agent tools.developinto it.