refactor: prefer room_settings over registered_groups in runtime reads

This commit is contained in:
Eyejoker
2026-03-31 22:27:36 +09:00
parent 1f1842773e
commit e730fea230
4 changed files with 17 additions and 15 deletions

View File

@@ -72,17 +72,14 @@ function inferFallbackOwnerAgentType(
}
function resolveDefaultOwnerAgentType(chatJid: string): AgentType | undefined {
const storedOwnerAgentType = getStoredRoomSettings(chatJid)?.ownerAgentType;
if (storedOwnerAgentType) {
return storedOwnerAgentType;
}
const types = getRegisteredAgentTypesForJid(chatJid);
const hasClaude = types.includes('claude-code');
const hasCodex = types.includes('codex');
const storedOwnerAgentType = getStoredRoomSettings(chatJid)?.ownerAgentType;
if (storedOwnerAgentType === 'claude-code' && hasClaude) {
return 'claude-code';
}
if (storedOwnerAgentType === 'codex' && hasCodex) {
return 'codex';
}
return inferFallbackOwnerAgentType(hasClaude, hasCodex);
}