Skip to content

[Bug][Desktop][Subagents] One task processed 242.3M tokens and consumed 11 percentage points of weekly quota in 2h44m #46023

Open

Description

@scottconverse

Suggested GitHub issue title

[Bug][Desktop][Subagents] One task processed 242.3M tokens and consumed 11 percentage points of weekly quota in 2h44m

Summary

During one Codex Desktop coding task on September 16, 2026, Codex processed 242,318,802 telemetry-reported tokens across 1,545 model responses in 2 hours, 43 minutes, and 45 seconds.

The account's weekly usage meter rose from approximately 50% used to 61% used during the incident. That is an observed increase of 11 percentage points, not a claim that raw telemetry tokens map one-to-one to quota accounting.

Most of the volume was repeated cached-context processing:

Metric Value
Model responses 1,545
Input tokens 241,805,518
Cached input tokens 237,203,328
Uncached input tokens 4,602,190
Output tokens 513,284
Reasoning output tokens 151,891
Total tokens 242,318,802
Cached share of all input 98.1%
Average input per response 156,508
Observed weekly usage movement +11 percentage points

Using a rough effective-usage weighting of cached input at 0.1x, uncached input at 1x, and output at 5x, the incident represents approximately 30,888,943 weighted tokens. Reasoning output is already included in output and was not added again.

This was not a productive quarter-billion-token workload. It was a context-amplification and orchestration failure. A large inherited conversation was replayed across hundreds of small model turns, while a reviewer and implementation agents were reactivated in a serial loop. Codex had no task-wide budget, no useful warning, and no automatic stop even as the weekly allowance visibly fell.

This appears related to, and may share a root cause with:

This report adds a bounded, single-task reproduction in Codex Desktop and identifies a particularly expensive multi-agent failure mode: repeated follow-up turns on long-lived agents, a reviewer that reports issues one at a time, and task accounting that does not naturally aggregate reused agents across root-turn ownership boundaries.

Impact

The failure consumed roughly one tenth of the account's weekly allowance in under three hours. The user received no warning that the task had entered a pathological usage pattern. The work was not released or deployed, and the outcome was not remotely proportional to the quota consumed.

This makes autonomous coding unsafe to leave running even when the user gives a bounded implementation request. A user cannot reasonably infer from ordinary progress messages that small tool operations and review follow-ups are repeatedly processing about 150,000 input tokens each.

Severity: High — quota exhaustion, cost visibility, and product reliability.

Environment

  • Product: Codex Desktop on Windows
  • Shell: PowerShell
  • Account plan reported by the usage API: Pro
  • Root coordinator: gpt-5.6-sol, high reasoning
  • Additional OpenAI subagents used for implementation, review, OCR analysis, acceptance review, and one installer repair
  • Workload: a large TypeScript application with a long existing Codex conversation, screenshots, attachments, tool schemas, prior implementation history, and multiple requested checks
  • No local LLM was invoked during this incident

Incident window

  • Start: 2026-09-16T17:51:35.032Z
  • End: 2026-09-16T20:35:19.645Z
  • Duration: 02:43:44.613

Per-agent breakdown

The labels below describe roles and intentionally omit local thread identifiers.

Role Responses Input Cached input Uncached input Output Total
Coordinator 367 54,975,601 54,374,016 601,585 77,039 55,052,640
Independent reviewer 571 95,228,055 93,178,880 2,049,175 150,662 95,378,717
Routing/UI implementation agent 404 60,153,394 59,288,832 864,562 165,121 60,318,515
OCR/large-packet analysis agent 181 28,184,695 27,341,824 842,871 95,121 28,279,816
Acceptance/wiring reviewer 15 2,713,831 2,486,016 227,815 19,590 2,733,421
Installer repair agent 7 549,942 533,760 16,182 5,751 555,693
Total 1,545 241,805,518 237,203,328 4,602,190 513,284 242,318,802

The independent reviewer alone generated 571 model responses and 95.4 million total tokens. The coordinator and primary implementation agent added another 771 responses and 115.4 million total tokens.

