test(compaction): failing tests for missing headroom when limit.input is set#13034
Conversation
…nput is set isOverflow() uses `limit.input` directly without subtracting output token headroom, unlike the `context - output` fallback path. This means models with an explicit input limit (e.g. Claude with prompt caching) don't trigger compaction until the full input budget is consumed, leaving zero room for the next response. Three tests added: - Near-boundary case: 198K/200K used, should compact but doesn't - Parity test: same tokens correctly trigger compaction without limit.input - Asymmetry test: identical 200K models diverge by exactly 32K (the missing output headroom) Related: anomalyco#10634, anomalyco#8089, anomalyco#11086, anomalyco#12621 See also: anomalyco#6875, anomalyco#12924
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Perfect! I found the related PRs. Here are the potential duplicates/related PRs: Related PRs Found
These two PRs are directly addressing the root cause that PR #13034 is testing. The current PR adds failing tests that verify the bug exists, and PRs #6875 and #12924 are the actual fix implementations for the |
b8ef47d
into
anomalyco:fix-compact-bugs
|
ill just absorb into my branch since im working on this stuff |
|
@rekram1-node Ty! |
Relates to #10634
adds 3 failing tests showing that
isOverflow()doesn't reserve any headroom whenlimit.inputis set, unlike thecontext - outputfallback path.basically if you have a model with
limit.input = 200Kand you've used 198K tokens,isOverflowsays you're fine. next turn overflows.without
limit.input, same scenario correctly triggers compaction because it usescontext - output(168K).the diff between the two paths is exactly 32K — the output budget that's not being subtracted.
was hitting this with claude models in our tui project and traced it to line 37 in compaction.ts. saw #6875 and #12924 are both trying to fix this — these tests should pass once either lands.
related: #10634 #8089 #11086