Skip to content

Make wait_agent default timeout configurable #18394

Open

Description

@chigkim

What variant of Codex are you using?

cli

What feature would you like to see?

wait_agent currently seems to default to a hardcoded 30 second timeout when timeout_ms is omitted. I’d like a config option to change that default without patching Codex source.

When a spawned agent is still running and the parent calls wait_agent without timeout_ms, the wait expires after 30 seconds. The model then often responds with something like:

"The agent timed out. Let me wait again with more time or check its status."

In practice this is usually not the subagent dying; it is the parent’s wait_agent call timing out.
For long-running subagent tasks, 30 seconds is too short as a default. This causes unnecessary polling loops, noisy model messages, and avoidable extra turns/tool calls.

I can configure things like:

  • stream_idle_timeout_ms
  • agents.job_max_runtime_seconds

but those do not control the default timeout for normal wait_agent calls.

Please add a config option for the default wait_agent timeout, for example:

[agents]
wait_timeout_ms = 300000

It may also be useful to make the min/max clamp configurable, or at least keep max at 1 hour but let users raise the default.

Additional information

The default appears to be hardcoded here?

  • codex-rs/core/src/tools/handlers/multi_agents_common.rs
    • DEFAULT_WAIT_TIMEOUT_MS: i64 = 30_000;
  • codex-rs/core/src/tools/handlers/multi_agents/wait.rs
    • args.timeout_ms.unwrap_or(DEFAULT_WAIT_TIMEOUT_MS)
  • codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs
    • args.timeout_ms.unwrap_or(DEFAULT_WAIT_TIMEOUT_MS)
  • codex-rs/core/src/tools/spec.rs
    • passes default_timeout_ms: DEFAULT_WAIT_TIMEOUT_MS into the tool spec

Activity

  1. added
    CLIIssues related to the Codex CLI
    subagentIssues involving subagents or multi-agent features
    configIssues involving config.toml, config keys, config merging, or config updates
    on Apr 17, 2026
  2. je2ryw commented on Apr 27, 2026

    @je2ryw

    having the same issue with wait_agent timeout after 30 seconds, and in most of case, the main agent will only retry 2-3 times then give up.

  3. czwaxm commented on Jul 24, 2026

    @czwaxm

    这是一个很严重的问题,它导致大量的token 消耗

  4. rezzminator commented on Sep 5, 2026

    @rezzminator

    The current source at ddf04ad26789d040f9ef6a96736f76602e35a6cc exposes v2 timeout configuration under [features.multi_agent_v2] (min_wait_timeout_ms, default_wait_timeout_ms, max_wait_timeout_ms). However, a larger default alone does not stop a model explicitly requesting 60-second waits under its developer instructions. Measured reproduction, mitigation, and requested runtime fixes: #35108 (comment). Repeated parent-model continuations cause excessive token consumption even when the child is healthy and nothing has changed. Please address the instruction conflict and runtime resampling alongside configurable deadlines; changing the default by itself leaves this failure mode intact.

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

    configIssues involving config.toml, config keys, config merging, or config updatesenhancementNew feature or requestsubagentIssues involving subagents or multi-agent features

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions