fix(compaction): remove hardcoded Claude model from compaction hooks

This commit is contained in:
YeonGyu-Kim
2026-02-06 17:49:26 +09:00
parent f1b2f6f3f7
commit 60bbeb7304
8 changed files with 119 additions and 114 deletions
+35
View File
@@ -60,6 +60,41 @@ describe("preemptive-compaction", () => {
expect(summarize).toHaveBeenCalled()
})
test("triggers summarize for non-anthropic providers when usage exceeds threshold", async () => {
//#given
const messages = mock(() =>
Promise.resolve({
data: [
{
info: {
role: "assistant",
providerID: "openai",
modelID: "gpt-5.2",
tokens: {
input: 180000,
output: 0,
reasoning: 0,
cache: { read: 0, write: 0 },
},
},
},
],
})
)
const summarize = mock(() => Promise.resolve())
const hook = createPreemptiveCompactionHook(createMockCtx({ messages, summarize }))
const output = { title: "", output: "", metadata: {} }
//#when
await hook["tool.execute.after"](
{ tool: "Read", sessionID, callID: "call-3" },
output
)
//#then
expect(summarize).toHaveBeenCalled()
})
test("does not summarize when usage is below threshold", async () => {
// #given
const messages = mock(() =>