fix: improve agent activity reporting

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-21 13:41:09 +01:00
co-authored by Copilot
parent b28a955271
commit e6826f1324
5 changed files with 102 additions and 28 deletions
+25 -6
View File
@@ -83,7 +83,7 @@ describe('session activity helpers', () => {
});
});
test('clears stale activity when a session restarts or finishes', () => {
test('clears stale activity when a session restarts', () => {
const current: SessionActivityMap = {
'session-1': {
architect: {
@@ -111,17 +111,36 @@ describe('session activity helpers', () => {
).toEqual({
'session-2': current['session-2'],
});
});
test('keeps the last observed status after completion or error', () => {
const current: SessionActivityMap = {
'session-1': {
architect: {
agentId: 'architect',
agentName: 'Architect',
activityType: 'completed',
},
},
};
expect(
applySessionEventActivity(current, {
sessionId: 'session-2',
kind: 'error',
sessionId: 'session-1',
kind: 'status',
occurredAt: '2026-03-23T00:00:00.000Z',
status: 'idle',
}),
).toEqual(current);
expect(
applySessionEventActivity(current, {
sessionId: 'session-1',
kind: 'error',
occurredAt: '2026-03-23T00:00:01.000Z',
error: 'Boom',
}),
).toEqual({
'session-1': current['session-1'],
});
).toEqual(current);
});
test('builds rows for all agents with sensible defaults', () => {