Migrate compaction tool-call test (#26737)

This commit is contained in:
Kit Langton
2026-05-10 19:44:42 -04:00
committed by GitHub
parent a658e43eeb
commit 64dde0cb15
@@ -1448,7 +1448,9 @@ describe("session.compaction.process", () => {
})
})
test("does not allow tool calls while generating the summary", async () => {
itProcess.instance(
"does not allow tool calls while generating the summary",
() => {
const stub = llm()
stub.push(
Stream.make(
@@ -1497,39 +1499,23 @@ describe("session.compaction.process", () => {
} satisfies LLM.Event,
),
)
return Effect.gen(function* () {
const ssn = yield* SessionNs.Service
const session = yield* ssn.create({})
const msg = yield* createUserMessage(session.id, "hello")
const msgs = yield* ssn.messages({ sessionID: session.id })
yield* SessionCompaction.use.process({ parentID: msg.id, messages: msgs, sessionID: session.id, auto: false })
await using tmp = await tmpdir({ git: true })
await WithInstance.provide({
directory: tmp.path,
fn: async () => {
const session = await svc.create({})
const msg = await user(session.id, "hello")
const rt = liveRuntime(stub.layer, wide())
try {
const msgs = await svc.messages({ sessionID: session.id })
await rt.runPromise(
SessionCompaction.Service.use((svc) =>
svc.process({
parentID: msg.id,
messages: msgs,
sessionID: session.id,
auto: false,
}),
),
)
const summary = (await svc.messages({ sessionID: session.id })).find(
const summary = (yield* ssn.messages({ sessionID: session.id })).find(
(item) => item.info.role === "assistant" && item.info.summary,
)
expect(summary?.info.role).toBe("assistant")
expect(summary?.parts.some((part) => part.type === "tool")).toBe(false)
} finally {
await rt.dispose()
}
}).pipe(Effect.provide(compactionProcessLayer({ llm: stub.layer })))
},
})
})
{ git: true },
)
test("summarizes only the head while keeping recent tail out of summary input", async () => {
const stub = llm()