fix: 任务结束后清理旧 agent 进程,避免跨轮累积 - #331
Merged
MistEO merged 1 commit intoAug 26, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
你好——我已经审阅了你的更改,看起来很棒!
帮助我变得更有用!请对每条评论点击 👍 或 👎,我会利用这些反馈来改进审查结果。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ocsin1
approved these changes
Aug 25, 2026
Contributor
|
@zmdyy0318 佬可以看看这个 |
This was referenced Aug 25, 2026
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.
问题(#329)
每次 startTasks 都会无条件 spawn 新的 agent 子进程,任务结束后旧进程不回收,导致:
改动
handle_task_callback:实例内全部任务结束后(all_done)调用stop_agent_impl清理本实例的旧 agentstop_agent_impl:disconnect()改为同步执行,修复"旧 agent 反注册晚于新 agent 注册、误删新 agent 的 custom 条目"的竞态;子进程收尾保留超时强杀兜底,避免泄漏为什么是"清理"而不是"复用"(与 #330 的区别)
下游还有大量不同开发者维护的 MaaXXX 类似项目
它们的功能都是基于这个 每次运行新开进程 的实际行为上开发、测试、发布出来的
由于长期无人发现此问题,这个 bug 事实上可能已经成了结构设计的一部分
如果真的进行改动(复用已有 agent ),无法确认下游其他项目是否会出现某些功能依赖此 bug 而导致完全不可用的情况
所以 cleanup 旧的 agent 是对当前状况下保证向后兼容的最小修复
本 PR 在保留当前事实语义的情况下清理旧 agent 进程,不影响兼容性
Sourcery 总结
在任务全部结束时清理 agent 资源,防止跨轮累积并确保新旧 agent 注册状态一致。
错误修复:
功能增强:
Original summary in English
Summary by Sourcery
在任务全部结束时清理 agent 资源,防止跨轮累积并确保新旧 agent 注册状态一致。
Bug Fixes:
Enhancements: