Skip to content

Title: Context never auto-compresses when the model ignores the nudge — climbs 75%→95%+ on long agentic tasks (no enforcement path) #269

Description

@ranxianglei

Summary

billion-context-pi only ever TRIGGERS compression by injecting an advisory
nudge prompt; the actual compression requires the model to call the compress
tool itself. There is no enforcement / auto-compress path. When the model is
mid-way through a long agentic task and ignores the nudge, context grows
unbounded past the 75% OVER-LIMIT threshold all the way to 95%+ (EMERGENCY),
and EMERGENCY is also only a stronger label + output-headroom shrink
(262144→245760) + tool-output truncation — it still never force-compresses.

What 0.1.55 fixed (works)

The METER / detection: tokenCount = max(estimate, providerReal), so the
OVER-LIMIT nudge now fires at true 75% usage. Confirmed in acp.log —
session 01a01e31 on 0.1.55 logs nudge=active nudgeReason=OVER-LIMIT T1, usage 77% on EVERY turn from 77% up to 87% for 20+ consecutive turns.

What is still broken (the ask)

  1. No enforcement. Over 20 consecutive OVER-LIMIT turns the model did not
    call compress (only one earlier compliant compress: 184K→112K). There is no
    fallback that compresses server-side when the model keeps ignoring.
  2. Tiny compressible headroom during active work. At 87% usage the log shows
    max effective pending 16296 (est) — most of the context is either in the
    protected recent/current-step zone or already in 71 blocks, so even a
    compliant compress only reclaims 16K (87%→80%) and the running task
    regrows it within ~30 min. The protected "recent/last-user zone" may be too
    large for long single-step agentic runs.

Suggested fix

Add an enforcement path: after N consecutive ignored OVER-LIMIT/EMERGENCY
nudges (or hard at 0.95), the extension should auto-compress the largest
compressible ranges itself (server-side), independent of the model. Also
consider bounding the protected recent-zone by TIME/TOKENS (not "since last
user message") so long agentic steps don't pin ~all context as non-compressible.

Repro / evidence

  • pi 0.83.6, billion-context-pi 0.1.55, local sglang Qwen3.8-27B
    (window 262144→245760), CJK-heavy.
  • acp.log [turn] for sid 01a01e31, 07:57–08:06Z:
    nudge=active nudgeReason=OVER-LIMIT T1: max effective pending 16296, usage 87% blocks=71 activeBlocks=17 (repeated; no [compress] events).
  • One compliant compress at 07:25Z: applied ranges=3 tokensCompressed=29775 beforeTokens=37660 afterTokens=9148 then regrew 112K→212K in ~30 min.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions