Persist paired turn output before final delivery

This commit is contained in:
ejclaw
2026-04-07 03:38:16 +09:00
parent 58b20fad6c
commit ae12b157be
2 changed files with 46 additions and 13 deletions

View File

@@ -1318,6 +1318,7 @@ describe('runAgentForGroup room memory', () => {
it('stores reviewer turn output before transitioning the paired task back to active', async () => {
const group = { ...makeGroup(), folder: 'test-group' };
const deps = makeDeps();
const onOutput = vi.fn(async () => {});
vi.mocked(serviceRouting.getEffectiveChannelLease).mockReturnValue({
chat_jid: 'group@test',
@@ -1397,7 +1398,7 @@ describe('runAgentForGroup room memory', () => {
chatJid: 'group@test',
runId: 'run-reviewer-output-order',
forcedRole: 'reviewer',
onOutput: async () => {},
onOutput,
});
expect(result).toBe('success');
@@ -1407,6 +1408,11 @@ describe('runAgentForGroup room memory', () => {
'reviewer',
'DONE_WITH_CONCERNS\nreviewer feedback',
);
expect(
vi.mocked(db.insertPairedTurnOutput).mock.invocationCallOrder[0],
).toBeLessThan(
onOutput.mock.invocationCallOrder[0],
);
expect(
vi.mocked(db.insertPairedTurnOutput).mock.invocationCallOrder[0],
).toBeLessThan(