Skip to content

Stop later Online Context Compact boundaries from inheriting a stale request horizon - #71

Open
YPQuinn wants to merge 2 commits into
NVlabs:mainfrom
YPQuinn:fix/occ-stale-horizon
Open

YPQuinn wants to merge 2 commits into
NVlabs:mainfrom
YPQuinn:fix/occ-stale-horizon

Conversation

@YPQuinn

@YPQuinn YPQuinn commented Sep 17, 2026

Copy link
Copy Markdown

Summary

  • Fixes later-session Online Context Compact over-triggering (Online Context Compact over-triggers later boundary compactions from a stale request horizon #70): compaction epochs now drop completedBoundaryRequestCounts, persist the last real summary size, and defer near-floor, cooldown, and unrepaid cache-debt cases.
  • A completed plan plus a new user turn starts a fresh request horizon so a short follow-up task does not inherit the research-phase cadence.
  • Window protection is unchanged. Regression fixtures keep the first long-session compact and an epoch-local mid-session compact economic, and require the 40K wrap-up / short follow-up cases to defer.

Test plan

  • npx vitest run tests/online-context-compact-economics.test.ts tests/online-context-compact-state.test.ts tests/online-context-compact.test.ts tests/online-context-compact-agent-session.test.ts
  • npm run typecheck
  • npx vitest run (151 tests)
  • Confirm a long research-then-implement session no longer chains a compact 4 minutes after the previous one at ~40K context
  • Confirm a new user task after the previous plan is fully completed does not inherit the old boundary-request mean

Made with Cursor

yinpeng.xu and others added 2 commits September 17, 2026 01:14
…request horizon.

A long first plan interval was surviving across compaction epochs, so wrap-up and follow-up tasks could pass the economic gate on already-slim context. Reset epoch-local counts, use the last real summary size, and defer near-floor, cooldown, and unrepaid cache-debt cases.

Co-authored-by: Cursor <cursoragent@cursor.com>
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