What happened

  1. The task began inside a very long Codex Desktop conversation containing extensive prior history, screenshots, pasted documents, system/tool descriptions, and previous work summaries.
  2. Multiple subagents were started with too much inherited context. They did not receive compact, purpose-built briefs.
  3. The implementation and review work was split across long-lived agents.
  4. Review became an open-ended serial loop: the reviewer returned one issue; the coordinator sent a follow-up to an implementation agent; the reviewer resumed and found another issue; the cycle repeated.
  5. Hundreds of small model turns each carried a very large cached-input component. Average input was about 156,500 tokens per response.
  6. Waits, status checks, tool results, and follow-up dispatches created additional response boundaries carrying the same large context.
  7. Live quota readings were checked and visibly moved through approximately 50%, 51%, 52%, 53%, 57%, 58%, 59%, 60%, and 61% used. Codex continued because there was no task budget or circuit breaker.
  8. A standing worker-routing rule treated 10% remaining quota as the threshold for changing execution providers. Codex effectively treated that as permission to keep spending until the account approached exhaustion. That was a bad orchestration decision, but the product provided no guardrail against it.

The user's request for independent review did not require a reviewer to stay in an unbounded issue-by-issue loop. One bounded review pass, a consolidated defect list, one repair pass, and one final verification would have satisfied it. Codex failed to choose that shape.

Why this is a product failure as well as an agent judgment failure

The model made poor orchestration decisions. That should be stated plainly. It spawned too much work, passed too much history, failed to consolidate review findings, and continued after the burn rate was obvious.

The product still needs to prevent this class of failure. Codex is sold for autonomous, tool-using development. A user cannot inspect every hidden response boundary, cached-context replay, or subagent reactivation while a task runs. The application knew the context size, response count, descendant-agent structure, and usage-meter trajectory, but it did not warn or stop.

There was no:

  • task-wide token, response, or quota budget;
  • live aggregate covering the coordinator and every descendant agent;
  • projection such as “this task has used about 8% of your weekly allowance”;
  • warning that hundreds of responses were repeatedly carrying more than 100,000 cached tokens;
  • cap on reviewer/implementer follow-up cycles;
  • compact-context default for new subagents;
  • automatic checkpoint and stop when usage became disproportionate to progress;
  • requirement for a reviewer to consolidate findings before another implementation pass.

Accounting method

The totals were produced from local Codex rollout telemetry using a read-only scan:

  1. Select the incident UTC window.
  2. Include the root Codex thread and all descendant/reused subagent threads involved in the task.
  3. Read per-response token_usage_record values.
  4. Deduplicate globally by (thread_id, response_id).
  5. Sum input_tokens, cached_input_tokens, output_tokens, and total_tokens.
  6. Compute uncached input as input_tokens - cached_input_tokens.
  7. Do not add reasoning_output_tokens to output because it is a subset of output.

One important observability defect surfaced here: an ordinary root-turn report can omit usage from a reused subagent when later follow-ups remain attributed to that agent's original root_turn_id. A correct task-wide report required scanning across root-turn boundaries and deduplicating all participating threads. The product should do this automatically.

Raw logs are not attached because they contain private prompts, file paths, screenshots, and tool output. A redacted aggregate is available, and a sanitized analysis script/output can be provided privately to maintainers.

Reproduction pattern

This is a workload-shape reproduction rather than a minimal deterministic test:

  1. Start a long-running Codex Desktop conversation with a large inherited context.
  2. Ask for a substantial implementation and independent review.
  3. Spawn several subagents using default/full inherited history rather than compact task briefs.
  4. Keep the same agents alive through many followup_task cycles.
  5. Let a reviewer return findings serially instead of in one consolidated pass.
  6. Run tool-heavy work with many small shell, test, wait, and status boundaries.
  7. Inspect per-response token_usage_record data after context exceeds 100,000 tokens.
  8. Observe hundreds of responses with roughly 100,000–200,000 mostly cached input tokens and comparatively tiny outputs.
  9. Observe the account usage meter fall without a task-level warning or stop.

