Skip to content

fix(minimax-bot): 重启后已完成的回复不再把请求判成待确认 - #190

Open
Apageoflove wants to merge 1 commit into
MiniMax-AI:mainfrom
Apageoflove:fix/restart-done-delivery
Open

Apageoflove wants to merge 1 commit into
MiniMax-AI:mainfrom
Apageoflove:fix/restart-done-delivery

Conversation

@Apageoflove

@Apageoflove Apageoflove commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

请求在回合开始前被标成 processing。如果进程在回复已经落盘、但 inbox 还没写下投递结果时退出,重启恢复只看“有没有关联回复”,有就标成 uncertain,不看回复到底是什么状态。

于是一条已经正常完成的回复也会把请求标成待确认。后续消息被这个 uncertain 闸门挡住,永远停在 held。

实测同一个崩溃窗口:

改前:
userDispatchState: 'uncertain'
replyStatus: 'done'
later request: { dispatchState: 'held', hostRuns: 0 }

改后:
userDispatchState: 'delivered'
replyStatus: 'done'
later request: { dispatchState: 'delivered', hostRuns: 1 }

引擎的重试路径本来就有更窄的规则:只有 interrupted、streaming 或 AGENT_OUTCOME_UNKNOWN 才算结果未知。重启恢复现在和它共用同一个判定函数,两处不会再各写一套。

恢复规则变成:关联回复结果未知 → uncertain;有回复且结果已知 → delivered;没有回复 → pending。adjusting 仍按原规则变成 held。

测试加了一条:磁盘上留下 processing 的用户消息和 done 的助手回复,重启后请求必须是 delivered,并且下一条消息能真正跑到 Host。这条在未改的 main 上是红的。全量 441 条串行通过。

版本号 0.7.46。当前 main 是 0.7.40;前面还有 #184(0.7.41)、#172(0.7.42)、#187(0.7.43)、#188(0.7.44)、deleteSchedule 修复(0.7.45),按这个顺序合。

验证范围:只有 Node 22 上的测试是实测的。真实 Host 和 Electron 我没跑过 —— 这一层是仅个人判断。


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@MyPrototypeWhat MyPrototypeWhat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

谢谢这次 minimax-bot 的重启恢复修复。现头 a2fee217 还不能合。

作者要修的 processing + done 窗口是对的,但恢复规则过宽。loadMessages 现在把「有关联回复、且不是 interrupted / streaming / AGENT_OUTCOME_UNKNOWN」都标成 delivered,不限于 status 为 done 的回复。因此 processing 的用户请求配上 status 为 error、errorCode 为 ETIMEDOUT 的回复,也会走这条路径。

活路径里,回复会先由 updateMessage 落盘,inbox 随后才写投递终态。Host 已经接手后再抛错时 safeToContinue 是 false,ETIMEDOUT 也不在可继续的错误码里,所以 inbox 会把请求写成 uncertain。如果进程停在这两步之间,当前实现会在重启后把请求标成 delivered,并放行后面的消息;现有 main 会停在 uncertain。

新测试只覆盖了 processing + done。请把 delivered 收窄到真正完成的回复(例如只对 status 为 done 的回复),并补上 processing + error/ETIMEDOUT 仍为 uncertain、后续请求保持 held 的测试。

请更新这个分支,我们再看新头。

@Apageoflove
Apageoflove force-pushed the fix/restart-done-delivery branch from a2fee21 to 7374308 Compare December 2, 2026 07:14
@Apageoflove

Copy link
Copy Markdown
Contributor Author

按你说的收窄了,在 7374308。

判据过宽这条你说得对,而且比我说的还宽。我量了一遍改之前的实际行为:

processing + done                      -> delivered
processing + error/ETIMEDOUT           -> delivered   <- 应该是 uncertain
processing + error/AGENT_UNAVAILABLE   -> delivered   <- 应该是 uncertain
processing + error/no code             -> delivered   <- 应该是 uncertain
processing + pass                      -> delivered
processing + no reply                  -> delivered   <- 应该是 pending

四种失败回复都被我判成了「已送达」,后面几条全放行。

现在按回复自己的状态分三档,每一档都跟活路径写出来的那个一致:

  • 回复 status 是 done 或 pass -> delivered。pass 是 Bot 明确表示没有补充,那一轮结束了,活路径写的也是 delivered。
  • 回复 status 是 error 或 interrupted -> uncertain。Host 可能已经接手才失败的,没人能说清有没有答过,后续消息继续等。
  • 回复带 retryInput -> failed。这个字段只在 Host 根本没接手时才写(engine.mjs:872),所以它就是「这一轮压根没跑」的确证,请求仍然是用户可以重发的。活路径写的也是 failed。
  • 没有回复 -> pending。

第三档是我加的:失败回复一律判 uncertain 的话,Host 根本没接手的那些也会被 uncertain 卡住后续消息 —— 那正是这条要修的病。

测试补了两条。一条是 processing + error/ETIMEDOUT 之后重启,请求仍是 uncertain,下一条消息仍是 held、没有走到 Host。另一条是 processing + 带 retryInput 的失败回复,重启后请求是 failed,下一条消息能正常跑。

第一条在未改的 main 上是绿的 —— main 本来就把一切都判 uncertain,那条是防回归的护栏,不是判别力的来源。判别力来自另外两条和那个八种情况的对照探针。

版本号仍是 0.7.46。

@MyPrototypeWhat MyPrototypeWhat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

谢谢这次 minimax-bot 的重启恢复修复。上一轮那个没有 retryInput 的 ETIMEDOUT 被标成 delivered 的问题,在现头 7374308c 已经不在,但还不能合。这次新规则又引入了两处问题。

带 retryInput 的 ETIMEDOUT,重启恢复会变成 failed,下一条会跑。活路径里同样情况,inbox 写的是 uncertain。

同一请求上已经有 done / pass、同时又有未知回复时,some(replyDelivered) 会先把请求标成 delivered。

请改这两处恢复规则。另外,README 的 ## 0.7.46 还插在 0.7.39 和 0.7.40 之间,请挪到 0.7.40 之后。

另外一条是备注,不是这次不能合的理由:README 写恢复和重试用同一套谓词,实际却分成了两套。

请更新这个分支,我们再看新头。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants