Repository navigation
Conversation
v3 runtime 的三层并发上限只有 global 接到了入口上:perBot 固定为 1, perCli 固定为 2,飞书和 Saved Workflow 跑的 run 都改不了。 - ~/.botmux/config.json 新增 workflow.concurrency:global / perBot / perCli,以及按 CLI 类型单独设置的 perCliById;取值为 1–64 的整数, 非法值忽略 - driveV3Run 每次驱动时读取配置,deps.maxParallel 仍优先于 global - runtime 支持 perCliConcurrencyById,没列出的 CLI 用 perCliConcurrency - botmux v3 run 新增 --max-per-bot / --max-per-cli 单次覆盖,并在启动时 打印实际生效的上限 - 不配置时行为不变;文档补充并发上限说明和 perBot>1 时共享工作目录的风险 Closes deepcoldy#2783 Co-Authored-By: Claude Opus 5.5 <[email protected]>
usingnamespacestc
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
November 4, 2026 13:52
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
Owner
|
已合并,感谢贡献! 有几个不影响本次合入的后续改进点,欢迎感兴趣的话继续提 PR:
|
deepcoldy
pushed a commit
to BanboLee/botmux
that referenced
this pull request
Nov 4, 2026
同步 deepcoldy#2784(并发上限可配置);与本 PR send/riff 零交集,git 自动合并。 落地树 5518442 已双审背书。
|
🚀 Released in v3.57.1 |
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.
Closes #2783
问题
v3 runtime 有三层并发上限(global 4 / perBot 1 / perCli 2),但生产入口只接了 global:
/workflow和 Saved Workflow 都走driveV3Run。daemon.ts没有传maxParallel,所以实际上三层都是写死的默认值,用户什么都改不了。botmux v3 run --max-parallel只映射到 global。portable-runtime.ts的嵌入式 API 能传 perBot / perCli。实际效果:同一个 bot 上的节点只能串行跑(perBot=1);同一种 CLI 最多同时跑 2 个,即使用户配了更多 bot 也是如此。如果 CLI 背后是按量计费的 API、机器内存也够,用户只能改源码,而且每次升级都会被覆盖。
设计文档
docs/design/2026-06-01-next-gen-workflow-design.md(Q5 / R3)写的是「默认保守,可配」。这个 PR 只补上「可配」这一半,默认值不变。(更正 #2783 里的一处描述:
--max-parallel是botmux v3 run的参数,不是botmux workflow run的。)改动
global-config.ts:~/.botmux/config.json新增workflow.concurrency:{ "workflow": { "concurrency": { "global": 16, "perBot": 4, "perCli": 2, "perCliById": { "claude-code": 8 } } } }每个字段都可选。取值必须是 1–64 的整数,非法值在读取时丢弃,上限 64 是为了防止手误起太多 worker。解析结果挂在
readWorkflowFeature上,因此 Dashboard 切换 workflow 开关或 nodeExecutor 时(settings-write-applier会基于解析后的 workflow 块合并),这个字段会被保留。concurrency-config.ts(新增):resolveV3Concurrency(config, overrides),每个字段按「显式覆盖 > 配置 > runtime 代码默认」取值,取不到的字段不输出,交给 runtime 默认值。显式的 perCli 会盖过整张perCliById表,这样--max-per-cli 1对所有 CLI 都生效。shared-node-runtime.ts:新增perCliConcurrencyById,没列出的 CLI 用perCliConcurrency;默认值提成V3_DEFAULT_CONCURRENCY。daemon-run.ts:driveV3Run每次驱动时读取配置(可注入concurrencyConfig,测试用),deps.maxParallel仍优先于配置里的 global。gate、重试、loop / revisit grant、cold attach 等续跑路径都经过driveV3Run,所以都会读到配置。cli-run.ts:botmux v3 run新增--max-per-bot、--max-per-cli,用于单次覆盖;启动时打印一行实际生效的上限,例如全局 16 / 每 bot 4 / 每种 CLI 2(claude-code=8),方便看出并行度被哪一层限制。--max-parallel保持原来的语义(无上限)。文档(zh / en
workflow.md):新增「并发上限」一节,内容包括三层上限的含义和默认值、配置示例、上限按 run 计算,以及 perBot > 1 时同一个 bot 的多个节点会并发读写同一个workingDir的警告。原来写的「默认最多 4 个并发」不准确,一并改掉。影响面:不配置时
resolveV3Concurrency返回{},runtime 行为和之前完全一致。portable-runtime.ts和goal-cli.ts(单节点 DAG)不读配置,行为不变。上限没有冻结进run.json:上限只影响吞吐,不影响正确性;bot 模式下在途的 attempt 每次驱动都会从 ledger 重新计数,调低上限只会让新的派发停下来,不会破坏状态。独立对抗复核
workingDir(ephemeral-pool.ts中 cwd =botSnapshot.workingDir),文档没有提醒applySettingsWriteV3_DEFAULT_CONCURRENCY另外攻击过、确认安全的场景:不配置或全部是非法值时默认值不变;全部续跑路径都读取配置;bot 模式下 perCli 不生效,与文档一致;
perCliById用hasOwnProperty查找,不会命中原型链上的__proto__/constructor;perCliById 设得比 global 大时仍被 global 压住。测试
新增或修改的用例都做了变异复验,去掉对应修复后会变红:
test/v3-concurrency-config.test.ts(新增,12 条):配置解析和非法值丢弃;经过真实 applier 切换enabled/nodeExecutor时配置被保留;优先级合并;CLI 参数校验;启动摘要;runtime 实测各 CLI 的并发峰值(默认 2/2,perCli:1 + perCliById claude-code:5时为 5/1)。test/v3-daemon-run.test.ts(+3 条):通过driveV3Run实测:不配置时同一个 bot 的峰值为 1;配置perBot:4, perCli:4时为 4;配置perCliById时为 3;maxParallel优先于配置的 global。🤖 Generated with Claude Code