fix(coding-agent): stabilize auto-compaction threshold test
This commit is contained in:
@@ -248,7 +248,10 @@ describe("AgentSession auto-compaction queue resume", () => {
|
||||
it("should trigger threshold compaction for error messages using last successful usage", async () => {
|
||||
const model = session.model!;
|
||||
|
||||
// A successful assistant message with high token usage (near context limit)
|
||||
// A successful assistant message with token usage just over the compaction threshold.
|
||||
// Compute this from the selected model so generated catalog context-window changes do not break the test.
|
||||
const compactionSettings = settingsManager.getCompactionSettings();
|
||||
const thresholdTokens = (model.contextWindow ?? 200_000) - compactionSettings.reserveTokens + 1;
|
||||
const successfulAssistant: AssistantMessage = {
|
||||
role: "assistant",
|
||||
content: [{ type: "text", text: "large successful response" }],
|
||||
@@ -256,11 +259,11 @@ describe("AgentSession auto-compaction queue resume", () => {
|
||||
provider: model.provider,
|
||||
model: model.id,
|
||||
usage: {
|
||||
input: 180_000,
|
||||
input: thresholdTokens - 10_000,
|
||||
output: 10_000,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
totalTokens: 190_000,
|
||||
totalTokens: thresholdTokens,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
||||
},
|
||||
stopReason: "stop",
|
||||
|
||||
Reference in New Issue
Block a user