Skip to content

fix(context): honor compaction summary output reserve - #683

Open
treasuresyq wants to merge 1 commit into
OpenBMB:mainfrom
treasuresyq:codex/compaction-summary-budget
Open

treasuresyq wants to merge 1 commit into
OpenBMB:mainfrom
treasuresyq:codex/compaction-summary-budget

Conversation

@treasuresyq

Copy link
Copy Markdown

What changed

  • Raise the default compaction summary output budget from 4,000 to 16,000 tokens.
  • Clamp that reserve to 40% of the effective context when the latter is smaller.
  • Pass the resulting summaryOutputReserve to the summary request so tail planning and the provider maxOutputTokens use the same budget.

This PR does not restore the forced thinking: { enabled: false } override removed by #665. It fixes the separate summary-budget inconsistency described in #615.

Why

The compactor already calculates summaryOutputReserve, but summarize() received input.maxOutputTokens, which is normally undefined. Normal compaction therefore fell back to the fixed 4,000-token output cap while tail planning used a different reserve.

Refs #615

Verification

  • npm run build
  • node --test --test-force-exit --test-timeout 60000 dist/tests/context/compaction-engine.spec.js (19 passed)
  • node --test --test-force-exit --test-timeout 60000 dist/tests/context/autoCompaction.spec.js (22 passed)
  • node --test --test-force-exit --test-timeout 60000 dist/tests/agent/loop/context-cap.spec.js (10 passed)

Tests ran with Node v22.23.1. No real-provider truncation test was run.

This branch has not been deployed

No deployments
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