o3-mini / 4o-mini: codex cli agent repeatedly spawns same subagent and hits thread limit
Models: o3-mini, 4o-mini (via Responses API)
Behavior: When using spawn_agent (or equivalent delegation), the agent repeatedly spawns the same subagent for the same task instead of waiting for the result. This leads to hitting the thread limit and the run failing.
Expected: After calling spawn_agent for a task, the agent should wait for that subagent’s result, then continue (e.g. close_agent and move on). It should not spawn another agent for the same work.
Question: Is there recommended prompt or configuration guidance to avoid this “spawn same agent again” behavior and stay within thread limits (e.g. one spawn per logical task, then wait for result)?
PS: I have my own custom agent and instruction and codex keep spawning same agent again and again with same instructions. Instruction is to spawn one at time
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
none of threads above have valid fixes
Those older models predate subagents, so they are not expected to perform well with the latest subagent support in Codex. For a list of recommended models to use with Codex, please refer to this documentation.
Does that mean only 5.x models are good at subagents / work fine ? I wanted to use relatively cheaper models hence chose 4o-mini / o3-mini
@etraut-openai this happens with gpt-5.2-codex as well. and i am getting
Failed to delegate task: spawn_agent error 'agent thread limit reached (max 1)'.