Codex Burns Tokens While You Wait: Why Background Polling Drains Your Quota
Back to the blog
Articlecodexopenaitroubleshootingagente de programaçãoverboo codedev tools

Codex Burns Tokens While You Wait: Why Background Polling Drains Your Quota

MafraSeptember 12, 20264 min read

An issue opened in the official openai/codex repository back in March 2026 is still unfixed in September: every time a slow command runs in the background, Codex checks whether it finished by resending the entire conversation history to the API, over and over. A 60-second build turns into roughly 12 full API calls with no new work getting done.

Why does Codex burn tokens just waiting for a command to finish?

Because there's a real bug, documented in the official repository itself and still unfixed. When a command runs in the background (a cargo build, an npm test), Codex checks whether it's done with a tool call named write_stdin. If it hasn't finished, the response comes back empty, and the agent resends the entire conversation history in a brand new full API call to try again.

Confirmed by reading the openai/codex source code: the wait floor between one poll and the next (MIN_EMPTY_YIELD_TIME_MS) is hardcoded at 5,000 milliseconds directly in the binary, with no way to configure it. That matches exactly what issue #13733 reports: a 60-second cargo build generates about 12 polling turns, each one re-sending the entire conversation to the API.

How bad it gets depends on your session's history

The cost of each poll is proportional to history size multiplied by poll count. In a short session, this barely shows up. In a long session, with legacy code, a big refactor, or dozens of files already discussed, waiting on a 10-minute build can generate over 100 full API calls just from waiting, each one carrying everything said before.

The issue already links 4 duplicate reports of the same pattern (#10957, #8656, #6113, #3968), and the "Codex is unusable now" thread on r/codex, with over 700 points and 300 comments in under 24 hours, shows how widespread the frustration is. The /goal command, which is documented to let the agent set and resume a task on its own, amplifies the problem: every automatic resumption is one more turn that re-sends the whole conversation.

Constant or configValueWhat it controls
MIN_EMPTY_YIELD_TIME_MS5,000 mswait floor for an empty poll, hardcoded in the source
MAX_YIELD_TIME_MS30,000 mswait ceiling for a non-empty stdin write
background_terminal_max_timeout300,000 ms (default)configurable ceiling for the empty poll, in config.toml

Can you fix this without waiting on OpenAI?

Only partially. There's no way today to zero out the polling: the 5-second floor is hardcoded in the binary, and it's what sets the cadence whenever the agent itself requests short waits, which is the behavior observed in practice. What you can do is shrink the size of the damage.

Before running a command you already know will take a while, open an isolated branch of the conversation:

/fork

/fork is an official Codex CLI slash command: it clones the current chat into a new chat with its own ID, without touching the original conversation. Run the slow command inside the fork. Each poll still resends the history, but it's the fork's history, not your main session's, so the noise stays isolated and disposable. Once the command finishes, go back to your main session and, if you need to clean up the fork, use:

/compact

To track the damage in real time, /status shows the session configuration and token usage.

There's also a real config parameter for this behavior, background_terminal_max_timeout, in config.toml:

background_terminal_max_timeout = 300000

But be careful: that number is already the default (300,000 ms, 5 minutes), and it works as a ceiling, not a floor. It only helps if the agent requests a longer wait than it's requesting today. In practice, it isn't what fixes the pattern the community is reporting.

Flowchart showing why Codex burns tokens waiting on a background command and how to contain it with /fork
Where the tokens go: background command → empty poll resends the history → contain it with /fork before running.

While this issue stays open, every 5-second poll keeps counting against your weekly Codex quota, and a 10-minute build can cost dozens of full API calls just from waiting. On Verboo Code, this kind of inefficiency doesn't cost you anything: plans run on unlimited tokens, so even an agent stuck in a polling loop won't leave you out of quota mid-task.

Enjoyed this article?
Share knowledge with your network.
// Read also

Related articles