Skip to content

Auto-compaction never triggers for models with no declared context window #756

Description

@asharirfan

Summary

Auto-compaction appears to gate on the model's declared context window. Models that don't publish one (cloaked/stealth entries, some experimental routes) never trip the gate, so the conversation grows without bound until an upstream provider rejects it outright.

A session was observed reaching ~1.43M tokens (~5MB per request) with auto-compaction never firing. It fired only after the user manually switched to a model that does declare a limit and got back an explicit 400. That single pass then reclaimed ~920k tokens — proving compaction was both available and effective, just never triggered.

Separately, compaction also degenerates into no-op runs: in the same conversation it fired 14 consecutive times reclaiming 100-1,400 tokens each, succeeding every time and reclaiming essentially nothing.

Expected Behavior

  1. Auto-compaction triggers on an absolute payload/token threshold that does not depend on the model advertising a context window. A missing window should fall back to a conservative default, not disable the gate.
  2. Compaction should not re-fire when the previous pass reclaimed a negligible amount — that indicates it has nothing left to reclaim and the loop is wasted work.

Actual Behavior

  • No compaction fired during a 25-minute window of back-to-back request failures, while every request carried the same ~5MB payload.
  • Compaction fired only after a provider returned Input length 1434353 exceeds the maximum allowed input length of 262112 tokens.
  • Request-payload ceilings by model show the gate working and not working side by side. Models with a declared window are held under a hard ceiling; models without one run away:
model p95 payload max payload
declared window (e.g. deepseek/deepseek-v4-pro) 1.88 MB 3.84 MB (hard ceiling)
no declared window (e.g. stealth/ox-alpha) 2.39 MB 13.5 MB
no declared window (e.g. xiaomi/mimo-v2.5) 5.59 MB 16.6 MB

Steps to reproduce the issue

  1. Select a model that does not declare a context window (e.g. stealth/ox-alpha).
  2. Run a long agentic task that pins large tool output into the conversation — build logs, dependency installs, whole-file dumps.
  3. Watch /context. It grows past the provider's real limit and auto-compaction never fires.
  4. Switch to a model that declares a limit — it immediately returns 400 Input length … exceeds the maximum allowed input length.
  5. Compaction then fires and reclaims most of the context in one pass.

Command Code Version

1.32.1

Operating System

Windows

Additional context

This is the upstream cause of a class of "repeated 500 errors" reports. Oversized payloads correlate strongly with mid-stream aborts — internal telemetry puts the failure rate at ~3.5% for requests under 1MB, rising monotonically to ~42% above 5MB. Because the gate never fires on these models, affected users sit in the worst band on every attempt and see what looks like a total outage.

The misleading 500 those users actually see is #755.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions