Stabilize paired follow-up routing

This commit is contained in:
ejclaw
2026-04-08 03:50:06 +09:00
parent c0f7f2c12d
commit 0f751af151
12 changed files with 248 additions and 30 deletions

View File

@@ -13,7 +13,7 @@ describe('paired follow-up scheduler', () => {
vi.useRealTimers();
});
it('deduplicates the same follow-up intent within one run', () => {
it('deduplicates the same follow-up intent while task state is unchanged', () => {
const enqueue = vi.fn();
const task = {
id: 'task-1',
@@ -41,6 +41,34 @@ describe('paired follow-up scheduler', () => {
expect(enqueue).toHaveBeenCalledTimes(1);
});
it('deduplicates the same follow-up intent across different runs', () => {
const enqueue = vi.fn();
const task = {
id: 'task-1',
status: 'review_ready',
round_trip_count: 1,
} as const;
const first = schedulePairedFollowUpOnce({
chatJid: 'group@test',
runId: 'run-1',
task,
intentKind: 'reviewer-turn',
enqueue,
});
const second = schedulePairedFollowUpOnce({
chatJid: 'group@test',
runId: 'run-2',
task,
intentKind: 'reviewer-turn',
enqueue,
});
expect(first).toBe(true);
expect(second).toBe(false);
expect(enqueue).toHaveBeenCalledTimes(1);
});
it('keeps different round trips schedulable', () => {
const enqueue = vi.fn();