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

perf: load only active CoS agents on Creative Director detail (#12995) (#13080)

[._.]/e999628d4818
diff --git a/client/src/pages/CreativeDirectorDetail.jsx b/client/src/pages/CreativeDirectorDetail.jsx
index bdbdff48c1..064ccb9f27 100644
--- a/client/src/pages/CreativeDirectorDetail.jsx
+++ b/client/src/pages/CreativeDirectorDetail.jsx
@@ -83,7 +83,7 @@ function CreativeDirectorProject({ id, basePath }) {
}, [setSearchParams]);
const { data: agents } = useSocketResource(
async () => {
- const data = await getCosAgents();
+ const data = await getCosAgents({ active: true });
return (data || []).filter(a => a.status === 'running' && (a.taskId || '').startsWith(`cd-${id}-`));
},
{ namespace: 'cos', events: AGENT_EVENTS, resourceKey: id,
diff --git a/client/src/pages/CreativeDirectorDetail.test.jsx b/client/src/pages/CreativeDirectorDetail.test.jsx
index 16a1e3b173..7710f869ee 100644
--- a/client/src/pages/CreativeDirectorDetail.test.jsx
+++ b/client/src/pages/CreativeDirectorDetail.test.jsx
@@ -136,6 +136,20 @@ describe('CreativeDirectorDetail route isolation', () => {
expect(cdApi.deleteCreativeDirectorProject).toHaveBeenCalledWith(projectB.id, { silent: true });
});
+ it('loads only active CoS agents and shows a running agent for this project', async () => {
+ getCosAgents.mockImplementation(({ active } = {}) => Promise.resolve(active
+ ? [{ id: 'agent-a', status: 'running', taskId: 'cd-cd-example-task' }]
+ : [{ id: 'agent-old', status: 'completed', taskId: 'cd-cd-example-old' }]));
+ render(
+ <MemoryRouter initialEntries={['/creative-director/cd-example/overview']}>
+ <Routes><Route path="/creative-director/:id/:tab" element={<CreativeDirectorDetail />} /></Routes>
+ </MemoryRouter>,
+ );
+ await waitFor(() => expect(screen.getByTestId('agents')).toHaveTextContent('agent-a'));
+ expect(getCosAgents).toHaveBeenCalledWith({ active: true });
+ expect(screen.getByTestId('agents')).not.toHaveTextContent('agent-old');
+ });
+
it('hides project actions when the response ID differs from the route', async () => {
cdApi.getCreativeDirectorProject.mockResolvedValue({ ...PROJECT, id: 'wrong-project' });
render(