Skip to content

Instantly share code, notes, and snippets.

@AlexanderDzhoganov
Created August 5, 2026 10:43
Show Gist options
  • Select an option

  • Save AlexanderDzhoganov/f16e68626bcb0e20c984e49e0045a40d to your computer and use it in GitHub Desktop.

Select an option

Save AlexanderDzhoganov/f16e68626bcb0e20c984e49e0045a40d to your computer and use it in GitHub Desktop.

Codex CLI appears to have an unbounded agent-wait polling bug

I investigated a Codex CLI 0.146.0 session after noticing frequent horizontal dividers, repeated “Interacted with /root/...” messages, and the model drifting into agent coordination for many hours.

The divider itself is harmless: the TUI displays it between tool activity and the next assistant message. It appears constantly because Codex is repeatedly alternating between agent activity and fresh model responses.

The underlying problem is wait_agent:

  1. It waits locally for a short timeout, commonly 30 seconds.
  2. A quiet timeout returns a successful Wait timed out tool result.
  3. Every tool result forces another model inference over the conversation context.
  4. The model often calls wait_agent again.

There is no harness-side re-arm, backoff, unchanged-state suppression, or maximum polling count. Mail from any child can also wake the parent, causing additional model turns.

In one affected 15-hour turn—after being told to focus on the main release task—I found:

  • 855 wait_agent calls; 559 were plain timeouts
  • 59 spawned agents
  • 154 agent messages and 55 follow-up tasks
  • 150 additional process waits
  • 15 context compactions
  • One streak of 47 consecutive agent waits

This can burn usage, bloat context and logs, trigger repeated compaction, duplicate work, and gradually replace the original task with agent/CI coordination.

The base polling flaw predates 0.146.0, but that release made Ultra’s proactive-agent mode durable across compactions, which may explain why recent long sessions sustain the behavior more aggressively.

Important detail: ultra and max both send maximum reasoning to the model, but only Ultra enables proactive delegation. high, xhigh, and max require agents to be requested explicitly. They can still hit the wait bug when agents are explicitly used; terminal-process polling can affect every effort level.

My current workaround in ~/.codex/config.toml is:

model_reasoning_effort = "max"

[features.multi_agent_v2]
enabled = true
wait_agent_enabled = false
max_concurrent_threads_per_session = 1

The thread cap of 1 includes the root, so it disables subagents. Set it to 2 if you still want one explicitly requested child. Restart Codex and use a fresh thread after changing it.

Related reports: #35259, #33276, and #32640.

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