feat: add structured room role metadata

This commit is contained in:
Eyejoker
2026-03-28 19:30:32 +09:00
parent 806e5e4ff1
commit 79a8a2639e
13 changed files with 300 additions and 0 deletions

View File

@@ -15,6 +15,9 @@ vi.mock('./config.js', () => ({
CODEX_REVIEW_SERVICE_ID: 'codex-review',
DATA_DIR: '/tmp/ejclaw-test-data',
SERVICE_SESSION_SCOPE: 'claude',
normalizeServiceId: vi.fn((serviceId: string) =>
serviceId === 'codex' ? 'codex-main' : serviceId,
),
}));
vi.mock('./db.js', () => ({
@@ -231,6 +234,32 @@ describe('runAgentForGroup room memory', () => {
);
});
it('passes paired-room role metadata through to the runner input', async () => {
const group = { ...makeGroup(), folder: 'test-group' };
await runAgentForGroup(makeDeps(), {
group,
prompt: 'hello',
chatJid: 'group@test',
runId: 'run-room-role',
});
expect(agentRunner.runAgentProcess).toHaveBeenCalledWith(
group,
expect.objectContaining({
roomRoleContext: {
serviceId: 'claude',
role: 'owner',
ownerServiceId: 'claude',
reviewerServiceId: 'codex-main',
failoverOwner: false,
},
}),
expect.any(Function),
undefined,
);
});
it('adds reviewer silence guidance when the current service is the reviewer for the chat', async () => {
const group = { ...makeGroup(), folder: 'test-group' };
vi.mocked(serviceRouting.getEffectiveChannelLease).mockReturnValue({