fix(rooms): default new rooms to tribunal when room_mode is omitted
assign_room (MCP tool + host-side assignRoomInDatabase) and setup register previously fell back to 'single' when no room_mode was given, so newly added rooms silently lost the reviewer. Default to 'tribunal' across the MCP zod schema, the IPC arg fallback, and the DB helper, and update the ipc-auth expectation accordingly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -765,8 +765,10 @@ If folder is omitted, the host generates one automatically.`,
|
||||
name: z.string().describe('Display name for the room'),
|
||||
room_mode: z
|
||||
.enum(['single', 'tribunal'])
|
||||
.default('single')
|
||||
.describe('single=owner only, tribunal=owner/reviewer roles enabled'),
|
||||
.default('tribunal')
|
||||
.describe(
|
||||
'single=owner only, tribunal=owner/reviewer roles enabled (default)',
|
||||
),
|
||||
owner_agent_type: z
|
||||
.enum(['claude-code', 'codex'])
|
||||
.optional()
|
||||
@@ -831,7 +833,7 @@ If folder is omitted, the host generates one automatically.`,
|
||||
type: 'assign_room',
|
||||
jid: args.jid,
|
||||
name: args.name,
|
||||
room_mode: args.room_mode || 'single',
|
||||
room_mode: args.room_mode || 'tribunal',
|
||||
owner_agent_type: args.owner_agent_type,
|
||||
reviewer_agent_type: args.reviewer_agent_type,
|
||||
arbiter_agent_type: args.arbiter_agent_type,
|
||||
|
||||
@@ -194,7 +194,7 @@ export function assignRoomInDatabase(
|
||||
input: AssignRoomInput,
|
||||
): (RegisteredGroup & { jid: string }) | undefined {
|
||||
const existing = getStoredRoomSettingsRowFromDatabase(database, chatJid);
|
||||
const roomMode = input.roomMode || existing?.roomMode || 'single';
|
||||
const roomMode = input.roomMode || existing?.roomMode || 'tribunal';
|
||||
const ownerAgentType =
|
||||
input.ownerAgentType || existing?.ownerAgentType || OWNER_AGENT_TYPE;
|
||||
const folder = resolveAssignedRoomFolder(
|
||||
|
||||
@@ -1131,7 +1131,7 @@ describe('assign_room success', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('assign_room auto-fills missing folder for single rooms without exposing trigger metadata', async () => {
|
||||
it('assign_room auto-fills missing folder and defaults to tribunal without exposing trigger metadata', async () => {
|
||||
await processTaskIpc(
|
||||
{
|
||||
type: 'assign_room',
|
||||
@@ -1146,7 +1146,7 @@ describe('assign_room success', () => {
|
||||
const group = getRegisteredGroup('partial@g.us');
|
||||
expect(group).toBeDefined();
|
||||
expect(group!.folder).toMatch(/^grp_whatsapp_/);
|
||||
expect(getStoredRoomSettings('partial@g.us')?.roomMode).toBe('single');
|
||||
expect(getStoredRoomSettings('partial@g.us')?.roomMode).toBe('tribunal');
|
||||
});
|
||||
|
||||
it('assign_room preserves an existing tribunal room mode when room_mode is omitted', async () => {
|
||||
|
||||
Reference in New Issue
Block a user