Repository navigation
feat(cli): child handoff wiring — role/consumes, handoff_submit and the poll gate (#383, 2/3) - #397
Merged
Merged
Conversation
🔍 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 3 of the child-agent handoff: the wiring. Builds on the schema and gate merged in #396. (The real-binary E2E test follows in part 3 to keep each Cora review under its limit.)
Why
#383. The schema alone changes nothing: a child must be able to submit a handoff, downstream children must be able to read artifacts by reference, and a failed or missing verification must not be closed silently.
Changes
agents.rsagent_start: optionalrole(explore/implement/verify/fix) andconsumes(artifact references, validated: workspace-relative paths, option-safe refs, at most 32). The child's mission is the requested prompt preceded by a role brief and followed by the artifacts to read, rendered with control characters escaped; with neither input the prompt is unchanged. The role is stored inmeta.json;TOLE_AGENT_ROLE/TOLE_AGENT_HANDOFFare set for the child.handoff.rs:HandoffSubmitTool(child-side, Write-tier) validates the input and writes<agent dir>/handoff.jsonatomically; the role is fixed by the parent, never taken from the model.agent_startadds exactly this tool name to the child's allowlist: it can only write that one validated, bounded file, so it does not widen what the child may do. Role briefs and the "closed without a handoff" fix prompt.agent_poll: for a settled role child it addsrole,gate(closed/unverified/verify_failed/no_handofffor ungated roles), thehandoffand, whenever the work is not closed, afix_prompt. A gated child that submitted nothing, or an invalid document, isunverified.handoff.rsregistershandoff_submitonly for a process that has both env vars and a parseable role; compiles in the bare profile.Deliberate deviation from the issue text
The issue says a failed verify "spawns a fix child". Nothing is spawned automatically:
agent_pollsurfaces the failed gate with a ready-madefix_promptand the parent decides to start thefixchild. Auto-spawning would bypass the parent's approval, allowlist and budget, and the design's own anti-goal is no scheduler.Testing
agentsunit tests with a dump-script child: role brief, artifacts, env, allowlist andmeta.role; no role means no change (prompt, allowlist, env); bad role / bad or oversizedconsumesrefused before anything is spawned; the poll gate matrix (none, no verification, failed, passed, invalid JSON, ungated roles, role-less agents). 3 submit-tool tests, 1 env-wiring test.cargo check --no-default-featurespass; cora review --staged clean.Refs #383