paired: suppress reviewer progress flush before verdict

This commit is contained in:
ejclaw
2026-04-11 09:56:59 +09:00
parent a858cc0cab
commit 29e39f25c9
2 changed files with 65 additions and 1 deletions

View File

@@ -117,10 +117,14 @@ describe('MessageTurnController outbound audit logging', () => {
await controller.finish('success');
expect(channel.sendAndTrack).toHaveBeenCalledTimes(1);
expect(channel.sendAndTrack).toHaveBeenCalledWith(
'dc:test-room',
expect.stringContaining('첫 진행 상황'),
);
expect(channel.editMessage).toHaveBeenCalledWith(
'dc:test-room',
'progress-1',
expect.stringContaining('둘째 진행 상황'),
expect.stringContaining(' 진행 상황'),
);
expect(deliverFinalText).toHaveBeenCalledWith('최종 답변');
@@ -274,6 +278,47 @@ describe('MessageTurnController outbound audit logging', () => {
);
});
it('does not flush pending progress before final delivery for paired reviewer turns', async () => {
const channel = makeChannel();
const deliverFinalText = vi.fn().mockResolvedValue(true);
const controller = new MessageTurnController({
chatJid: 'dc:test-room',
group: makeGroup(),
runId: 'run-review-no-pending-flush',
channel,
idleTimeout: 1_000,
failureFinalText: '실패',
isClaudeCodeAgent: true,
clearSession: vi.fn(),
requestClose: vi.fn(),
deliverFinalText,
deliveryRole: 'reviewer',
deliveryServiceId: 'codex-review',
pairedTurnIdentity: makeTurnIdentity(),
});
await controller.start();
await controller.handleOutput({
status: 'success',
phase: 'progress',
result: '오너가 대화와 관련 코드 근거를 대조해서 판정을 내리겠습니다.',
} as any);
await controller.handleOutput({
status: 'success',
phase: 'final',
result: 'PROCEED 근거를 확인했습니다.',
} as any);
await controller.finish('success');
expect(channel.sendAndTrack).not.toHaveBeenCalled();
expect(channel.sendMessage).not.toHaveBeenCalled();
expect(deliverFinalText).toHaveBeenCalledTimes(1);
expect(deliverFinalText).toHaveBeenCalledWith(
'PROCEED 근거를 확인했습니다.',
);
});
it('suppresses replaying the last progress update as final when final delivery is disallowed', async () => {
const channel = makeChannel();
const deliverFinalText = vi.fn().mockResolvedValue(true);