Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Check a group's new name last in a planned change

Fei24114a2b44a657bd
diff --git a/ds-bot/src/host/roster.js b/ds-bot/src/host/roster.js
index e88c8b8e..934ddaec 100644
--- a/ds-bot/src/host/roster.js
+++ b/ds-bot/src/host/roster.js
@@ -352,12 +352,14 @@ export function install(rt) {
admin = null
}
if (patch.mode !== undefined && !ROOM_MODES.includes(patch.mode)) throw new Error(`Reply mode must be one of ${ROOM_MODES.join(', ')}`)
- const name = patch.name === undefined ? undefined : cleanRoomName(patch.name, room.id)
const notice = patch.notice === undefined ? undefined : cleanNotice(patch.notice)
if (patch.workDir !== undefined && byAdmin) throw new Error(`Only the user or a Main Bot can set the folder of "${room.name}"`)
// A Bot's own permissions are the user's to set, so a group's are too.
if (patch.permission !== undefined && actorId !== undefined) throw new Error(`Only the user can set the permissions of "${room.name}"`)
const permission = patch.permission === undefined ? undefined : rt.cleanRoomPermission(patch.permission)
+ // The second run is the last check before the change is written, so no other change
+ // can take the name in between.
+ const name = patch.name === undefined ? undefined : cleanRoomName(patch.name, room.id)
return { members, admin, name, notice, permission }
}