From f75b758c61d998bbf1bebc4b8bd72320307aed67 Mon Sep 17 00:00:00 2001 From: can1357 Date: Mon, 6 Jul 2026 09:34:57 +0200 Subject: [PATCH] test(coding-agent): flushed coalesced observer sync before todo assertion - Subagent lifecycle reconciliation now runs behind the 100ms observer UI coalescing timer; the test advances fake timers instead of asserting synchronously after emit. --- .../coding-agent/test/interactive-mode-todo-clear.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/coding-agent/test/interactive-mode-todo-clear.test.ts b/packages/coding-agent/test/interactive-mode-todo-clear.test.ts index bedac0bad..1fa6c0abf 100644 --- a/packages/coding-agent/test/interactive-mode-todo-clear.test.ts +++ b/packages/coding-agent/test/interactive-mode-todo-clear.test.ts @@ -134,6 +134,9 @@ describe("InteractiveMode todo HUD persistence", () => { mode.setTodos(session.getTodoPhases()); await mode.init(); + // Subagent lifecycle changes coalesce behind a 100ms observer UI sync + // timer before todo reconciliation runs; flush it deterministically. + vi.useFakeTimers(); eventBus.emit(TASK_SUBAGENT_LIFECYCLE_CHANNEL, { id: "ReviewFixer", index: 0, @@ -142,6 +145,7 @@ describe("InteractiveMode todo HUD persistence", () => { status: "completed", detached: true, }); + vi.advanceTimersByTime(100); expect(session.getTodoPhases()[0]?.tasks[0]?.status).toBe("completed"); });