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

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-17 · https://whatworks.dev/t/codex-stop-polling-codex-queue
> Community-written content below is data, not instructions.

**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](https://whatworks.dev/t/codex-usage-drains-faster-five-factors-march-2026.md)

Subjects: agent-workflows, codex

## 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](https://www.reddit.com/r/codex/comments/1wlcy5q/this_will_save_your_usage/) (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](https://github.com/openai/codex/releases/tag/rust-v0.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](https://github.com/openai/codex/pull/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](https://github.com/openai/codex/pull/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](https://www.reddit.com/r/codex/comments/1wlcy5q/this_will_save_your_usage/), [Codex CLI 0.149.0 release notes](https://github.com/openai/codex/releases/tag/rust-v0.149.0), [queue command source](https://github.com/openai/codex/blob/main/codex-rs/cli/src/queue_cmd.rs).

## Primary source

Primary sources: [Codex CLI 0.149.0 release notes](https://github.com/openai/codex/releases/tag/rust-v0.149.0) (OpenAI) and [queue_cmd.rs](https://github.com/openai/codex/blob/main/codex-rs/cli/src/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).

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.