Forked Worker Inherits Parent User Intent and Misinterprets It as Direct Instruction (Recursive Delegation Attempt)
Open 💬 11 comments Opened Mar 4, 2026 by khaled-wsa
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
codex-cli 0.107.0
What subscription do you have?
Pro
Which model were you using?
gpt-5.3-codex
What platform is your computer?
_No response_
What terminal emulator and version are you using (if applicable)?
_No response_
What issue are you seeing?
When spawning a worker with fork_context: true, the worker can incorrectly treat the parent thread’s last user message (addressed to orchestrator) as if it were addressed to the worker. In this case, the user told the orchestrator to “send a subagent,” and the worker then tried to do that itself, overriding its assigned implementation instructions.
What steps can reproduce the bug?
- In parent thread, user says: “send a subagent to do X.”
- Orchestrator spawns worker with fork_context: true and explicit implementation instructions.
- Observe worker behavior: it interprets the inherited user message as instruction to itself and attempts further delegation instead of implementing X.
What is the expected behavior?
- Worker should follow only the explicit task payload sent to it by the orchestrator.
- Worker should not reinterpret parent-level user intent as its own command stream.
- Worker must not attempt orchestration actions (e.g., spawning more agents) unless explicitly supported and instructed.
Additional information
Suggested fix:
- On spawn with fork_context, enforce an instruction boundary:
- Parent user messages should be treated as historical context, not active directives for worker.
- Worker should execute only orchestrator-provided task payload as authoritative.
- Add role guardrails:
- Block recursive delegation intents in worker role by default.
- Add lint/diagnostic signal:
- Warn when worker output includes orchestrator-only actions (spawn_agent, “launch subagent”, etc.).
11 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Hi, could you
/feedbackfrom such a forked worker and send me the session ID?Hi. I lost the session, but I took a screenshot from the agent thread after running
/agentand opening the thread: https://i.imgur.com/eKnvRGR.pngIn the screenshot, the first message shown is the orchestrator’s instructions to the worker agent. Shortly after, the orchestrator interrupts with another message. As you can see, the worker then attempts to launch a subagent, but it doesn’t have permission to do so, so it ends up echoing:
echo "Launching subagent not possible from shell".Yes, happened to me many times.
Here is my story:
codex agent's context fork = true feature is really misleads spawned agents.
I discussed a big epic task with the main agent, then asked it to decompose epic into tasks, then asked it to spawn agents (with context fork = true) for each task and create files for each of these tasks.
Then each spawned agent with forked context thought he is the orchestrator and each of them tried to launch new agents! 😆
Pic is related. I have restrictions on agents max depth = 1 and spawn_agent tool is not available for them, so they're tried to use bash to spawn agents 😭
<img width="325" height="475" alt="Image" src="https://github.com/user-attachments/assets/40df001a-7373-42c4-918c-4d300eefbaaf" />
I am repeatedly getting subagents that are ignoring the fork directive:
And instead inheriting the parent context and acting as the parent, resulting in agents recursively spawning agents, essentially becoming a useless proxy agent and confusing the root agent.
See thread ID:
019d11aa-2f45-7813-bd18-f217fd22e335(I've sent several feedbacks from several subagents for this thread)---
The parent agent sent this initial message (after any built in spawn directives):
Which evidently did not help anything, because the first message response back from the subagent was:
Implying that it assumed there was some other reviewer subagent (there wasn't it was supposed to be the reviewer subagent) rather than taking on the reviewer role.
When I asked the subagent who inherited the wrong intent what went wrong, I got:
---
Exactly what went wrong:
So the exact misread was:
Why that happened:
What to fix/report:
spawn_agent, the environment should make the context switch unmistakableCONTEXT SWITCH: You are now agent <id> (<role>). You are not the parent agent.A practical rule that would have prevented this:
You are the newly spawned agent, discard all assumptions about being the parent and restate your role before doing anything elseSo the bug to report is not vague “subagent confusion.” It is:
I hit what looks like the same failure mode.
In my case, the parent spawned two research subagents with
fork_context: true. The child agents did not return empty output; they inherited the parent conversation context and behaved like orchestrators instead of workers.Observed behavior:
What fixed it for me:
fork_context: falseI'm also observing the same behaviour. Had to set
fork_context: falseto be able to get anything done...I am also specifically seeing this in Codex Desktop with reviewer-style/read-only subagents.
The failure mode is not just that the child inherits extra context. The more harmful symptom is that a subagent that was supposed to stay read-only starts acting like the parent orchestrator or even slips into implementation behavior.
Typical pattern:
fork_context: trueIn practice,
fork_context: falseis the only reliable workaround I have seen so far for this class of problem.So from my perspective, the core bug is an instruction-boundary failure:
full-history fork is carrying over parent intent with too much authority, instead of treating it as background context and treating the delegated task as the only active instruction for the child.
maybe fork_context: false should be default? same problem
When will this be fixed? Is the fix already planned?
This bug is highly disruptive and was already reported in March.
Whenever if happens (and it does happen sometimes despite clear instructions in my global AGENTS.md to always use
fork_context=false) it spawns a whole repeating chain of agents that wastefully consumes a chunk of the quota.Plus, by not being able to do
fork_context=true, we don't get the benefit of reusing the input cache, and further, the agent has to rediscover the necessary context, further burning tokens.All of this, creating endless chains that burn tokens, and making us restrict ourselves to a less token-efficient workflow, is damaging the user experience a lot.
@etraut-openai
I put together a patch against current
mainfor this and the related reports in #14288 and #14841.It inserts a developer message between the copied history and the child's task, telling the child to treat the earlier conversation as context, not as work it should continue.
Nested forks remove the inherited copy and add a fresh marker at the new fork point. Keeping every marker would save a small amount of code, but the markers have no fork ID or depth, and compaction makes their count unreliable. It could also confuse rollback handling: an older marker could make the code think the current boundary is still present. Agent path and depth are already tracked separately.
The boundary is restored after compaction and after resuming a child.
fork_turns: noneis untouched.Branch: https://github.com/diogovalada/codex/tree/fix/subagent-fork-history-boundary
Commit: https://github.com/diogovalada/codex/commit/8a2f27bdb6d12ee26306bbf0056f3e32457dd9a4
I ran 14 focused tests covering V1/V2, full/last-N/no-history forks, nested forks, paginated resume, compaction, and rollback.
just fix -p codex-coreand Rust formatting both pass.I didn't open a PR because the contribution guide says external PRs aren't accepted. The branch is ready to cherry-pick if someone on the team wants it.
@etraut-openai