test(purge): assert the context-window guard reason that actually fires for overhead overflow

The experimental-overhead case pushes complete input past the context window, so the engine input guard reports context_limit, not the reservation-branch budget wording. Assert the actual message and limitingReason; the guard still blocks dispatch with zero requests.
This commit is contained in:
Agent Workbench Dev
2026-11-04 17:08:05 +08:00
parent 19f919ce52
commit b118d79f09
+4 -1
View File
@@ -142,7 +142,10 @@ test('experimental prompt overhead still participates in the original complete-i
}
const { f, context } = setup(t, { sessionFactory: () => new ThresholdInput() }, '工程'.repeat(3900)); f.store.saveConfig({ contextLimit: 64000, maxOutputTokens: 256 });
const group = await prepare(f, context); await (await context.manager.start(f.session, group.id, group.fingerprint)).promise;
assert.equal(context.requests.length, 0); assert.equal(jobs(f)[0].requests.length, 0); assert.match(jobs(f)[0].error, /预算/);
// The overhead pushes the complete input past the context window, so the guard
// reports context_limit; the original budget wording belongs to the reservation branch.
assert.equal(context.requests.length, 0); assert.equal(jobs(f)[0].requests.length, 0); assert.match(jobs(f)[0].error, /上下文窗口可用容量/);
assert.equal(jobs(f)[0].inputRejections[0].limitingReason, 'context_limit');
assert.equal(f.store.core.task.get(group.children[0].taskId).usage.requests, 0);
assert.ok(context.native[0].baselineEstimate <= 64000); assert.ok(context.native[0].experimentalEstimate > 64000);
});