Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: cover briefing completion during an outstanding read (#8604)

[._.]/ Adam Eivya703bb066b01
diff --git a/client/src/components/cos/tabs/BriefingTab.test.jsx b/client/src/components/cos/tabs/BriefingTab.test.jsx
index 5c3e1c907f..677c703803 100644
--- a/client/src/components/cos/tabs/BriefingTab.test.jsx
+++ b/client/src/components/cos/tabs/BriefingTab.test.jsx
@@ -156,3 +156,19 @@ it('keeps the selected historical briefing when a daily job completes', async ()
expect(api.getCosLatestBriefing).toHaveBeenCalledTimes(1);
expect(api.getCosBriefing).toHaveBeenLastCalledWith('2026-09-11');
});
+
+it('reconciles completion received while the post-trigger read is still pending', async () => {
+ let resolvePending;
+ api.getCosLatestBriefing
+ .mockResolvedValueOnce(null)
+ .mockReturnValueOnce(new Promise(resolve => { resolvePending = resolve; }))
+ .mockResolvedValueOnce({ date: '2026-09-12', content: '# Finished during read' });
+ renderTab();
+ await act(async () => {});
+ fireEvent.click(screen.getByRole('button', { name: 'Generate today’s briefing' }));
+ await act(async () => {});
+ await act(async () => socket.receive('cos:agent:completed', { metadata: { jobId: 'job-daily-briefing' } }));
+ await act(async () => resolvePending(null));
+ expect(screen.getByText('Finished during read')).toBeInTheDocument();
+ expect(api.getCosLatestBriefing).toHaveBeenCalledTimes(3);
+});