feat(pipeline): run_pipeline/benchmark_node 支持单次 pipeline_override 与工具侧 timeout_seconds - #39
Open
qiyinxi wants to merge 1 commit into
Open
feat(pipeline): run_pipeline/benchmark_node 支持单次 pipeline_override 与工具侧 timeout_seconds#39qiyinxi wants to merge 1 commit into
qiyinxi wants to merge 1 commit into
Conversation
…具侧 timeout_seconds 单节点验证此前有两个工具侧缺口:没有「只截 ROI 区域验证」的参数(收紧 roi 只能改 pipeline 文件),且 run_pipeline 在 task_job.wait() 上无限阻塞 (识别不命中的节点烧满默认 20s 超时,MCP 调用只能干等)。 - run_pipeline 新增 pipeline_override:字段级节点覆盖直传 Tasker.post_task(entry, override)(与 interface.json 同机制),单次生效 不污染 Resource;未知节点名进 warnings 帮助发现拼写错误 - run_pipeline 新增 timeout_seconds:轮询 + 超时 post_stop(),返回 status="timeout" 与超时前已执行的部分节点详情;被 stop 的任务自身 status 会被 MaaFramework 标记为 succeeded,故显式报 timeout 不信任它; 拒绝 NaN/inf(JSON 层放行但会让 deadline 永不触发) - benchmark_node 新增 pipeline_override:调参循环免改文件试 roi/threshold; 拒绝覆盖 entry/node 的 next 以保护隔离链路 - 纯函数/假件单测 49 例 + DbgController 端到端 3 例(DLL 门控) - 同步 CLAUDE.md / CLAUDE_CN.md / README.md / README_EN.md Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
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.
动机
单节点验证目前有两个工具侧缺口(Everything-Maa 的 maa-pipeline-testing skill 把它记成了「单节点验证的工具限制」,只能靠工作流绕过):
roi只能改 pipeline 文件再重新保存;不改就得忍受整屏 OCR 慢扫。run_pipeline在task_job.wait()上无限阻塞。识别不命中的节点会烧满自己的timeout(默认 20s),MCP 调用只能干等,客户端超时后连诊断信息都拿不到。改动
run_pipeline新增pipeline_override(可选,默认 None)单次运行的字段级节点覆盖,直接传给
Tasker.post_task(entry, pipeline_override)(与 interface.json 的pipeline_override同机制):warnings提示(拼错节点名时覆盖会静默不生效,这是最常见的踩坑点;但不阻断——它也可能是 bundle 里的节点或新增节点)run_pipeline新增timeout_seconds(可选,默认 None = 保持旧行为)轮询任务状态,超时调
tasker.post_stop()主动停止,返回结构化结果:status="timeout"、success=false、error说明原因与排查建议nodes携带超时前已执行的部分节点详情,方便定位挂在哪个节点"timeout",不信任detail.statusNaN/Infinity/1e400,而deadline = monotonic() + NaN会让超时分支永远不触发——静默禁用超时还带 CPU 空转轮询(多智能体对抗评审发现并实测确认)benchmark_node新增pipeline_override(同语义)调参循环(issue #36 item #4)里免改文件试
roi/threshold,确定后再写回 pipeline JSON。也可用{"节点": {"timeout": 2000}}压缩未命中时的单次迭代耗时。为保护 benchmark 的 entry → node → done 隔离链路,覆盖 entry / node 的next会直接报参数错误。语义验证
用 maafw 5.8.1 + CustomController(黑屏 + 白块假屏幕)实测确认:
测试
tests/test_pipeline_override_timeout.py(新增,49 个用例):参数校验、_wait_task_with_timeout轮询/超时路径、run_pipeline 透传与超时返回结构、benchmark_node 保护与 warnings 序列化——全部纯函数 + 假件,不依赖 maafw 运行时tests/test_dbg_pipeline.py(扩展,3 个用例):DbgController 端到端——override 翻转识别结果、超时停止挂死节点、无害覆盖不影响成功。与现有用例一样由MaaDbgControlUnitDLL 门控(当前 maafw wheel 未打包该 DLL 时自动 skip)向后兼容
None,不传时行为与现在完全一致(post_task(entry, {})与post_task(entry)等价,maafw 默认值就是{})status取值"timeout"(仅在显式传timeout_seconds时可能出现);BenchmarkRunResult只在非空时序列化warnings(与PipelineLoadResult的省略风格一致)🤖 Generated with Claude Code
Sourcery 摘要
通过支持按运行覆盖节点配置和有界执行时间,实现更快速、更安全的单节点流水线验证。
新功能:
run_pipeline和benchmark_node添加按运行的pipeline_override支持,无需修改流水线文件即可调整节点级参数。run_pipeline添加可选的工具侧timeout_seconds处理,并提供结构化的超时结果和部分节点诊断信息。Bug 修复:
增强功能:
next字段,保护 benchmark 的入口和目标隔离。文档:
测试:
Original summary in English
Summary by Sourcery
Enable faster and safer single-node pipeline verification by supporting per-run node overrides and bounded execution time.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: