Skip to content

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

Closed as not planned

Description

@devinder-augur

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

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    model-behaviorIssues related to behaviors exhibited by the model
    tool-callsIssues related to tool calling
    on Mar 16, 2026
  2. devinder-augur commented on Mar 16, 2026

    @devinder-augur
    Author

    none of threads above have valid fixes

  3. etraut-openai commented on Mar 16, 2026

    @etraut-openai
    Contributor

    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.

  4. devinder-augur commented on Mar 16, 2026

    @devinder-augur
    Author

    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

  5. devinder-augur commented on Mar 16, 2026

    @devinder-augur
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingmodel-behaviorIssues related to behaviors exhibited by the modeltool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions