This repository was archived by the owner on Sep 2, 2026. It is now read-only.
Repository navigation
fix(codex/hook): recognize canonical spawn tool and enforce fresh subagent context - #694
Open
pomazanbohdan wants to merge 1 commit into
Open
pomazanbohdan wants to merge 1 commit into
pomazanbohdan wants to merge 1 commit into
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivation
spawn_agent, letting canonical host-bridge calls likemulti_agent_v1.spawn_agentbypass the rewrite that forcesfork_turns = "none", which weakens parent->child context isolation.Description
TRUSTED_SPAWN_AGENT_TOOLS = {"multi_agent_v1.spawn_agent", "spawn_agent"}and check membership accordingly in.codex/hooks/enforce_fresh_subagents.py.fork_turns = "none"rewrite run for the canonical qualified name as well as the unqualified compatibility name..codex/hooks/test_enforce_fresh_subagents.pyto cover qualified canonical names, additional look-alike/spoofed names, unknown-field rejection for both trusted names, and the enforcedfork_turnsrewrite.Testing
python3 .codex/hooks/test_enforce_fresh_subagents.pyand all tests passed (3 tests, OK).python3 -m py_compileon both hook files and they succeeded.hookSpecificOutput.permissionDecision: "allow"andupdatedInput.fork_turns: "none"as expected.{}) and that unknown tool_input fields produce adenydecision with a clear reason; these cases matched the new tests.Codex Task