feat(core): increase context compression preservation

COMPRESSION_PRESERVE_THRESHOLD 0.3→0.4, FUNCTION_RESPONSE_TOKEN_BUDGET
50k→75k to retain more context for incremental tasks.
This commit is contained in:
Bryan Morgan
2026-02-22 10:09:42 -05:00
parent 8be312c483
commit 692a8efe2a
2 changed files with 5 additions and 4 deletions

View File

@@ -718,8 +718,9 @@ describe('ChatCompressionService', () => {
it('should use high-fidelity original history for summarization when under the limit, but truncated version for active window', async () => {
// Large response in the "to compress" section (first message)
// 300,000 chars is ~75k tokens, well under the 1,000,000 summarizer limit.
const massiveText = 'a'.repeat(300000);
// 500,000 chars is ~125k tokens, well under the 1,000,000 summarizer limit
// but exceeds COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET (75k).
const massiveText = 'a'.repeat(500000);
const history: Content[] = [
{
role: 'user',

View File

@@ -43,12 +43,12 @@ const DEFAULT_COMPRESSION_TOKEN_THRESHOLD = 0.5;
* The fraction of the latest chat history to keep. A value of 0.3
* means that only the last 30% of the chat history will be kept after compression.
*/
const COMPRESSION_PRESERVE_THRESHOLD = 0.3;
const COMPRESSION_PRESERVE_THRESHOLD = 0.4;
/**
* The budget for function response tokens in the preserved history.
*/
const COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET = 50_000;
const COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET = 75_000;
/**
* Returns the index of the oldest item to keep when compressing. May return