fix(compaction): skip autocontinue for compaction agent

This commit is contained in:
YeonGyu-Kim
2026-05-11 18:46:29 +09:00
parent 90f0971f4f
commit 3ed4651b7a
2 changed files with 26 additions and 1 deletions
+19
View File
@@ -160,6 +160,25 @@ describe("experimental.session.compacting handler", () => {
})
describe("experimental.compaction.autocontinue handler", () => {
it("disables OpenCode autocontinue when the compaction agent would continue itself", async () => {
//#given
const restoreContextMock = mock(async () => true)
const restoreTodosMock = mock(async () => {})
const handler = createCompactionAutocontinueHandler({
compactionContextInjector: { restore: restoreContextMock },
compactionTodoPreserver: { restore: restoreTodosMock },
})
const output = { enabled: true }
//#when
await handler({ sessionID: "ses_compaction_loop", agent: "compaction" }, output)
//#then
expect(output.enabled).toBe(false)
expect(restoreContextMock).not.toHaveBeenCalled()
expect(restoreTodosMock).not.toHaveBeenCalled()
})
it("restores checkpointed context and todos before OpenCode adds the synthetic continue turn", async () => {
//#given
const callOrder: string[] = []