Send a compacted history inline, with no provider item references

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Muhammad Zakir Ramadhan
2026-09-05 17:29:40 +07:00
co-authored by Sisyphus
parent a8a3ffcb5c
commit 4f6ed43fed
2 changed files with 51 additions and 7 deletions
+15
View File
@@ -423,6 +423,21 @@ test('reasoning is always dropped, whatever the threshold', () => {
expect(JSON.stringify(fitted)).not.toContain('deciding');
});
test('compaction removes a plain assistant item reference without inline reasoning', () => {
const messages: ModelMessage[] = [
{ role: 'user', content: `question ${'x'.repeat(2000)}` },
{
role: 'assistant',
content: [{ type: 'text', text: 'answer', providerOptions: { openai: { itemId: 'msg_plain' } } }],
},
];
const fitted = pruneToFit({ messages, threshold: 1, estimate });
expect(itemIds(fitted)).toEqual([]);
expect(JSON.stringify(fitted)).toContain('answer');
});
test('the user prompt survives even the narrowest rung', () => {
const messages = transcript(200, 4000);
const fitted = pruneToFit({ messages, threshold: 100, estimate });