From 99d1f35e9b2d36d4f29b1a5ec3860fa654614c91 Mon Sep 17 00:00:00 2001 From: Apageoflove Date: Wed, 18 Nov 2026 04:28:56 -0500 Subject: [PATCH] =?UTF-8?q?fix(minimax-bot):=20=E9=87=8D=E8=AF=95=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E4=B9=8B=E5=90=8E=E6=B8=85=E6=8E=89=E9=82=A3=E6=9D=A1?= =?UTF-8?q?=E6=9C=AA=E9=80=81=E8=BE=BE=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一条用户消息第一次投递失败时被标成 failed,页面显示「未送达」。用户点重试 成功后,回复来了,可原消息的 dispatchState 没人再改,永久停在 failed —— 于是聊天里一条已到的回复旁边挂着一条「未送达」。 retryMessage 的 run 闭包里补一步:回合被宿主接受后,把 message.sourceMessageId 指向的那条用户消息改成 delivered 并广播。只改仍带第一次失败判定的那些, 后来的操作写下的状态不动。 新测试在 0.7.28 上红、在切片上绿。全量 414 条通过。 --- .../minimax-bot/.minimax-plugin/plugin.json | 2 +- plugins/minimax-ai/minimax-bot/README.md | 5 ++++ .../minimax-bot/miniapp/node/engine.mjs | 13 +++++++++ .../minimax-bot/miniapp/node/mcp.mjs | 2 +- plugins/minimax-ai/minimax-bot/package.json | 2 +- .../tests/engine-reliability.test.mjs | 29 +++++++++++++++++++ 6 files changed, 50 insertions(+), 3 deletions(-) diff --git a/plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json b/plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json index 7e5cc956..bdc8e0b7 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.32", + "version": "0.7.34", "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 dcaf8d60..386fc2b4 100644 --- a/plugins/minimax-ai/minimax-bot/README.md +++ b/plugins/minimax-ai/minimax-bot/README.md @@ -116,6 +116,11 @@ The hand-over between two Bots of a group carried the tail of the previous reply - Two writes the plugin fires and forgets had nothing to catch their failure: the session id recorded when a turn starts, and the scheduled-task scan that runs every 30 seconds. A failed write there became an unhandled rejection, and the Host fails the whole Mini App process on one of those — so a disk that would not take a write took every running turn with it, and the scheduled task kept retrying every 30 seconds. - Both now report the failure through the plugin log, the way the task save next to one of them already did. The turn carries on, and the scan keeps running. +## 0.7.34 A retry that succeeds clears the "not delivered" line it answers + +- When a turn failed, the user's message kept the failed delivery state even after the reply was retried successfully: the chat showed a reply next to an input still marked as not delivered, and the line stayed that way for good. +- A retry that reaches the Host now marks the request it answered as delivered, so the badge matches what happened. Only a line still carrying the first attempt's verdict is changed; anything a later action wrote stays as it is. + ## 0.7.10 Optional group notes - A group can keep a note of what it said. After every round the group records the closing lines of the replies, and every Bot of the group gets that record in its standing brief. diff --git a/plugins/minimax-ai/minimax-bot/miniapp/node/engine.mjs b/plugins/minimax-ai/minimax-bot/miniapp/node/engine.mjs index f5d28487..ef6c7af1 100644 --- a/plugins/minimax-ai/minimax-bot/miniapp/node/engine.mjs +++ b/plugins/minimax-ai/minimax-bot/miniapp/node/engine.mjs @@ -1483,6 +1483,19 @@ export class Engine { this.broadcast({ type: 'message.upsert', chatId, message }); const run = async () => { const result = await this.runBotTurn({ bot, chatId, text, kind: group ? 'group' : message.kind ?? 'private' }); + // The retry answers the same request, so the input it belongs to is delivered now. Without + // this the user's line keeps the failed badge the first attempt set, and reads as "not sent" + // next to a reply that did arrive. + if (result.accepted && message.sourceMessageId) { + const history = await this.store.getMessages(chatId); + const input = history.find((m) => m.id === message.sourceMessageId); + // Only a line that still carries the first attempt's verdict: a later state (a newer + // supplement, a cancel) outranks this retry and must not be overwritten. + if (input && (input.dispatchState === 'failed' || input.dispatchState === 'uncertain')) { + await this.store.updateMessage(chatId, input.id, { dispatchState: 'delivered' }); + this.broadcast({ type: 'message.upsert', chatId, message: input }); + } + } if (!group || result.status !== 'done' || result.pendingQuestion || PASS_RE.test(result.text)) return; const next = this.mentionsIn(result.text, group, bot.id); if (next.length) await this.driveGroup(group, next); diff --git a/plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs b/plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs index f6c660f0..0085b970 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.32' }, + serverInfo: { name: 'minimax-bot', version: '0.7.34' }, instructions: t('mcp.instructions'), }; break; diff --git a/plugins/minimax-ai/minimax-bot/package.json b/plugins/minimax-ai/minimax-bot/package.json index acc9773b..402077f4 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.32", + "version": "0.7.34", "private": true, "type": "module", "mcode": { diff --git a/plugins/minimax-ai/minimax-bot/tests/engine-reliability.test.mjs b/plugins/minimax-ai/minimax-bot/tests/engine-reliability.test.mjs index 629d583e..024cf793 100644 --- a/plugins/minimax-ai/minimax-bot/tests/engine-reliability.test.mjs +++ b/plugins/minimax-ai/minimax-bot/tests/engine-reliability.test.mjs @@ -1385,3 +1385,32 @@ test('a failed save in the schedule tick is reported, not thrown as an unhandled engine.dispose(); await store.writeChain.catch(() => {}); }); + +test('a successful retry marks the request it answered as delivered', async (t) => { + const { store, engine } = await fixture(t); + const bot = store.state.bots[0]; + const chatId = `bot:${bot.id}`; + engine.agent = { async run(input, options) { + return { ...started(input, options, 'retry-reply'), status: 'finished', text: 'The answer' }; + } }; + // The first attempt failed and left its verdict on the user's line. + const user = await store.appendMessage(chatId, { + role: 'user', text: 'Do the thing', clientMessageId: 'retry-1', + clientMessageHash: engine.userMessageFingerprint('Do the thing', []), dispatchState: 'failed', + }); + const failed = await store.appendMessage(chatId, { + role: 'bot', botId: bot.id, text: '', status: 'error', sourceMessageId: user.id, + retryable: true, retryInput: 'Do the thing', errorCode: 'agent_unavailable', + }); + await store.writeChain; + + await engine.retryMessage(chatId, failed.id); + await until(() => idle(engine)); + await new Promise((resolve) => setTimeout(resolve, 60)); + + // The retry answered the same request, so its line is delivered now, not still "not sent". + const input = (await store.getMessages(chatId)).find((message) => message.id === user.id); + assert.equal(input.dispatchState, 'delivered'); + engine.dispose(); + await store.writeChain; +});