Repository navigation
feat(codex)!: delegate from collaboration V2 parents - #9444
Conversation
The hook adapter's spawn guard admits the V2 spawn, reported as collaborationspawn_agent, under the policy ADR 0159 decision 2 sets: from the root thread only, a registered or absent agent_type, no model, reasoning_effort or fork_context key, and fork_turns explicitly "none" as codex reads it (trimmed, case-insensitive); omission, "0", numbers and other strings are denied. The V2 wait, list and interrupt calls pass through from the root like V1's wait, close and send_input; send_message, followup_task and every other matched name stay denied. V1 policy and its reasons are unchanged apart from the shared not-a-spawn-tool reason. Bootstrap still declines every V2 parent, so the new paths are reached by the adapter tests only. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
config.toml states collaboration V2 as the [features.multi_agent_v2] table instead of the scalar: `enabled = false` keeps the scalar's semantics, so every run rendered today changes in that line alone, and `enabled = true` (not reached by Bootstrap yet) brings the two restriction keys ADR 0159 decision 3 names, rendered only then because the table is deny_unknown_fields. renderCodexConfig takes the switch as a trailing bool and refuses it without a roster, since the table overrides [agents] enabled = false and would give an agent that runs in one context the multi-agent tools. No thread cap is rendered in the table: codex derives the V2 cap from the [agents] key plus the root. Goldens: the three config goldens change in that line; a config-delegating-v2.toml golden pins the enabled table. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
Bootstrap carries the collaboration version the gate takes into the roster, the developer instructions and the config switch: a V2 parent would get the V2 feature table, the V2 dispatch note and V2 child notes. Today the gate admits V1 parents only, so every rendered byte is unchanged; the V2 paths are reached by the unit tests and the config-delegating-v2.toml golden, and a Bootstrap test pins the table off and the V1 note for a delegating V1 parent. The gate comment names what widens the gate to V2: the checked delivery path and the V2 spawn's own backstop. The V2 dispatch note (ADR 0159 decision 5) keeps the sentences the agents repository keys on, puts the "Dispatch follows collaboration V2." marker right after its third sentence, and carries V2's contract: task_name, fork_turns "none", no model, reasoning_effort or fork_context, wait_agent with only timeout_ms, results as messages through the checked delivery path, the four-slot rule with eviction and no close or follow-up call, the interrupt (an interrupted child sends no result), an errored child final for its role, and the withheld result. The V2 child note replaces V1's "no sub-agent tool" sentence with the denial of every multi-agent call. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
The rollout read's shell test writes one more child head, shaped like a 0.166.0 collaboration V2 child's session_meta line: parent_thread_id at the top level and again under source.subagent.thread_spawn, with the spawn's depth and agent_path, synthetic ids throughout. The read must count it once as a child of the root, though it names the parent twice, and its session_id must not read as the thread id. The testdata README says what the head is modelled on. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
…ature table The runtime-implementation guide's spawn-guard row describes the hook as it is on this branch: a V1 spawn_agent with fork_context false and a V2 collaborationspawn_agent with fork_turns "none" are admitted from the root, the V1 and V2 control calls pass through from the root and are denied from a child, and send_message, followup_task, the resume and every other name are denied. The [features.multi_agent_v2] re-check row says the runner renders the table on every run and points at codex's collab_tools_enabled, which decides which children of a V2 parent get the multi-agent tools; the hook-names re-check row points at codex's fork_turns reading (SpawnAgentArgs::fork_mode), which the guard's V2 check mirrors. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
Prototype for fullsend-ai#9085 item 8. On collaboration V2 a child's result reaches the parent as an agent message, not as a tool result, so the PostToolUse chain never sees it. Codex runs SubagentStop in the child with last_assistant_message, the text that becomes the result, before the parent is notified. A block (exit 2 with a reason) makes the child continue instead of finishing. - hooks.json: every PostToolUse group that covers Agent also gets a SubagentStop handler with the same scripts. - Adapter: a SubagentStop phase presents the final message to the chain as an Agent tool result. A block appends a prompt telling the child to reply with a fixed withheld notice. `continue: false` is never emitted, because Codex would end the child and deliver the flagged message. - Golden hooks-default.json regenerated. Not included: admitting V2 in Bootstrap, and tests for the new phase. Both belong to the enablement PR. Known residuals: the gate fails open if the hook process itself fails, an errored child's provider error text is not screened, and a child that repeats flagged text runs until the parent's wait times out. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
A Codex parent whose catalog model selects collaboration V2 now runs its sub-agents as native children, as a V1 parent does (ADR 0159). Each V2 child's final message passes the PostToolUse chain at SubagentStop before Codex delivers it. A block makes the child continue, told to reply with the withheld notice, one Go const that the V2 runtime note quotes. - Bootstrap admits a V2 parent when no child model selects V2. Codex gives a child of a V2 parent the multi-agent tools only when the child's own model selects V2 and applies no max_depth under V2, so a child the runner starts holds no spawn tool; for a spawn the guard did not screen, depth one still rests on the guard. Otherwise the parent runs in one context with a line naming the model. - hooks.json carries the SubagentStop handler, with the scripts of the PostToolUse group that covers Agent, for a run that delegates from a V2 parent; every other run's hooks.json is unchanged. - The adapter ends every block on the SubagentStop phase with the withheld-notice prompt, its own failures included, blocks a payload without a last_assistant_message string, passes the exact notice before the chain runs, and never emits continue: false. - The V2 runtime note quotes the notice and states task_name's rules. - Tests: the SubagentStop phase (block, clean pass, empty message, adapter failure), the V2 gate, the child-model backstop, and the handler's presence in hooks.json for V2 delegation only. - Docs: the gate and its three limits, the backstop, V2 delegation as experimental until the live check, and the bump re-check row. Part of fullsend-ai#9085. BREAKING CHANGE: agents with the Agent tool, or no tools: list (review, retro, code, fix), on a V2 parent model (gpt-5.6-sol, gpt-6.1-sol and the other V2 entries of the 0.166.0 catalog) with harness security on and no V2 child model now spawn native Codex children instead of running in one context, and the children's tokens count in metrics.json. To keep them off native Codex children, pin them to runtime: claude, as docs/runtimes/codex.md recommends for review and retro. Signed-off-by: Dharit Shah <dhshah@redhat.com>
PR Summary by QodoEnable native Codex delegation from collaboration V2 parents
AI Description
Diagram
High-Level Assessment
Files changed (21)
|
|
🤖 Finished Review · ✅ Success · Started 6:46 PM UTC · Completed 6:57 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.72 |
Code Review by Qodo
1.
|
Site previewPreview: https://577e0bd3-site.fullsend-ai.workers.dev Commit: |
|
Risk Assessment: moderate (2/5) DetailsModerate risk: large change modifying existing behavior without a feature flag and with elevated churn in runtime files, balanced by zero protected or security-sensitive paths, solid test coverage, and full alignment with linked issue consensus. Previous runRisk Assessment: moderate (2/5) DetailsModerate risk: large change modifying existing behavior without a feature flag and with elevated churn in runtime files, balanced by zero protected or security-sensitive paths, solid test coverage, and full alignment with linked issue consensus. Previous run (2)Risk Assessment: moderate (2/5) DetailsModerate risk: large change modifying existing behavior with high git churn in runtime files, balanced by zero protected or security-sensitive paths, solid test coverage, and fully resolved linked issue consensus. |
|
Looks good to me Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== --> Looks good to me Previous run (2)<!-- fullsend:review-diff-hash:0cde77eea3f29b72262e46c511f298a11c460b48cd96be042da57e69d59dd2c8 --> Looks good to me Previous run (3)<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== --> Looks good to me Previous run (4)<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== --> Looks good to me Labels: Codex runtime feature in the runner/runtime layer, matching labels on prior Codex runtime PRs. |
|
qodo Finding 3 is intentional. Under V2, Codex gives a child the spawn tool whenever the child's own model selects V2 and applies no |
Your reasoning matches the code and the PR docs, so the gate is intentional. I'd still leave finding 3 open, because the finding is accurate about the ticket's success criteria. What I checked
Where finding 3 stands
I haven't dismissed anything. If you want finding 3 closed as intentional, tell me and I'll dismiss it. Only the PR author can dismiss, so the tool will refuse if you aren't the author. |
|
qodo Dismiss finding 3 as intentional. |
Dismissed |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: three MEDIUM findings, posted inline.
A SubagentStop block put the chain's reason ahead of the withheld-notice prompt, and the child's next final message went through the chain again, so a child could learn which stage fired and reword its result until one passed. - The adapter sends the fixed prompt in place of every block reason on this phase. The reason goes to the findings log only, where every call site already records it. - Once codex sets stop_hook_active after a block, only the exact notice (ASCII whitespace trimmed) passes for the rest of the child's turn and the chain does not run; anything else blocks with the prompt. - codexWithheldNotice's comment says the V2 review and retro rules in the agents repository must list the same text. - Tests: after a block, a clean but different message, an empty, null, missing or non-string one, and the notice with more text or a hidden separator all block without running the chain; the prompt is the whole of stderr and the reason is in the findings log. - Docs: the gate after a block, the limit for a child that never replies with the notice, and a bump re-check of stop_hook_active. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 8:29 PM UTC · Completed 8:38 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.00 |
Superseded by updated review
… result fullsend-ai/fullsend#9444 has the Codex runtime send exactly `RESULT WITHHELD BY FULLSEND` in place of a V2 child's result when its security chain blocks that result. Review and retro now list a payload that is exactly that notice as final without a result, so review applies the sub-agent's failure fallback and retro records the gap in `summary`, instead of reading it as the persona's result. - agents/review.md, agents/retro.md: the notice joins the V2 final-without-result payloads. - scripts/codex-v2-dispatch-contract-test.sh: pins the notice once in each prompt and in each V2 rule body, the way it pins the gate sentence. The V2 rules stay dormant until fullsend emits the gate sentence. Part of fullsend-ai#1500, fullsend-ai/fullsend#6970 and fullsend-ai/fullsend#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
The SubagentStop gate passes the notice with ASCII whitespace around it, so a parent can receive it padded. The V2 runtime note now calls a message whose payload is `RESULT WITHHELD BY FULLSEND`, ignoring whitespace around it, a withheld result, matching the agents repository's V2 review and retro rules. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
Review and retro have now run on a V2 parent with the SubagentStop gate, so codex.md and architecture.md no longer call V2 delegation experimental. Part of fullsend-ai#9085. Signed-off-by: Dharit Shah <dhshah@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 3:27 PM UTC · Completed 3:36 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.83 |
Superseded by updated review
Summary
Codex parents on collaboration V2 now delegate to native children (ADR 0159). Each V2 child's final message passes the PostToolUse chain at
SubagentStopbefore delivery; on a block the child continues, told to reply with the withheld notice. Codex builds the result message only after the child's turn completes, so the V2 rules from fullsend-ai/agents#1971 read the same format (Task name:,Sender:, payload) at 0.166.0. Includes the maintainer's cherry-picked prototype. fullsend-ai/agents#2013 (merged) listsRESULT WITHHELD BY FULLSENDverbatim, so this PR keeps that literal. Item 7 passed on this branch: #9085 (comment).Related Issue
Part of #9085
Changes
fullsend-codex-hook.py: the V2 spawn policy; theSubagentStopphase answers every block with the fixed withheld-notice prompt (the reason goes to the findings log), passes only the exact notice after a block, and never emitscontinue: false.codex_config.go: the[features.multi_agent_v2]table and, for V2 delegation, theSubagentStophandler.codex_bootstrap.go,codex_personas.go: a V2 parent delegates when no child model selects V2, so no child the runner starts holds the spawn tool (the refactor(codex): report every mapped multi-agent call as Agent in the manifest mirror and matcher #9177 review's backstop); the V2 note quotescodexWithheldNotice.runtimes/codex.md(gate, residuals, backstop),runtimes.md,architecture.md, the bump re-check row.Testing
make lintpasses (stage changes first, then run)go test ./internal/runtime/ -run 'Codex' -race -count=1 -timeout 15m,go vet ./...,make lint-md-links,npx vitepress build docsChecklist
!for breaking changes)