Repository navigation
refactor(core): one child-agent launch contract (#443) - #444
Merged
Merged
Conversation
tole_core::child_env holds the environment agent_start gives a child: the variable names, ChildLaunch (id, shared touch log, mailbox room, optional role and handoff file) whose vars() the parent sets on the child process, and the child's read-back helpers depth, sibling and role with the existing validation. agent_start, the spawn-yourself guard, sibling tracking, the handoff tool, the depth cap and the memory room override use it; the public ENV_* constants remain as aliases. No behaviour change.
🔍 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
Adds
tole_core::child_env, the one definition of the environment a parent'sagent_startgives a childtole run, and moves both sides onto it. Closes #443.Why
The parent (tole-core
agents.rs) set sevenTOLE_*variables as string literals, and the child read them back in tole-cli (handoff.rs,sibling.rs,tool_roster::agent_depth,main.rs), with the depth marker matched once more in the spawn-yourself guard. Producer and consumers shared no type: a renamed variable would compile on both sides and silently break children. #380 and #383 each had to touch four modules.Changes
tole-core/src/child_env.rs(new, not behindshell-tools, so an embedder running as a child reads the same contract):DEPTH,AGENT_ID,TOUCH_LOG,ROLE,HANDOFF,MEMORY,MEMORY_ROOM;ChildLaunch { id, touch_log, mailbox_room, role }withvars(), which the parent sets on the child process;depth(0 when absent or unparseable),sibling(agent-id charset validated, non-empty log) androle(role must parse; a role without a handoff path is no role). This is the validation the CLI applied before.agents.rs:agent_startbuilds aChildLaunchand setscmd.envs(launch.vars()); the guard matcheschild_env::DEPTH.sibling_watch.rs:ENV_AGENT_ID/ENV_TOUCH_LOGbecome aliases of thechild_envnames (public API kept).sibling::tracking_from_env,handoff::tool_from_env,tool_roster::agent_depthand the memory room override read throughchild_env;ENV_ROLE/ENV_HANDOFFstay as aliases.No behaviour change: a child gets exactly the same variables (role and handoff only for a role child), and the mailbox room is still derived only from the validated agent id.
Testing
child_envtests: the parent → child round trip (depth 1, sibling id and log, role and handoff file, memory backend and room; no role without a role launch); a parent process reads as no child; malformed values (non-numeric depth, a path-like agent id, an unknown role, a blank handoff path) are not trusted.agentsunit tests (env passed to a fake child, argv guard), tole-cliagents,child_handoff_e2e,sibling_notice_e2e.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo clippy -p tole-core --no-default-features --tests -- -D warnings, bare-profile clippy (none / shell-tools),cargo test --workspace: all green.review_finalize:should_block: false, 0 issues (prepare listed four infoqual-clonehits, ignored by.cora.yaml).