mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-08 20:58:45 +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') {
|
if (event.status === 'running') {
|
||||||
return removeSessionActivity(current, event.sessionId);
|
return removeSessionActivity(current, event.sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.status === 'idle') {
|
||||||
|
return clearActiveSessionActivity(current, event.sessionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
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 = {
|
const current: SessionActivityMap = {
|
||||||
'session-1': {
|
'session-1': {
|
||||||
architect: {
|
architect: {
|
||||||
@@ -179,6 +179,40 @@ describe('session activity helpers', () => {
|
|||||||
).toEqual(current);
|
).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', () => {
|
test('clears only active agent states when a run is cancelled', () => {
|
||||||
const current: SessionActivityMap = {
|
const current: SessionActivityMap = {
|
||||||
'session-1': {
|
'session-1': {
|
||||||
|
|||||||
Reference in New Issue
Block a user