fix: block stale paired IPC and duplicate finalize turns

This commit is contained in:
ejclaw
2026-04-11 04:18:43 +09:00
parent 320fc58763
commit e88073f2f8
10 changed files with 435 additions and 61 deletions

View File

@@ -124,7 +124,7 @@ describe('GroupQueue', () => {
await vi.advanceTimersByTimeAsync(10);
});
it('stores direct terminal text for the active run and clears it when the run ends', async () => {
it('stores direct terminal text for the active run, keeps a recent run record, and clears the active slot when the run ends', async () => {
let releaseRun!: (value: boolean) => void;
let runId: string | undefined;
const blocker = new Promise<boolean>((resolve) => {
@@ -155,6 +155,13 @@ describe('GroupQueue', () => {
expect(
queue.getDirectTerminalDeliveryForRun('group1@g.us', runId!, 'reviewer'),
).toBe('DONE_WITH_CONCERNS\n리뷰 완료');
expect(
queue.hasRecordedDirectTerminalDeliveryForRun(
'group1@g.us',
runId!,
'reviewer',
),
).toBe(true);
releaseRun(true);
await vi.advanceTimersByTimeAsync(10);
@@ -165,6 +172,13 @@ describe('GroupQueue', () => {
expect(
queue.getDirectTerminalDeliveryForRun('group1@g.us', runId!, 'reviewer'),
).toBeNull();
expect(
queue.hasRecordedDirectTerminalDeliveryForRun(
'group1@g.us',
runId!,
'reviewer',
),
).toBe(true);
});
it('force-terminates a lingering process after output was delivered', async () => {