Skip to content

fix(session): stop compacting every turn on a 32k-window model - #183

Merged
its-janghoon merged 1 commit into
developfrom
fix/compaction-quarter-window
Oct 28, 2026
Merged

its-janghoon merged 1 commit into
developfrom
fix/compaction-quarter-window

Conversation

@its-janghoon

Copy link
Copy Markdown
Member

What's done

  • usable() in packages/redrob/src/session/overflow.ts now reserves at most a quarter of the context window for the reply: min(20000, output, budget / 4).
  • On redrob/free (32,768 context, 32,000 output) the old reserve left 8,937 tokens, less than the system prompt and tool list (~12,000). Every turn overflowed, so redrob run "오늘 날씨 뭐야?" answered, summarised and auto-continued five times in one run. With the cap the compaction point is about 17,200 tokens.
  • Large windows are unchanged: for any context of 80,000 or more the reserve is still min(20000, output).

What's not done

  • No change to the compaction threshold (70%) or to the system prompt size.

What to review

  • The quarter-window cap in usable() and the updated source assertion in test/session/threshold-and-cost.test.ts.

Intentions

Small-window models such as the free Console model should compact when the conversation is actually long, not on the first turn.

Checked: bun run typecheck, bun test test/session test/provider (1038 pass).

usable() reserved min(20000, output) for the reply. On redrob/free
(32768 context, 32000 output) that left 8937 tokens, under the system
prompt and tool list, so each turn overflowed: a one-line question was
summarised and auto-continued five times in one run. Cap the reserve at
a quarter of the window.
@its-janghoon
its-janghoon merged commit 19dfc29 into develop Oct 28, 2026
12 checks passed
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