Migrate compaction plugin test (#26736)

This commit is contained in:
Kit Langton 2026-05-10 19:42:44 -04:00 committed by GitHub
commit a658e43eeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1202,28 +1202,22 @@ describe("session.compaction.process", () => {
{ git: true }, { git: true },
) )
test("allows plugins to disable synthetic continue prompt", async () => { itProcess.instance(
await using tmp = await tmpdir() "allows plugins to disable synthetic continue prompt",
await WithInstance.provide({ Effect.gen(function* () {
directory: tmp.path, const ssn = yield* SessionNs.Service
fn: async () => { const session = yield* ssn.create({})
const session = await svc.create({}) const msg = yield* createUserMessage(session.id, "hello")
const msg = await user(session.id, "hello") const msgs = yield* ssn.messages({ sessionID: session.id })
const rt = runtime("continue", autocontinue(false), wide())
try { const result = yield* SessionCompaction.use.process({
const msgs = await svc.messages({ sessionID: session.id })
const result = await rt.runPromise(
SessionCompaction.Service.use((svc) =>
svc.process({
parentID: msg.id, parentID: msg.id,
messages: msgs, messages: msgs,
sessionID: session.id, sessionID: session.id,
auto: true, auto: true,
}), })
),
)
const all = await svc.messages({ sessionID: session.id }) const all = yield* ssn.messages({ sessionID: session.id })
const last = all.at(-1) const last = all.at(-1)
expect(result).toBe("continue") expect(result).toBe("continue")
@ -1233,17 +1227,12 @@ describe("session.compaction.process", () => {
(msg) => (msg) =>
msg.info.role === "user" && msg.info.role === "user" &&
msg.parts.some( msg.parts.some(
(part) => (part) => part.type === "text" && part.synthetic && part.text.includes("Continue if you have next steps"),
part.type === "text" && part.synthetic && part.text.includes("Continue if you have next steps"),
), ),
), ),
).toBe(false) ).toBe(false)
} finally { }).pipe(Effect.provide(compactionProcessLayer({ plugin: autocontinue(false) }))),
await rt.dispose() )
}
},
})
})
it.instance( it.instance(
"replays the prior user turn on overflow when earlier context exists", "replays the prior user turn on overflow when earlier context exists",