feat(core): enhanced anchored iterative context compression with self-verification (#15710)

This commit is contained in:
Ramón Medrano Llamas
2026-01-20 09:43:15 +01:00
committed by GitHub
parent e34f0b4a98
commit 1182168bd9
9 changed files with 283 additions and 40 deletions

View File

@@ -211,4 +211,36 @@ describe('<CompressionMessage />', () => {
}
});
});
describe('failure states', () => {
it('renders failure message when model returns an empty summary', () => {
const props = createCompressionProps({
isPending: false,
compressionStatus: CompressionStatus.COMPRESSION_FAILED_EMPTY_SUMMARY,
});
const { lastFrame, unmount } = render(<CompressionMessage {...props} />);
const output = lastFrame();
expect(output).toContain('✦');
expect(output).toContain(
'Chat history compression failed: the model returned an empty summary.',
);
unmount();
});
it('renders failure message for token count errors', () => {
const props = createCompressionProps({
isPending: false,
compressionStatus:
CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR,
});
const { lastFrame, unmount } = render(<CompressionMessage {...props} />);
const output = lastFrame();
expect(output).toContain(
'Could not compress chat history due to a token counting error.',
);
unmount();
});
});
});

View File

@@ -46,6 +46,8 @@ export function CompressionMessage({
return 'Chat history compression did not reduce size. This may indicate issues with the compression prompt.';
case CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR:
return 'Could not compress chat history due to a token counting error.';
case CompressionStatus.COMPRESSION_FAILED_EMPTY_SUMMARY:
return 'Chat history compression failed: the model returned an empty summary.';
case CompressionStatus.NOOP:
return 'Nothing to compress.';
default: