Abnormal Quota Drain in AI Coding: A Context-Compression Troubleshooting Guide
Quota can drop faster in agentic coding even when tasks look similar. This guide separates context length, request usage, cache hit rate, and account quota; explains how auto-compression and multi-agent work add cost; and shows how to use request-level logs and controlled experiments before calling it a defect.
Faster quota drop is not proof of a defect
In AI-assisted coding, developers sometimes see available quota fall much faster even when the work looks similar: similar requirements, similar files, similar interaction. Tasks that used to last a long time now hit limits quickly.
Feedback of this kind includes tasks that once used about 20% of quota now using about 50% on comparable work, and a main agent plus three sub-agents triggering 72 context compressions in one day (17, 21, 17, and 17).
That is worth investigating, not treating as a confirmed implementation bug. The numbers come from usage reports, not controlled experiments. Quota percentages do not necessarily map 1:1 to token counts. Perceived task size can differ from the number of requests the system actually runs.
An agentic coding system does more than consume user input. It may read files, call tools, analyze results, schedule subtasks, write summaries, and retry failed steps. The same “fix this issue” action can generate very different request volume underneath.
Investigate in this order: reconstruct actual compute, then metering rules, then whether behavior is abnormal.
Four kinds of “consumption” that are not the same
A common mistake is to mix context length, request usage, cache ratio, and account quota.
1. Context length
Context is the information sent with a request: system instructions, history, code, tool results, and task state. Length is how much that request carries, not how much quota it deducts. The same input size can cost differently depending on cache state, model, and billing.
2. Request-level usage
A request typically exposes input tokens, output tokens, and other usage fields the service documents. Some systems split cached vs. uncached input. Use logs and published definitions. Do not invent metrics the UI does not provide, and do not assume every provider counts the same way.
3. Cache hit ratio
A cache hit usually means some of the request reused prior computation. With prefix caching, hits depend on prefix stability, TTL, and implementation.
A high hit ratio does not guarantee low total cost. If request size grows a lot, uncached input and new output can still dominate even when the hit percentage stays high.
4. Account quota
Quota may be constrained by time windows, request class, compute, or other rules—not a simple token wallet at a fixed price.
“Quota went from 20% to 50%” only means the visible remaining quota fell faster. It does not prove token use grew 2.5×. Confirm the denominator, window, and metering first.
Why automatic compression can add cost
Compression turns long history into a shorter task summary so later requests can continue. It is not lossless, and it is not free.
A typical flow: history grows → near a context threshold → generate a summary → replace part of the history → continue with the summary.
There are at least three cost paths.
1. Summarization itself uses compute
If a model call produces the summary, the system may read history and generate text. Whether that counts against the user depends on the service’s rules.
Frequent compression can accumulate large history-read cost even if each summary is short. Parallel agents that each keep long context multiply compression count.
2. A lot of content may remain after compression
In the original reports, context was about 240k–250k tokens before compression and about 140k–160k after. If those numbers share the same definition:
retention ratio = post-compression length ÷ pre-compression length.
That range is about 56%–67% retained, or about 33%–44% space freed.
Compression reduced context, but remaining input is still large. That does not prove compression failed, and it does not support “almost no space was freed.” Check whether lengths are from the same request stage, whether they include system prompts and tool results, and whether large content was appended immediately after.
3. Compression can change the prefix caching depends on
If caching needs a stable prefix, replacing history can change that prefix and drop reuse. That is not inevitable: some stacks keep a stable instruction region or organize context differently.
The same material mentions both “high cache hit ratio” and “old cache no longer hits after compression.” Do not merge those without time range and denominator. They may be different requests, or a first-request dip after compression that later recovers.
Record cache volume per request. Do not infer all behavior from one aggregate percentage.
Multi-agent setups amplify hidden duplicate work
A main agent plus sub-agents can finish complex work faster; parallel does not mean cheaper.
If several agents carry similar project background, read the same files, analyze the same logs, and each write long summaries, you get duplicate input and duplicate inference.
For “72 compressions in a day,” the useful questions are not “is that number automatically a bug?” but:
- How many normal requests did each agent run?
- How much new context appeared between compressions?
- Did sub-agents carry full history they did not need?
- Was the same tool result reread on multiple branches?
- After a sub-agent returned, did the parent keep growing the same context?
A diagnostic: compression frequency = compression count ÷ normal task request count.
72 alone does not tell severity. Many long-running requests vs. a few short ones mean different things. Do not invent an unvalidated “abnormal” threshold.
When it looks more like an implementation defect
High spend and a program bug need a verifiable chain of evidence. These patterns deserve a closer look.
1. Summary and original history both in the request
If the summary already holds key conclusions but the request still ships the history it was meant to replace, you may be carrying duplicates. Some systems intentionally keep recent turns or critical tool results. Check the retention policy; do not demand every original token be deleted.
2. Compression state not persisted
If logs show compression finished but the next request is built from pre-compression history, look at failed state updates, session restore errors, or concurrent overwrites. Compare state versions, request construction, and restore paths before vs. after compression.
3. Retries causing duplicate execution
A client timeout does not mean the server never ran the request. Blind client retries can produce multiple real calls. Log request IDs, retry reason, and outcomes. Multiple successful requests for the same business step is closer to duplicate execution than “the UI showed one click.”
4. Concurrent branches retriggering compression
If several branches update context and compression has no coordination, similar compressions may run more than once. Each agent compressing its own session can still be normal. Distinguish “separate sessions compress independently” from “the same state is compressed repeatedly.”
Request-level observability beats guessing
To locate spend, persist at least the following. Field names should match your design; they are not a fixed vendor API.
| Category | What to record | Why |
|---|---|---|
| Identity | Request ID, session ID, agent role | Tie the execution chain |
| I/O | Input tokens, output tokens | See compute change |
| Cache | Cached input volume and its definition | See reuse change |
| Compression | Trigger time, before/after length, latency | Judge compression effect |
| Tools | Result length, truncation, duplicated content | Find context bloat |
| Retries | Count, reason, link to original request | Spot duplicate calls |
| Environment | Config version, task snapshot, time window | Keep comparisons fair |
Respect privacy: do not upload code, credentials, or business data indiscriminately. Prefer lengths, summaries, or redacted IDs when that is enough.
The original material listed “input of the next request after three consecutive compressions” without full numbers, so you cannot verify whether context immediately returned to the trigger threshold. Fill that evidence instead of substituting speculation.
Controlled experiments to isolate variables
Use the same code snapshot, same task brief, and same done criteria. Keep model, tool permissions, and runtime as constant as possible.
Compare, one major variable at a time:
- Single agent vs. multi-agent
- One long continuous session vs. rebuilding the session by stage
- Full tool output vs. only necessary excerpts
- Default compression vs. any compression settings the system allows you to change
Always record task quality. Lower spend that misses files, drops constraints, or skips verification is not an optimization.
If multi-agent spend jumps, check duplicated background and overlapping work first. If trimming tool output cuts compression count, context bloat is a likely driver. If cache dips on the first post-compression request then recovers, input structure is a likely cause. If identical conditions produce duplicate requests, look at retries and state management.
Cut low-value context at the source
Do not only tune compression thresholds. Reduce what enters context.
Keep a short task state: project constraints, current goal, done items, open problems. Stop carrying exploration that no longer matters.
Bound tool returns: read relevant file regions; filter logs by time and error location before pulling more. Do not cut so hard that you lose dependencies and cause rework.
Give sub-agents a narrow brief: only the background they need; return conclusions, evidence, and open questions—not a copy of the full run.
Give compression observable acceptance criteria: length down, key constraints kept, a reasonable interval before the next compression, and later requests not re-injecting large deleted blocks.
Conclusion: explain abnormal spend with a request chain
Faster quota drop in agentic coding can come from growing context, compression calls, cache changes, multi-agent duplication, retries, or metering changes—often together.
Existing feedback justifies investigation. It does not by itself prove a defect in compression. Without consecutive request data, cache field definitions, and complete compression records, do not blame the compressor for all extra spend.
Reliable order of work: confirm how quota is defined, build request-level logs, inspect state before and after compression, isolate sources with controlled experiments, then choose context hygiene, task split, cache-friendly structure, or a real bugfix. Convert “it feels like it burns faster” into reproducible, attributable execution evidence.