Expected behavior

  • A task should expose one live usage total that includes the coordinator and all descendant or reused agents.
  • Subagents should default to a compact, purpose-built brief. Full conversation inheritance should be explicit and visibly priced.
  • Users should be able to set a maximum task budget by weekly-quota percentage, weighted tokens, model responses, and wall time.
  • Codex should pause and request confirmation at the budget boundary while preserving task state.
  • The UI should warn when a task enters a pathological pattern, such as many consecutive responses with more than 100,000 cached input tokens and less than 1,000 output tokens.
  • Pure wait/poll operations should avoid a fresh model inference where the architecture permits.
  • Review agents should return a consolidated report by default. Repeated reviewer/implementer cycles should have a small default cap.
  • Usage reporting should distinguish cached input, uncached input, output, and estimated quota impact.
  • Automatic compaction or checkpoint/handoff should occur before the context becomes expensive enough to consume a material part of the weekly allowance.

Actual behavior

  • One bounded task produced 1,545 model responses in under three hours.
  • The task processed 242.3 million tokens, 237.2 million of them cached input.
  • Average input was about 156,500 tokens per response.
  • The account's weekly usage meter rose by 11 percentage points during the incident.
  • No task-wide warning, limit, approval boundary, or automatic stop occurred.
  • The default reporting path did not naturally show all usage from reused agents across root-turn boundaries.
  • Work continued even after repeated usage checks demonstrated rapid quota loss.

Requested fixes / acceptance criteria

  1. Task-wide accounting: The displayed total includes the root task, all descendants, and later follow-ups to reused agents, regardless of root_turn_id ownership.
  2. User-set hard budgets: A user can cap weekly-quota percentage, effective tokens, responses, and wall time for a task.
  3. Automatic circuit breaker: Codex pauses before exceeding that budget and preserves a resumable checkpoint.
  4. Safe context defaults: Subagents receive a compact task brief by default; full-history inheritance requires explicit selection.
  5. Pathology warning: Codex detects repeated high-context/low-output turns and warns before material quota loss.
  6. Low-cost waiting: Deterministic waits and status polling do not require repeated full-context model calls.
  7. Bounded review loops: Independent review is consolidated, with a visible and configurable pass limit.
  8. Clear live telemetry: The UI shows cached input, uncached input, output, descendant-agent usage, current task share of weekly usage, and projected remaining cost.
  9. Cross-turn correctness: Usage remains attributable to the active user task even when a long-lived subagent is reactivated from a later root turn.
  10. Regression test: A multi-agent tool-heavy test with a large starting context must stop or warn before a configured task budget is exceeded.

Final note

I am not alleging that cached input was billed as uncached input or that raw local token totals map directly to subscription accounting. The account meter and local telemetry are different measurements. The concrete failure is that Codex generated an enormous volume of repeated context processing, the weekly meter moved sharply during the same bounded incident, and the product offered no practical way to see, budget, or stop it before the damage was done.

Activity

  1. added
    bug
    app
    windows-os
    subagent
    rate-limits
    context
    model-behavior
    on Sep 16, 2026
  2. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. liuchwenyu commented on Oct 6, 2026

    @liuchwenyu

    I think I hit the same general failure mode in a different multi-agent run. The numbers were weirdly close to yours.
    From the local rollout logs I got roughly:

    • 3,945 inference events
    • 584M input tokens
    • 97.6% cached input
    • 1.7M output tokens
    • about 148K input tokens per inference event

    I don't know if my "inference event" maps 1:1 to the "model response" metric in this issue, so I wouldn't call this an exact repro. Still, 148K vs. 156.5K caught my attention.
    The run had several long-lived subagents doing repo-wide audit, closure, verification, and reverse-check work. They would find another thing to check, read a very large shared context again, do a relatively small amount of work, then move on to the next check.
    Nothing was obviously stuck. The agents were doing real work, but the token usage kept growing much faster than the actual progress.
    The 97.6% cached input number is probably the most useful part of my case. It looked reassuring at first, but in practice it meant that roughly the same huge context was being processed over and over again.
    If useful, I can clean up the per-agent rollout stats and post a breakdown.

  4. Xayah15 commented on Oct 21, 2026

    @Xayah15

    Same Issue. This process will generate a huge amount of repeated context processing and multiple unexpected model calls. Codex indeed does not provide as intuitive a viewing method as DSH desktop, and I am currently hoping to solve this problem through Codex trace. Do you have a better approach?

  5. mmoemou commented on Oct 21, 2026

    @mmoemou

    One independent measurement-design suggestion for this report: please expose a single root-task accounting export alongside the existing per-agent/event counters.

    Why it matters: local Codex token_count events are cumulative; unchanged counter re-emissions and inherited parent history in nested subagents must not be added as new billable/processed tokens. ccusage/ccusage#1435 documents a production fix for replayed histories. At the same time, processed input tokens, cached input tokens, actual subscription allowance debits, and accepted work are four different denominators. A very large processed-token count can be legitimate due to repeatedly cached context without being an equivalent purchase-price amount.

    For a deterministic synthetic test, root A ends at 1,500 total reported tokens. Child B replays a 1,500-token parent prefix, then uses 250 genuinely new tokens. The task-level unique model-event total should be 1,750 (assuming no other work), not the naive 3,250 obtained by adding both files. If the parent is unavailable, the number should carry a lineage-uncertainty flag.

    Could the application export, per root task: stable child/fork ancestry and request IDs, deduplicated input/cached_input/output, observed 5-hour and weekly quota debits, model/effort, and persisted checkpoints? A user-configured hard allowance cap should then evaluate the shared root+descendant total before further requests.

    I posted a fuller privacy-preserving measurement proposal in the related per-task spending thread: #46390 (comment) .

    No private logs or project details are shared. This is a user-facing instrumentation proposal, not a claim that the incident's reported counts are wrong.

  6. liuchwenyu commented on Oct 21, 2026

    @liuchwenyu

    @mmoemou I agree that replayed usage records need to be filtered out. I'm not treating the token numbers I posted as a billing statement, and I'm open to checking the accounting.

    What bothered me in that run was the behavior itself. Codex wasn't exactly stuck. The agents were doing real work, but it kept turning into “one more check,” then another review, then something else to verify. Everything looked busy, but the task didn't seem to get much closer to being finished.

    That's the part I don't want to lose in the accounting discussion. A duplicated usage record is one thing. Actual additional requests carrying a large, mostly unchanged context are another. I'm not saying cached input was fully recomputed every time. I'm asking how many of those requests needed to happen at all.

    I wonder how much of this comes down to the model's decisions, how Codex manages the agents and their context, or some combination of both. Could the coordinator keep a clearer record of what's already been checked, what changed, and what the next pass is supposed to establish? Could a subagent work from a smaller, relevant brief instead of carrying so much history into another narrow check?

    I still want independent review and proper testing. I just don't want “be thorough” to turn into an endless search for one more thing to inspect.

    And @Xayah15, this is where I agree with your point about the interface. I don't want to read JSONL or babysit every tool call just to figure out whether the task is going anywhere. I'd like to see which agents are doing what, why another pass is happening, and how much usage has accumulated since the last meaningful result.

    I've been thinking about a watchdog that pauses the task after a few expensive review/fix cycles with little progress. Maybe three rounds as a starting point, not three model calls or three cache hits. It would need to cover the subagents too, preserve the work, and let me decide whether to stop or change direction. But telling useful verification apart from pointless repetition seems like the difficult part.

    Ideally, the monitoring wouldn't become yet another agent repeatedly reading the same huge history.

    Has anyone tried something along these lines? I'd be interested in what actually helped the agents finish, and what information would have made it easier to intervene before the run got out of hand.

  7. mmoemou commented on Oct 21, 2026

    @mmoemou

    @liuchwenyu This is an important distinction, and I agree with your correction: a duplicated telemetry record is not the same as a genuinely new, unnecessary model request. Fixing accounting alone would not solve the coordination failure. Thanks for the concrete proposal.

    I'd separate two controls:

    1. Passive root-task accounting (no new monitoring agent). Record only metadata from existing events: unique model response/request ID, parent/child lineage, model+effort, cached/uncached input, output, tool/review phase, and a user-defined accepted outcome or evidence change. Remove replayed history when aggregating logs, but retain every distinct model request, however similar its cached context. Track subscription quota changes separately, not as token invoices.

    2. An evidence-aware progress watchdog. At task start, lock a short completion contract: requested deliverables, acceptance gates and known evidence/checkpoints. After each review/fix round (not each model call), record: (a) what new fact/test/defect changed; (b) which acceptance gate it advances; (c) how many genuinely new requests and cumulative budget units were consumed. If three consecutive costly rounds advance no gate and add no meaningful evidence, pause with a resumable checkpoint and ask the user. Three rounds is a configurable illustrative threshold, not a universal limit or claim that three reviews are always enough.

    Important safeguards: an independent safety-critical regression test counts as progress even if it finds no defect; a repeated scan with no changed inputs should not be called progress; explicit owner authorization may permit another round; a hard shared root+subagent usage limit must be enforced separately by the runtime before additional requests (see #55180), because a heuristic watchdog cannot guarantee budget enforcement.

    Possible lightweight dashboard: task/gate | last new evidence | review rounds without progress | unique requests since evidence | cumulative root+children usage | quota snapshot confidence | next authorized action. This should be compiled from event metadata, not by asking another expensive model to repeatedly reread transcripts.

    @Xayah15 Your UI question fits this: the useful view is why the next pass is needed and whether it brings the task closer to an accepted deliverable, not just a giant token number.

    If you can share synthetic, nonproprietary examples of one productive review cycle versus one repetitive cycle, I'd be interested in defining a false-positive-resistant pause rule. No code, private logs, repository IDs, or raw prompts are needed.

  8. waewoo commented on Nov 21, 2026

    @waewoo

    I encountered a very similar cached-context amplification pattern on 2026-11-21, this time with Codex CLI on Linux (gpt-6.1-terra). I analyzed local rollout logs and cross-checked deduplicated totals against ccusage.

    Observed impact

    • Incident window: 11:37:11–12:16:46 Europe/Paris (39m 35s).
    • Reported 5-hour quota usage: 0% → 100%; weekly quota usage: 0% → 16% within the observed window.
    • 1 root session + 11 direct subagents (11 spawn_agent calls).
    • 86,460,151 deduplicated tokens: 85,515,520 cached input (98.9% of total); 816,783 uncached input; 127,848 output.
    • Root: 40.74M cached tokens; 11 children: 44.78M. Two largest children: 12.32M and 11.30M cached tokens.

    Model/tool activity

    • 665 unique token-usage events after discarding 848 replayed prefix events across 12 rollout files. These events should not automatically be equated with distinct API requests.
    • Cached input per unique usage event: median 131,456, P90 195,072, P95 198,272, max 208,896.
    • Deduplicated tool calls: 416 exec, 96 send_message, 51 wait_agent, 19 followup_task, 11 spawn_agent, 2 list_agents.
    • The 416 exec outputs total only ~1.6 MiB, averaging ~3.93 KiB, maximum ~40.9 KiB (none above 100 KiB). This is many small tool steps rather than a handful of giant outputs.
    • No compaction events observed.

    Accounting caveats

    Naively adding all 12 local session files overcounts usage: forked subagent files replay parent history. Removing identical inherited prefixes produced exactly the ccusage totals above. This is a local telemetry aggregation pitfall, not evidence that the service charged for replayed records.

    At hypothetical Terra credit rates of 25 / 1.25 / 125 credits per 1M uncached-input / cached-input / output tokens, the deduplicated workload would be ~143.3 theoretical credits with discounted cache vs ~2,174.3 with cache at the full input rate. Neither figure is an observed ChatGPT subscription allowance debit. The normalized shape of quota usage fits the discounted-cache scenario better, but cannot establish the absolute server-side conversion. I am not claiming incorrect cache accounting.

    Why this seems related

    The notable pattern is hundreds of usage events rereading ~100K–200K cached tokens, with 11 child agents and many small tool/coordination steps, while the 5-hour meter was exhausted in under 40 minutes. The aggregate data alone cannot establish whether the work was redundant or whether this is Terra-specific.

    Could maintainers clarify whether this level of multi-agent context amplification is expected, and whether Codex could (1) expose deduplicated root+descendant consumption alongside actual quota impact, (2) warn or pause on unusually high task-wide burn rates, and (3) prefer compact task-specific subagent contexts?

    Only sanitized aggregate metrics are shared: no raw logs, prompts, source code, internal paths, or session IDs.

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

    appbugcontextmodel-behaviorrate-limitssubagentwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions