fix: support same-service tribunal runtime

This commit is contained in:
Eyejoker
2026-03-31 14:01:31 +09:00
parent 236f7c2fea
commit 1c87616c44
9 changed files with 380 additions and 11 deletions

View File

@@ -9,6 +9,7 @@ import {
CODEX_REVIEW_SERVICE_ID,
DATA_DIR,
normalizeServiceId,
REVIEWER_AGENT_TYPE,
SERVICE_ID,
SERVICE_SESSION_SCOPE,
STORE_DIR,
@@ -1978,9 +1979,19 @@ export function getEffectiveRoomMode(chatJid: string): RoomMode {
return getExplicitRoomMode(chatJid) ?? inferRoomModeForJid(chatJid);
}
function canRunTribunalFromRegisteredAgentTypes(
agentTypes: readonly AgentType[],
): boolean {
const types = new Set(agentTypes);
if (types.size === 0) return false;
return REVIEWER_AGENT_TYPE === 'claude-code'
? types.has('claude-code')
: types.has('codex');
}
export function getEffectiveRuntimeRoomMode(chatJid: string): RoomMode {
return getEffectiveRoomMode(chatJid) === 'tribunal' &&
inferRoomModeForJid(chatJid) === 'tribunal'
canRunTribunalFromRegisteredAgentTypes(getRegisteredAgentTypesForJid(chatJid))
? 'tribunal'
: 'single';
}