Merge branch 'cw/radar-screen-performance' into cw-merge-1772829950184

This commit is contained in:
Lukas May
2026-03-06 21:45:50 +01:00
16 changed files with 3684 additions and 233 deletions

View File

@@ -326,6 +326,47 @@ describe('agent.listForRadar', () => {
expect(row!.subagentsCount).toBe(0);
expect(row!.compactionsCount).toBe(0);
});
it('returns zero counts for agent with no metrics row', async () => {
const agents = new MockAgentManager();
const ctx = makeCtx(agents);
const now = new Date();
// Agent with no log chunks at all — no agent_metrics row will exist
agents.addAgent({ id: 'agent-no-chunks', name: 'no-chunks-agent', status: 'running', createdAt: now });
const caller = createAgentCaller(ctx);
const result = await caller.listForRadar({ timeRange: 'all' });
const row = result.find(r => r.id === 'agent-no-chunks');
expect(row).toBeDefined();
expect(row!.questionsCount).toBe(0);
expect(row!.subagentsCount).toBe(0);
expect(row!.compactionsCount).toBe(0);
});
it('listForRadar response does not contain chunk content field', async () => {
const agents = new MockAgentManager();
const ctx = makeCtx(agents);
const { logChunkRepo } = getRepos(ctx);
const now = new Date();
agents.addAgent({ id: 'agent-content', name: 'content-agent', status: 'running', createdAt: now });
await logChunkRepo.insertChunk({
agentId: 'agent-content',
agentName: 'content-agent',
sessionNumber: 1,
content: JSON.stringify({ type: 'tool_use', name: 'Agent', input: { description: 'do stuff', prompt: 'some prompt' } }),
});
const caller = createAgentCaller(ctx);
const result = await caller.listForRadar({ timeRange: 'all' });
for (const row of result) {
expect(row).not.toHaveProperty('content');
}
});
});
// =============================================================================