Skip to content

[Bug] spawn_agent hangs indefinitely without returning control #34653

Description

@jimicze

Summary

A spawn_agent call remained blocked for approximately 18,901 seconds (5 hours 15 minutes) instead of returning promptly with the spawned agent ID or an actionable error.

Uploaded thread: 019f78cf-a24c-7f30-80ac-c32b3ccfc887

Steps to Reproduce

  1. Start a Codex session with existing completed or idle subagents.
  2. Call spawn_agent to create another reviewer subagent.
  3. Observe that the tool call does not return, time out, or report capacity/status information.
  4. Manually interrupt the turn.

Actual Result

The call remained pending for over five hours and finally returned:

aborted by user after 18901.0s

No agent identifier, timeout, capacity error, or recovery guidance was provided.

Expected Result

spawn_agent should:

  • Return the new agent identifier within seconds; or
  • Fail quickly with a clear capacity or scheduling error; or
  • Apply a bounded timeout and return control to the root agent.

A stalled spawn must not block the entire orchestration turn indefinitely.

Impact

  • Stops all implementation and review progress.
  • Prevents the root agent from sending user updates.
  • Requires manual interruption.
  • Creates uncertainty about whether the requested agent was partially created.
  • Wastes substantial execution time.

Environment

  • Date: 2026-07-22
  • Collaboration mode: Default
  • Repository: selectorChromePlugin
  • Existing subagents: p1_t2_implement, p1_t2_spec_review
  • Requested agent: p1_t2_quality_review

Suggested Fix

Add a bounded scheduling timeout, return explicit agent-capacity state, and make agent creation idempotent so retrying cannot create duplicate agents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsubagentIssues involving subagents or multi-agent featurestool-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