From 5ca11afd4239f595131e1063ef87702a91588758 Mon Sep 17 00:00:00 2001 From: Evander Date: Tue, 24 Nov 2026 04:19:04 -0500 Subject: [PATCH] =?UTF-8?q?fix(minimax-bot):=20=E6=B2=A1=E5=A1=AB=E7=9A=84?= =?UTF-8?q?=E5=8F=AF=E9=80=89=E5=80=BC=E5=BD=93=E4=BD=9C=E6=B2=A1=E5=A1=AB?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E5=BD=93=E6=88=90=E9=9D=9E?= =?UTF-8?q?=E6=B3=95=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../minimax-bot/.minimax-plugin/plugin.json | 2 +- plugins/minimax-ai/minimax-bot/README.md | 4 +++ .../minimax-bot/miniapp/node/mcp.mjs | 2 +- .../minimax-bot/miniapp/node/team.mjs | 9 +++--- plugins/minimax-ai/minimax-bot/package.json | 2 +- .../tests/enum-validation.test.mjs | 29 +++++++++++++++++++ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json b/plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json index 37445d15..370cee81 100644 --- a/plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json +++ b/plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "name": "minimax-bot", "displayName": "MiniMax Bot", - "version": "0.7.38", + "version": "0.7.40", "description": "Turn MiniMax Code into an always-on team of Bots. A Chief Bot helps you build the team; in group chats the admin answers and @mentions hand work to other members. Every Bot has its own octopus avatar and memory, with scheduled tasks and usage stats.", "author": "MiniMax Code", "icon": "icon.png", diff --git a/plugins/minimax-ai/minimax-bot/README.md b/plugins/minimax-ai/minimax-bot/README.md index e93a87e6..e8140d99 100644 --- a/plugins/minimax-ai/minimax-bot/README.md +++ b/plugins/minimax-ai/minimax-bot/README.md @@ -155,6 +155,10 @@ The hand-over between two Bots of a group carried the tail of the previous reply - Asking to let a stuck chat go now shows on the page that it took: the message says the later messages may go on, and the button is gone. A message that arrives while that is being written goes out with it, instead of waiting for a second press of the button. - A job that was stopped and then killed by the process still leaves its turn in the usage ledger. The row is written under the job's own id, so a job that did finish is not counted twice. - Nothing else moves: a request with an unknown outcome is still never replayed on its own, and the order of the messages around it is unchanged. +## 0.7.40 A value that is not there is left out, not refused + +- The reply mode of a group and the kind of a scheduled task are checked against the values the catalogue offers, so a value that is not one of them is refused instead of quietly becoming another one. A value that is not there at all was refused too, when it arrived as null: many models write an optional field they did not fill in as null, and the call failed with "reply_mode must be one of: admin, all". +- A null is now read as what it is — a field that was left out — so the default applies, the same as when the field is absent. A value that is there but is not one of the allowed ones is still refused, and so is the text "null". ## 0.7.10 Optional group notes diff --git a/plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs b/plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs index d4fd1987..a6473f79 100644 --- a/plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs +++ b/plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs @@ -662,7 +662,7 @@ export function createMcpHandler({ team, engine }) { result = { protocolVersion: PROTOCOL_VERSIONS.includes(requested) ? requested : PROTOCOL_VERSIONS[0], capabilities: { tools: { listChanged: false } }, - serverInfo: { name: 'minimax-bot', version: '0.7.38' }, + serverInfo: { name: 'minimax-bot', version: '0.7.40' }, instructions: t('mcp.instructions'), }; break; diff --git a/plugins/minimax-ai/minimax-bot/miniapp/node/team.mjs b/plugins/minimax-ai/minimax-bot/miniapp/node/team.mjs index d9b212ef..7869b822 100644 --- a/plugins/minimax-ai/minimax-bot/miniapp/node/team.mjs +++ b/plugins/minimax-ai/minimax-bot/miniapp/node/team.mjs @@ -372,7 +372,7 @@ export class Team { notice: String(input.notice ?? '').trim().slice(0, 500), adminId, memberIds, - replyMode: input.replyMode === undefined ? 'admin' : replyModeOf(input.replyMode), + replyMode: input.replyMode == null ? 'admin' : replyModeOf(input.replyMode), pinned: false, createdAt: Date.now(), // F7 · the relay guardrails. The hop limit counts how many Bots may speak in one relay @@ -419,7 +419,7 @@ export class Team { const draft = { ...group, memberIds: [...group.memberIds] }; if (patch.name !== undefined) draft.name = this.validateName(patch.name, 'group', group.id); if (patch.notice !== undefined) draft.notice = String(patch.notice).trim().slice(0, 500); - if (patch.replyMode !== undefined) draft.replyMode = replyModeOf(patch.replyMode); + if (patch.replyMode != null) draft.replyMode = replyModeOf(patch.replyMode); if (patch.pinned !== undefined) draft.pinned = Boolean(patch.pinned); // The relay guardrails: absent leaves the group's own setting alone. 0 = no limit. if (patch.maxHops !== undefined) draft.maxHops = hopLimit({ maxHops: patch.maxHops }); @@ -593,8 +593,9 @@ export class Team { const list = this.store.state.schedules; const existing = input.id ? list.find((s) => s.id === input.id) : undefined; // No kind at all is the daily default. A kind that is not one of the three is refused: - // another kind would run at a time the user never asked for. - const kind = input.kind === undefined ? 'daily' : scheduleKindOf(input.kind); + // another kind would run at a time the user never asked for. A kind that is not there at + // all — left out, or sent as null — is the same thing as leaving it out. + const kind = input.kind == null ? 'daily' : scheduleKindOf(input.kind); const time = String(input.time ?? '09:00'); if (kind === 'daily' && !/^([01]\d|2[0-3]):[0-5]\d$/.test(time)) { throw new EngineError('invalid', t('err.scheduleTime')); diff --git a/plugins/minimax-ai/minimax-bot/package.json b/plugins/minimax-ai/minimax-bot/package.json index e0d76793..e799ef2e 100644 --- a/plugins/minimax-ai/minimax-bot/package.json +++ b/plugins/minimax-ai/minimax-bot/package.json @@ -1,6 +1,6 @@ { "name": "minimax-bot", - "version": "0.7.38", + "version": "0.7.40", "private": true, "type": "module", "mcode": { diff --git a/plugins/minimax-ai/minimax-bot/tests/enum-validation.test.mjs b/plugins/minimax-ai/minimax-bot/tests/enum-validation.test.mjs index 1825a5f3..99a2b4c1 100644 --- a/plugins/minimax-ai/minimax-bot/tests/enum-validation.test.mjs +++ b/plugins/minimax-ai/minimax-bot/tests/enum-validation.test.mjs @@ -273,3 +273,32 @@ test('the refusals are written in the user\'s language', async (t) => { (error) => { assert.equal(error.code, 'invalid'); assert.match(error.message, /admin/); return true; }, ); }); + +test('a value that is not there at all is left out, not refused', async (t) => { + const { team } = await teamFixture(t); + const bot = await writer(team); + // A model that leaves an optional field out often writes it as null. That is the same as + // leaving it out, so the default applies. A value that is there but wrong is still refused. + const group = await team.createGroup(undefined, { name: 'NullMode', members: [bot.id], replyMode: null }); + assert.equal(group.replyMode, 'admin', 'the default applies to a reply mode sent as null'); + const schedule = await team.saveSchedule({ botId: bot.id, prompt: 'Daily digest', kind: null }); + assert.equal(schedule.kind, 'daily', 'the default applies to a kind sent as null'); + + // A value that is there but not one of the allowed ones is still refused. + await assert.rejects( + () => team.createGroup(undefined, { name: 'WrongMode', members: [bot.id], replyMode: 'everyone' }), + (error) => { assert.equal(error.code, 'invalid'); return true; }, + ); + await assert.rejects( + () => team.saveSchedule({ botId: bot.id, prompt: 'Report', kind: 'hourly' }), + (error) => { assert.equal(error.code, 'invalid'); return true; }, + ); +}); + +test('a reply mode sent as null leaves an existing group with the setting it had', async (t) => { + const { team } = await teamFixture(t); + const bot = await writer(team); + const group = await team.createGroup(undefined, { name: 'Crew', members: [bot.id], replyMode: 'all' }); + const updated = await team.updateGroup(undefined, group.id, { replyMode: null }); + assert.equal(updated.replyMode, 'all', 'the mode the group had is kept'); +});