Why Auto-Compression Can Inflate Long-Session LLM Usage

    Long coding sessions sometimes burn far more quota than wall-clock time suggests. This article explains how context compression, prefix-cache misses, repeated tool output, and retries can stack, and how to tell expected cost from a real bug.

    In long-running AI coding tasks, one of the most confusing issues is quota that looks like hours of work after only a few minutes of actual interaction. When a session keeps accumulating code, logs, tool results, and chat history, billed usage often diverges from human operating time.

    A typical report after 10 November 2026 described a high-intensity task of about 7 minutes 33 seconds that nearly exhausted a full 5-hour usage window. The first instinct is a bug or duplicate backend calls. From the model serving path and context-management design, the pattern is more often several mechanisms compounding rather than a single extra request.

    Separate three metrics: wall time, request count, and billed tokens

    Quota anomalies are easier to diagnose if three mixed-up numbers stay distinct.

    First is perceived task duration: from start until the UI shows completion, often only minutes.

    Second is model request count. One user-facing task can include many rounds of planning, search, file reads, command execution, validation, and repair. The UI shows one job; the backend may issue tens or hundreds of model calls.

    Third is the size of input and output actually processed. Each request may carry system instructions, tool schemas, history, code snippets, command output, and earlier intermediate conclusions. A short reply of a few hundred tokens can still sit on hundreds of thousands of input tokens.

    Minutes of runtime therefore do not imply low cost. What matters is cumulative tokens across requests, and whether those tokens hit prefix cache.

    Auto-compression near the context limit

    Long sessions have a context-window cap. If a model or session type allows about 272,000 tokens, compression may start near 90% of that, around 244,800 tokens, by summarizing earlier chat, tool results, and intermediate steps so later requests still fit. At a higher threshold, platforms often force compression so the request does not exceed a hard limit.

    The mechanism is necessary: without it, long tasks fail at the window. The side effect is that original context is rewritten.

    Model config, session type, and runtime can change capacity. Similar-looking tasks may compress at different thresholds. Do not infer window size from the task name, and do not assume every session shares the same limit.

    The overlooked cost: compression can break prefix cache

    Modern model APIs cache repeated request prefixes. A prefix typically includes:

    • system instructions
    • tool descriptions and parameter schemas
    • project-level rules
    • early conversation
    • already-read file contents
    • stable task background

    If the next request starts identically, the service can reuse the processed prefix and cut compute and billed cost.

    Auto-compression changes early history. Full turns become summaries; tool traces become shorter descriptions. Semantically similar text is byte-different. If the cached prefix changes, the cache key misses.

    The first post-compression request may then reprocess a large history. If more than 200,000 tokens previously hit cache and then miss, they may be billed as ordinary input. Cached and uncached input often have a large price gap, so one compression can cost more than expected.

    That is why “compression saves context but raises cost” is not a contradiction. Later requests carry fewer tokens, but a large reusable prefix may lose cache eligibility. Token savings may not offset the cache miss.

    Repeated compression amplifies the effect

    Compression is rarely one-shot. New dialogue, code, and tool output accumulate until the window is near the limit again. Each pass can emit a new summary and a new prefix.

    A simplified loop:

    1. The session grows.
    2. A warning threshold triggers the first compression.
    3. The compressed request no longer fully hits the old cache.
    4. Work continues and new content is appended.
    5. Context approaches the limit again.
    6. A second compression runs.
    7. The new summary changes the prefix and cache is affected again.

    If the job is long and every tool call resends full history, the pattern can repeat. The user sees one continuous task; the backend processes multiple near-full-window requests.

    This is more likely when:

    • the project is large and many files load up front
    • tools emit long logs, tests, or build records
    • the task needs many edit–run–regress cycles
    • history contains lots of repeated error text
    • every request reattaches full tool definitions
    • summaries are unstable, so the model keeps asking for old details

    Hidden duplication from tool results

    Many coding agents are not single Q&A. They loop: plan, read files, analyze, run commands, patch, retest, re-localize failures.

    Tool output may re-enter context many times. A long build log needed once can be resent every round if there is no incremental handling. Unchanged logs still consume input tokens.

    Some outputs should not go into context in full, for example:

    • complete directory trees
    • large diffs
    • full test logs
    • database query dumps
    • repeated compiler warnings
    • long generated files

    Without paging, summarization, truncation, or reference-style loading, tool output becomes the main source of context bloat. Short model answers can still ride rapidly growing inputs.

    Retries and background checks multiply spend

    Quota spikes should also be checked for retries.

    Timeouts, tool failures, invalid response formats, server rate limits, or a client that never received a response can auto-retry. The user may still see one task.

    If a retry resends full context, one failure is another large input. Worse, the model may have already produced a partial result; the system cannot confirm state and restarts from an earlier stage, duplicating work.

    Before and after “completion,” extra checks may run, such as:

    • whether files were written
    • whether tests passed
    • whether tool-call format was followed
    • whether more repair is needed
    • safety or consistency review of the patch

    These steps may be invisible and still generate model calls. One UI task is not one inference.

    Is it a product bug?

    Technically, the answer is not a simple yes or no.

    If the platform records input tokens, cache hits, output tokens, and retries, and those numbers explain the quota, the more likely story is pricing plus context management.

    Closer to an implementation defect:

    • compression fires well below the context threshold
    • identical unchanged requests miss cache
    • a single failure is submitted many times
    • usage UI diverges clearly from request logs
    • model calls continue after the task ends
    • summaries grow without bound and exceed the original text
    • the same tool output is retransmitted with no reason

    The question is not whether spend is high, but whether spend matches observable request behavior. Only an unrolled call path can separate expected cost, design flaws, and metering errors.

    How users can investigate

    Collect evidence in this order.

    1. Record context size per request

    Watch for sudden growth near the window limit, and for large input-size changes around compression.

    2. Split ordinary input from cached input

    If usage detail is available, watch cache hit rate. After compression, a drop in cached input and a matching rise in ordinary input supports a prefix-invalidation hypothesis.

    3. Count tool calls and retries

    Do not count tasks only. Log file reads, command runs, tests, and failure retries. Heavy duplication inside one task makes fast quota burn unsurprising.

    4. Inspect long logs and large files

    Truncate, page, or summarize build logs, test results, and large diffs so every round does not carry the full payload.

    5. Compare short sessions with one long session

    Split the same work into stages and compare cost. If splitting is much cheaper, long-context maintenance and repeated compression are likely the main drivers.

    Engineering mitigations

    Platform and tool authors can reduce this class of anomaly.

    Keep cache keys aligned with compression. Do not rewrite the entire prefix every time. Keep system instructions, tool schemas, and stable project rules fixed; confine change to the dynamic history region.

    Use incremental context. For files and logs already processed and unchanged, prefer content references, summary indexes, or segmented cache instead of full retransmission.

    Treat compression cost as a scheduling input. Do not judge compression only by tokens removed. Also estimate cache-hit loss, rebuild cost, and the chance of compressing again soon.

    Expose enough usage detail: input tokens, cached input, output tokens, compression count, retries, and tool-call count. Without those, users cannot separate real spend from metering noise.

    Conclusion

    Quota spikes in long sessions are rarely one cause. Auto-compression, prefix-cache invalidation, repeated tool payloads, retries, and background checks can form an amplification chain.

    Do not judge reasonableness from “it only ran a few minutes,” and do not treat a sudden drop in remaining quota as proof of a one-line bug. A more reliable audit follows context size, compression events, cache hits, tool calls, retries, and final metering.

    For users, the practical controls are long-log hygiene, staged sessions, less dead history, and attention to cache hit rate. For platforms, compression, caching, and billing stats need to stay consistent, with auditable usage data. Only then can a spike be classified as normal long-context cost or a defect that needs a fix.