Skip to content

fix(minimax-bot): 取消父任务时关闭子批次,不再永久泄漏 - #188

Merged
MyPrototypeWhat merged 1 commit into
MiniMax-AI:mainfrom
Apageoflove:fix/cancel-child-batch
Dec 4, 2026
Merged

MyPrototypeWhat merged 1 commit into
MiniMax-AI:mainfrom
Apageoflove:fix/cancel-child-batch

Conversation

@Apageoflove

@Apageoflove Apageoflove commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

父任务可以等一个子批次。取消父任务时,子任务也被取消了,但子批次自己的通知状态还停在 pending。pending 的批次算活跃批次,所以它永远不会被裁掉 —— 每取消一次委派,状态文件里就多留一个活批次。

还有一个原因让它永远裁不掉:父任务对这个子批次的依赖也停在未消费状态。父任务已经被取消,不会再消费它,而 batchActive() 会把“父任务还欠着这个依赖”的批次算作活跃。

实测 40 次取消之后:

live taskBatches in state.json = 70
archived records                 = 10
batches stuck in notification=pending = 40
get_tasks: notification = pending | complete = true

也就是 complete=true 却又 notification=pending,自相矛盾。释放占用的聊天再等 2 秒,40 个批次还是活跃的,不会自己收口。

改了两处。取消依赖时,让子批次走已有的投递收口路径;那条路径本来就会把“父任务已取消”的批次标成 posted。同时把这个依赖标为已消费 —— 取消已经回答了它,不再欠着。这样 batchActive() 的两个判据都能正常结束,批次可以按原有规则归档。

同一个 40 轮探针,改后是:

live taskBatches in state.json = 30
archived records                 = 50
batches stuck in notification=pending = 0
get_tasks: notification = posted | complete = true

测试加了三条:父任务取消后子批次不再 pending 且不再活跃;查询不再自相矛盾;状态文件里不会留下“通知还是 pending、任务却已全部结算”的批次。三条在未改的 main 上都是红的,失败点都是等不到子批次关闭。全量 443 条过。

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

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


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

Copy link
Copy Markdown
Collaborator

#184(0.7.41)合入后,这条和当前 main 有真实合并冲突,冲突在版本号和 README 的版本说明插入位置。请把这个分支 rebase 到当前 main,不要把 main merge 进工作分支。后面的 #189、#190 也请按 0.7.44 → 0.7.45 → 0.7.46 的顺序依次 rebase。新头需要重新审查。

Copy link
Copy Markdown
Collaborator

这条现在和当前 main 有真实合并冲突,暂时不能合。#187(minimax-bot 0.7.43)已 squash 合入。请现在把本条 rebase 到当前 main 并推送。不要把 main merge 进工作分支,也不要用 GitHub 的 Update branch 按钮,那会把 main merge 进分支。#189、#190、#194 请等前一条合入后,再依次 rebase 到那时的 main,不要现在就和本条一起独立 rebase 到当前同一条 main。

@Apageoflove
Apageoflove force-pushed the fix/cancel-child-batch branch from 802a6ff to 21d7da3 Compare December 4, 2026 10:42
@MyPrototypeWhat
MyPrototypeWhat merged commit 655fdf6 into MiniMax-AI:main Dec 4, 2026
2 checks passed
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