Skip to content

Commit c58898c

Browse files
committed
fix(minimax-bot): 重试成功之后清掉那条未送达标记
一条用户消息第一次投递失败时被标成 failed,页面显示「未送达」。用户点重试 成功后,回复来了,可原消息的 dispatchState 没人再改,永久停在 failed —— 于是聊天里一条已到的回复旁边挂着一条「未送达」。 retryMessage 的 run 闭包里补一步:回合被宿主接受后,把 message.sourceMessageId 指向的那条用户消息改成 delivered 并广播。只改仍带第一次失败判定的那些, 后来的操作写下的状态不动。 新测试在 0.7.28 上红、在切片上绿。全量 414 条通过。
1 parent 28d4388 commit c58898c

6 files changed

Lines changed: 50 additions & 3 deletions

File tree

‎plugins/minimax-ai/minimax-bot/.minimax-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"schemaVersion": 1,
33
"name": "minimax-bot",
44
"displayName": "MiniMax Bot",
5-
"version": "0.7.31",
5+
"version": "0.7.34",
66
"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.",
77
"author": "MiniMax Code",
88
"icon": "icon.png",

‎plugins/minimax-ai/minimax-bot/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ The hand-over between two Bots of a group carried the tail of the previous reply
111111
- The page now offers the same **Continue with follow-ups** button for it, and the resume route accepts it, so the request can be sent again. Nothing is replayed on its own: the turn may already have run tools before the process stopped, so sending it again stays the user's decision.
112112
- A request whose reply had already started is unchanged, and a request this page has just sent never offers to resume itself.
113113

114+
## 0.7.34 A retry that succeeds clears the "not delivered" line it answers
115+
116+
- 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.
117+
- 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.
118+
114119
## 0.7.10 Optional group notes
115120

116121
- 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.

‎plugins/minimax-ai/minimax-bot/miniapp/node/engine.mjs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,19 @@ export class Engine {
14821482
this.broadcast({ type: 'message.upsert', chatId, message });
14831483
const run = async () => {
14841484
const result = await this.runBotTurn({ bot, chatId, text, kind: group ? 'group' : message.kind ?? 'private' });
1485+
// The retry answers the same request, so the input it belongs to is delivered now. Without
1486+
// this the user's line keeps the failed badge the first attempt set, and reads as "not sent"
1487+
// next to a reply that did arrive.
1488+
if (result.accepted && message.sourceMessageId) {
1489+
const history = await this.store.getMessages(chatId);
1490+
const input = history.find((m) => m.id === message.sourceMessageId);
1491+
// Only a line that still carries the first attempt's verdict: a later state (a newer
1492+
// supplement, a cancel) outranks this retry and must not be overwritten.
1493+
if (input && (input.dispatchState === 'failed' || input.dispatchState === 'uncertain')) {
1494+
await this.store.updateMessage(chatId, input.id, { dispatchState: 'delivered' });
1495+
this.broadcast({ type: 'message.upsert', chatId, message: input });
1496+
}
1497+
}
14851498
if (!group || result.status !== 'done' || result.pendingQuestion || PASS_RE.test(result.text)) return;
14861499
const next = this.mentionsIn(result.text, group, bot.id);
14871500
if (next.length) await this.driveGroup(group, next);

‎plugins/minimax-ai/minimax-bot/miniapp/node/mcp.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ export function createMcpHandler({ team, engine }) {
662662
result = {
663663
protocolVersion: PROTOCOL_VERSIONS.includes(requested) ? requested : PROTOCOL_VERSIONS[0],
664664
capabilities: { tools: { listChanged: false } },
665-
serverInfo: { name: 'minimax-bot', version: '0.7.31' },
665+
serverInfo: { name: 'minimax-bot', version: '0.7.34' },
666666
instructions: t('mcp.instructions'),
667667
};
668668
break;

‎plugins/minimax-ai/minimax-bot/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "minimax-bot",
3-
"version": "0.7.31",
3+
"version": "0.7.34",
44
"private": true,
55
"type": "module",
66
"mcode": {

‎plugins/minimax-ai/minimax-bot/tests/engine-reliability.test.mjs‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,3 +1319,32 @@ test('a resume that loses the race to a same-id retry does not send the request
13191319
engine.dispose();
13201320
await store.writeChain;
13211321
});
1322+
1323+
test('a successful retry marks the request it answered as delivered', async (t) => {
1324+
const { store, engine } = await fixture(t);
1325+
const bot = store.state.bots[0];
1326+
const chatId = `bot:${bot.id}`;
1327+
engine.agent = { async run(input, options) {
1328+
return { ...started(input, options, 'retry-reply'), status: 'finished', text: 'The answer' };
1329+
} };
1330+
// The first attempt failed and left its verdict on the user's line.
1331+
const user = await store.appendMessage(chatId, {
1332+
role: 'user', text: 'Do the thing', clientMessageId: 'retry-1',
1333+
clientMessageHash: engine.userMessageFingerprint('Do the thing', []), dispatchState: 'failed',
1334+
});
1335+
const failed = await store.appendMessage(chatId, {
1336+
role: 'bot', botId: bot.id, text: '', status: 'error', sourceMessageId: user.id,
1337+
retryable: true, retryInput: 'Do the thing', errorCode: 'agent_unavailable',
1338+
});
1339+
await store.writeChain;
1340+
1341+
await engine.retryMessage(chatId, failed.id);
1342+
await until(() => idle(engine));
1343+
await new Promise((resolve) => setTimeout(resolve, 60));
1344+
1345+
// The retry answered the same request, so its line is delivered now, not still "not sent".
1346+
const input = (await store.getMessages(chatId)).find((message) => message.id === user.id);
1347+
assert.equal(input.dispatchState, 'delivered');
1348+
engine.dispose();
1349+
await store.writeChain;
1350+
});

0 commit comments

Comments
 (0)