Repository navigation
fix(minimax-bot): 卡住的会话能放行,停掉的后台任务立刻不再显示执行中 - #157
Open
Apageoflove wants to merge 1 commit into
Open
Apageoflove wants to merge 1 commit into
Apageoflove wants to merge 1 commit into
Conversation
This was referenced Nov 25, 2026
Apageoflove
force-pushed
the
fix/minimax-bot-unblock-chat
branch
from
November 25, 2026 08:49
9430ec2 to
b71a733
Compare
Apageoflove
force-pushed
the
fix/minimax-bot-unblock-chat
branch
from
November 25, 2026 09:50
b71a733 to
14998a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
两个症状,都是插件的状态没有告诉用户:
一、一个会话被「结果未知」卡住之后,就再也发不出东西了,而且按暂停、重启 Mini App 都解不开。
卡住是怎么来的。回合在途的时候进程停了,启动时 store 会把在途的用户消息重置:adjusting 变成 held,processing 而且已经有半条回复的变成 uncertain,只有 processing 而没有回复的才变成 pending。前两种都是解不开的状态 —— 插件不会自动重放它们,因为那一轮可能已经跑过工具了。
然后 inbox 的 enqueue 有一道闸门:历史里只要还有一条 held、adjusting 或还没确认的 uncertain,这一轮就整个变成 held,直接返回。于是后面每一条新消息都排在那条后面,一条都不会跑,Agent 一次都不被调用。
问题在于出口是断的。页面给 held 的消息画「继续处理补充」按钮,给重启遗留的 pending 也画,但 uncertain 那条没有按钮;而服务端那个续跑接口第一道关是 if (!held.length) throw busy,所以只有一条 uncertain 的会话点哪儿都没用 —— 那句确认 uncertain 的代码本来就写在 throw busy 后面,永远走不到。同一条消息用同一个 id 重发又会被 delivery_uncertain 挡掉。
实测是这样:
唯一能走通的是「再发一条新消息」(它会变成 held,于是带上了按钮),再点那个按钮。没有人会想到这一步。
改了两处。服务端:会话里只有没确认的 uncertain 时不再抛 busy,改为确认它然后放行 —— 确认只是承认「我看到了」,那一轮本身仍然不重发。客户端:uncertain 的消息也画同一个按钮,页面得在带着这个状态的那条消息上给出路,不然用户不知道这个会话卡在哪。
确认之后,之前排在后面的 held 消息照常发出去,uncertain 那条保持 uncertain 不变。
二、后台任务的停止按钮按下去像没按。
stopHelper 对正在跑的任务只做两件事:记下是谁按的、把控制器的 abort 打了出去。任务的 status 一直等到那个回合真的结束才改成 stopped。宿主是在两步之间结束一个回合的,所以一个卡在长时间工具调用里的任务,按完停止之后还会继续显示「执行中」—— 用户看起来就像没按动,能想到的最后一个办法就是强制退出整个应用。
实测:按停止之后接口回 {"stopped": true, "status": "stopped"},而任务记录里的 status 还是 running,界面上显示的就是「执行中」。
改成按停止的那一刻就把任务标成 stopped 并存盘、广播出去。回合照样在后台收尾,变的是页面不再骗人。abort 还是发给同一个回合,已经停掉的或已经结束的任务不动。
测试加了四条:服务端三条、客户端一条 —— 一条是只有 uncertain 的会话能被放行、后面那条新请求真的跑了;一条是排队的补充在确认之后被发出去;一条是正在跑的任务按停止之后立刻不再显示 running;客户端那条断言 uncertain 的消息上有按钮、点了会调续跑接口。其中三条在未改的 main 上是红的。全量 431 条过。
版本号 0.7.38。0.7.37 在 #148 上还开着。
验证范围:只有 Node 22 上的测试是实测的。真实 Host 和 Electron 我没跑过 —— 这一层是仅个人判断。