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.
This commit is contained in:
can1357
2026-07-06 09:34:57 +02:00
parent a1c0f60d97
commit f75b758c61
@@ -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");
});