mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-24 13:38:43 +02:00
fix: clear live agent status on cancel
Clear only active agent statuses when a session reaches idle, and keep the terminal cancelled/error run cleanup in place. Add regression coverage for idle cleanup after cancellation-like flows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -46,6 +46,10 @@ export function applySessionEventActivity(
|
||||
if (event.status === 'running') {
|
||||
return removeSessionActivity(current, event.sessionId);
|
||||
}
|
||||
|
||||
if (event.status === 'idle') {
|
||||
return clearActiveSessionActivity(current, event.sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -149,7 +149,7 @@ describe('session activity helpers', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('keeps the last observed status after completion or error', () => {
|
||||
test('preserves completed activity on idle and error', () => {
|
||||
const current: SessionActivityMap = {
|
||||
'session-1': {
|
||||
architect: {
|
||||
@@ -179,6 +179,40 @@ describe('session activity helpers', () => {
|
||||
).toEqual(current);
|
||||
});
|
||||
|
||||
test('clears only active agent states when a session becomes idle', () => {
|
||||
const current: SessionActivityMap = {
|
||||
'session-1': {
|
||||
architect: {
|
||||
agentId: 'architect',
|
||||
agentName: 'Architect',
|
||||
activityType: 'completed',
|
||||
},
|
||||
reviewer: {
|
||||
agentId: 'reviewer',
|
||||
agentName: 'Reviewer',
|
||||
activityType: 'thinking',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
expect(
|
||||
applySessionEventActivity(current, {
|
||||
sessionId: 'session-1',
|
||||
kind: 'status',
|
||||
occurredAt: '2026-03-23T00:00:01.000Z',
|
||||
status: 'idle',
|
||||
}),
|
||||
).toEqual({
|
||||
'session-1': {
|
||||
architect: {
|
||||
agentId: 'architect',
|
||||
agentName: 'Architect',
|
||||
activityType: 'completed',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('clears only active agent states when a run is cancelled', () => {
|
||||
const current: SessionActivityMap = {
|
||||
'session-1': {
|
||||
|
||||
Reference in New Issue
Block a user