Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(conversations): cover cancelled todo reason preservation

Steven Enamakel9912328209b1
diff --git a/app/src/features/conversations/aui/useThreadTodos.test.tsx b/app/src/features/conversations/aui/useThreadTodos.test.tsx
index 958067be11..926df29eef 100644
--- a/app/src/features/conversations/aui/useThreadTodos.test.tsx
+++ b/app/src/features/conversations/aui/useThreadTodos.test.tsx
@@ -50,6 +50,16 @@ describe('useLoadThreadTodos', () => {
]);
});
+ it('preserves the core reason for a cancelled todo item', async () => {
+ const cancelled = { content: 'Review the migration', status: 'cancelled' as const, reason: null };
+ vi.mocked(threadApi.getTodos).mockResolvedValue([cancelled]);
+ const { store, wrapper } = setup();
+ renderHook(() => useLoadThreadTodos('t1'), { wrapper });
+
+ await waitFor(() => expect(store.getState().threadTodos.byThread.t1).toEqual([cancelled]));
+ expect(store.getState().threadTodos.byThread.t1?.[0].reason).toBeNull();
+ });
+
// A rejected `getTodos()` (older core, transient failure) is swallowed by
// the hook's try/catch, leaving the slice untouched — see the source. Not
// exercised here via an actual rejected promise: doing so inside a React