Migrate compaction tool-call test (#26737)
This commit is contained in:
@@ -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()
|
const stub = llm()
|
||||||
stub.push(
|
stub.push(
|
||||||
Stream.make(
|
Stream.make(
|
||||||
@@ -1497,39 +1499,23 @@ describe("session.compaction.process", () => {
|
|||||||
} satisfies LLM.Event,
|
} 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 })
|
const summary = (yield* ssn.messages({ sessionID: session.id })).find(
|
||||||
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(
|
|
||||||
(item) => item.info.role === "assistant" && item.info.summary,
|
(item) => item.info.role === "assistant" && item.info.summary,
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(summary?.info.role).toBe("assistant")
|
expect(summary?.info.role).toBe("assistant")
|
||||||
expect(summary?.parts.some((part) => part.type === "tool")).toBe(false)
|
expect(summary?.parts.some((part) => part.type === "tool")).toBe(false)
|
||||||
} finally {
|
}).pipe(Effect.provide(compactionProcessLayer({ llm: stub.layer })))
|
||||||
await rt.dispose()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
})
|
{ git: true },
|
||||||
})
|
)
|
||||||
|
|
||||||
test("summarizes only the head while keeping recent tail out of summary input", async () => {
|
test("summarizes only the head while keeping recent tail out of summary input", async () => {
|
||||||
const stub = llm()
|
const stub = llm()
|
||||||
|
|||||||
Reference in New Issue
Block a user