Updates
Rolling release / release (push) Failing after 1m49s

This commit is contained in:
2026-09-12 19:36:06 -04:00
parent 9ad09b593c
commit d47e9e260f
30 changed files with 917 additions and 162 deletions
+30 -4
View File
@@ -222,6 +222,35 @@ test('sidecar context is reserved in the history budget', () => {
assert.equal(compaction.historyBudget(8192, [], 0) - compaction.historyBudget(8192, [], 0, 512), 512);
});
test('voice sessions keep a short spoken tail even on large model windows', () => {
assert.equal(compaction.voiceKeepTokens(4096), 1024);
assert.equal(compaction.voiceKeepTokens(16384), 1024);
assert.equal(compaction.voiceKeepTokens(32768), 1024);
assert.ok(compaction.voiceKeepTokens(2048) <= 573);
const sys = { role: 'system', content: 'You are Jarvis. '.repeat(40) };
const short = [
sys,
{ role: 'assistant', content: 'Hello!' },
{ role: 'user', content: 'What time is it?' },
];
assert.equal(compaction.shouldCompact(short, [], 32768, 0, { voice: true }), false);
const long = [
sys,
{ role: 'user', content: 'Remember nest.' },
{ role: 'assistant', content: 'details '.repeat(2000) },
{ role: 'user', content: 'And the hostname?' },
{ role: 'assistant', content: 'Still nest. ' + 'padding '.repeat(200) },
];
assert.equal(compaction.shouldCompact(long, [], 32768, 0, { voice: true }), true);
const sysTok = compaction.conversationTokens([sys]);
const budget = compaction.historyBudget(32768, [], 0, 0, { voice: true, systemTokens: sysTok });
assert.ok(budget <= sysTok + compaction.VOICE_KEEP_TOKENS);
assert.ok(budget < compaction.historyBudget(32768, [], 0));
const out = compaction.compact(long, { budgetTokens: budget, voice: true });
assert.ok(compaction.dialogTokens(out) <= compaction.VOICE_KEEP_TOKENS + 32);
assert.ok(out.some((m) => m.content === 'And the hostname?'));
});
for (const overflow of [false, true]) {
test(`turn loop persists compaction and sends one-shot reminders through retries (overflow=${overflow})`, async (t) => {
const { mkdtempSync, rmSync } = await import('node:fs');
@@ -260,13 +289,11 @@ for (const overflow of [false, true]) {
{ role: 'user', content: 'Remember the hostname.' },
{ role: 'assistant', content: 'I will remember nest.' },
]);
let summaries = 0;
let completions = 0;
const promptSizes = [];
engine.complete = async ({ history }) => {
if (history[0].content.startsWith('Reply with the four summary sections')) {
summaries++;
return { text: 'The computer is named nest. The user wants brief answers. We have checked memory and should continue answering follow-up questions about this computer.' };
throw new Error('voice turns must not spend a completion on LLM summarization');
}
completions++;
promptSizes.push(compaction.conversationTokens(history));
@@ -285,7 +312,6 @@ for (const overflow of [false, true]) {
emit: (_kind, event) => updates.push(event),
});
assert.equal(result.text, 'Its hostname is nest.');
assert.equal(summaries, 1);
assert.equal(completions, overflow ? 2 : 1);
if (overflow) assert.ok(promptSizes[1] < promptSizes[0], 'overflow recovery must actually shrink the prompt');
assert.ok(updates.some((ev) => ev.type === 'compaction' && ev.status === 'done'));