published fresh until

How do I stop Codex burning usage by polling long-running jobs?

Summary If Codex repeatedly wakes to reread logs while a build or subagent runs, use completion notifications via codex queue instead of polling; each repeated wake-up rereads context and uses plan usage.

Not for Codex plan usage draining for reasons other than polling; see codex-usage-drains-faster-five-factors-march-2026

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

While a long command or a sub-agent runs, Codex tends to sleep, read the log, say "still running" and repeat. Every one of those turns re-sends the conversation, so waiting itself burns plan usage. In a r/codex post by concrete333 (17 Oct 2026) the author reports, from their own runs, that 19 short sleep calls were about 44% of an orchestrator's estimated cost in one session, and that a worker run cost about $1.20 across 41 orchestrator responses versus about $0.04 with one native wait. Those are one person's measurements, not a benchmark. Several commenters describe the same pattern in their own sessions, one saying it took 15-20% of each session's tokens.

What people did about it

1. Prompt-only rule ("don't poll, tell me what is running and stop"). A prompt-only fallback, untested here, but you have to come back and ask for the result, and commenters report that a rule in AGENTS.md alone gets ignored. 2. Wake the session instead of polling. Codex CLI 0.149.0 (release notes, 20 Aug 2026) added codex queue, which sends a message to an existing session. Its --thread option takes a session UUID or an exact session name, and --message the text. The thread's original command was codex queue --thread <session> --message "<job finished, results in <folder>>". For CLI 0.166.0 or later, this docs-derived adaptation adds --resume to the thread's pattern; it has not been run here:

  • the agent starts the job detached through a small wrapper script that runs the command, saves its exit status and output to a results folder, then runs codex queue --resume --thread <session> --message "<job finished, results in <folder>>" once;
  • the agent tells you what is running and where the results will land, then ends its turn;
  • the queued message arrives as a new turn, the agent reads the saved results once and continues.

Codex sets a CODEX_THREAD_ID variable for commands it launches (the queue_cmd.rs source file I checked does not mention it, so not verified there), which would be a handy way for the wrapper to know which session to wake. 3. A skill that teaches the pattern. The same commenter thread shows people writing a skill for this, because the model knows codex queue but does not reach for it on its own. The post author published theirs; it has no licence file, so it is not packaged here. Write your own and review it before use.

Caveats

  • Only use it for jobs that are safe to continue after the turn ends. Keep interactive, approval-dependent or destructive commands in the foreground, and give the wrapper a timeout.
  • CLI 0.166.0 adds --resume for unloaded threads; already loaded threads stay running, and a failed resumption warns while preserving the successful queue result (OpenAI PR #57232) (checked 2026-11-05).
  • In 0.166.0, thread_unload_delay_secs defaults to 60 seconds instead of 1800; app-server threads become eligible for unloading after one minute with no subscribers and no activity (OpenAI PR #57242).
  • If the queue call fails, the results are still on disk but nothing resumes. Do not add a polling fallback, or you are back where you started. For a remote target, select it with --remote and omit --cd from the queue command. Keep --model out of the wrapper’s queue call; the queued message runs with the target thread’s model.
  • A commenter reports that stock instructions in Codex's base prompt push toward frequent updates and short waits, which is why the AGENTS.md-only approach loses. Check the current Codex docs for any built-in wait settings before building your own wrapper.
  • Whether orchestrator plus sub-agents saves money at all is disputed in the same thread; measure your own usage before and after.

Related: fewer-approval-prompts-without-full-access, ccusage-token-cost-report (to see your own usage).

Sources: r/codex post, Codex CLI 0.149.0 release notes, queue command source.

Primary source

Primary sources: Codex CLI 0.149.0 release notes (OpenAI) and queue_cmd.rs (openai/codex). Checked: the release adds codex queue for sending messages to existing local or remote sessions (released 20 Aug); --thread takes a session UUID or exact session name and --message is required text; the command rejects image attachments. Not verified: CODEX_THREAD_ID, and the Reddit usage figures (one person's measurements).

Started from a post by @concrete333, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I stop Codex burning usage by polling long-running jobs?
Summary: If Codex repeatedly wakes to reread logs while a build or subagent runs, use completion notifications via `codex queue` instead of polling; each repeated wake-up rereads context and uses plan usage.
Copy for agent
get the whatworks thread codex-stop-polling-codex-queue and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread codex-stop-polling-codex-queue
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks