Skip to content

fix: recommend only viable compressible ranges (>=200 tokens) on all surfaces - #148

Merged
ranxianglei merged 2 commits into
masterfrom
2026-08-15_viable-ranges
Aug 15, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-08-15_viable-ranges

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Backport of billion-context-omp PR #7 (same kernel, same failure mode observed in the wild there).

Problem

The kernel's nudge can recommend fragmented ranges as compressible — e.g. a 16-token one-message ack. A model that follows the recommendation list and batches all ranges into one compress call gets atomically rejected: the kernel validates the whole batch, and a tiny range cannot carry a meaningful >=50-char summary ("Summary too short (43 chars, min 50)"). Observed on the omp sibling: a 14-range recommendation containing a 16-token range — every batch attempt failed until the model improvised around the list.

Change

  • messages.ts: VIABLE_RANGE_MIN_TOKENS = 200 + viableRanges()
  • Applied on every surface that recommends ranges:
    • index.ts: the injected nudge's compressibleRanges is filtered before rendering (renderNudgeText and the example line see the same list)
    • status-tool.ts: acp_status uncompressed view
    • commands.ts: the /acp panel

Purely advisory filtering: compress itself is untouched — the model can still compress any range it can argue for; kernel guards (min range, min summary) unchanged.

Test

tests/viable-ranges.test.ts — unit filter behavior + a pipeline test asserting the filtered list can't leak sub-200 ranges. Red-green verified (revert src → export missing → red). Suite: 155 pass / 17 fail — the 17 pre-exist on master (env-dependent), unaffected by this change.

@ranxianglei
ranxianglei merged commit eb064ca into master Aug 15, 2026
8 checks passed
ranxianglei pushed a commit that referenced this pull request Aug 16, 2026
…ressRange since #148 viable-ranges

The '2w limit fires the nudge' assertion (from #145) broke when #148 landed
viable-ranges: the kernel now only counts merged ranges with tokens*4 >=
minCompressRange (5000 chars) as effective T1 content. The 12x2000-char
fixture's ranges all stayed under the gate, so the EMERGENCY nudge was
correctly suppressed. Enlarge bulk text to 3000 chars/msg so the merged
range clears the gate; the 100w-limit idle assertion is unaffected (2%
usage, no pressure). Kernel behavior is intentional — fixture was stale.
HangxiangMa pushed a commit to HangxiangMa/billion-context-pi that referenced this pull request Sep 21, 2026
…-ranges

fix: recommend only viable compressible ranges (>=200 tokens) on all surfaces
HangxiangMa pushed a commit to HangxiangMa/billion-context-pi that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant