o3-mini / 4o-mini: codex cli agent repeatedly spawns same subagent and hits thread limit

Resolved 💬 5 comments Opened Mar 16, 2026 by devinder-augur Closed Mar 16, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14288
  • #13491
  • #13947

Powered by Codex Action

devinder-augur · 5 months ago

none of threads above have valid fixes

etraut-openai contributor · 5 months ago

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.

devinder-augur · 5 months ago
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

devinder-augur · 5 months ago

@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)'.