Repository navigation
fix(maintenance): 自动更新时官方最新版就是当前版本则跳过重装 - #2570
Merged
deepcoldy merged 2 commits intoOct 30, 2026
Merged
Conversation
nengqi
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 30, 2026 02:24
Owner
|
你好,这个 PR 的自动评审群已建。自动拉群暂时没找到你的飞书信息,麻烦把 GitHub 账号和飞书信息补进名单文档,补好后我们会拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
Owner
|
更正上一条:已经把你拉进这个 PR 的评审群「pr 2570 自动更新同版本跳过重装」了,评审意见会在群里和这里同步。 (本条为自动流程发出的提示消息) |
Owner
|
已合并,感谢修复!根因实测(临时 prefix 复现同版本重装改写二进制)、严格全等而非版本号比较、以及对定时 tick 与查询在途交叠的处理都很扎实。 评审中记录了 4 条不阻断的后续改进,已汇总到 #2583:
再次感谢,欢迎继续贡献。 |
deepcoldy
pushed a commit
to uestcwangci/botmux
that referenced
this pull request
Oct 30, 2026
…ity-recovery-2473-final 五次同步 master(eb4311607..4896715,9 提交,含 deepcoldy#2563 真机沙盒跑道/deepcoldy#2547 沙盒 四修/deepcoldy#2577 herdr 认窗格/deepcoldy#2522 失效终端入口/deepcoldy#2558 白名单沙盒/deepcoldy#2552 会话控制 页精简/deepcoldy#2570 自动更新跳过/deepcoldy#2537 沙盒文档/deepcoldy#2580 Pi 恢复复制)。与本 PR 仅 worker-pool.ts / worker.ts 文件交集(deepcoldy#2547/deepcoldy#2522/deepcoldy#2558),git 自动合并干净、 无冲突标记;PR 关键接线(codexAppTurnFailureCode 四处、!turn.error 守卫、 pool 恢复落账、worker 签名 final 失败字段、Pi boot 20s 预算)逐处 grep 仍在 原位。合并树 build 过、codex 集成/容量/engine/deployment 243 项 vitest 绿、 容量 30 + Pi argv 1 项 bun 绿。 Co-Authored-By: Claude Code <[email protected]>
This was referenced Oct 30, 2026
|
@nengqi @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 e93ebf9…9b5544155(12 个提交),同批合入的还有 #2562 #2514 #2558 #2537 #2522 #2552 #2580 #2577 #2547 #2563 #2540,失败不一定由本 PR 引起。
|
This was referenced Oct 30, 2026
|
🚀 Released in v3.56.0 |
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.
现象
macOS arm64,npm 全局安装的编译版(
botmux-darwin-arm64),3.55.0,maintenance.autoUpdate和autoRestart都开着。某天 04:45 的定时自动更新照常执行npm install -g botmux@latest,官方最新仍是 3.55.0,日志只有一行auto-update: already on the latest version,守护进程没有重启;但磁盘上的node_modules/botmux/node_modules/botmux-darwin-arm64/botmux被重写了一遍(修改时间变成 04:45:15)。之后新起的会话全部秒退:Worker forked后十几毫秒打出error: An unknown error occurred (Unexpected)、Worker process exited (code: 1),话题里收到「会话启动失败:worker 在就绪前退出」。手动重启守护进程后恢复。根因
npm 同版本重装不是空操作。在临时 prefix 里实测(npm 11.19.0):先装
[email protected],再装botmux@latest(仍是 3.55.0),输出changed 170 packages,编译版二进制的 inode 和修改时间都变了。src/core/maintenance.ts的自动更新先装、再比版本号,只有版本号变了才重启:同版本重装时
after === before,不重启,但运行中的守护进程和磁盘上被重写的文件已经对不上。worker 起不来,我们推测是因为这个不一致;实测只确认了文件被重写,没有拆出更底层的原因。改法
定时更新那一轮,在安装之前先查官方
latest。和当前版本精确相等就跳过安装,不碰磁盘上的文件,也就不需要重启。日志记auto-update: already on the latest version (X), install skipped。null)照旧安装,行为和改之前一样。运行的是别的版本(比如 canary)时,也照旧安装。applyStandaloneUpdate返回already_latest),而且它先查公共源;如果在这里用配置的镜像判断,镜像落后时会误跳过一次真更新。runMaintenanceTick保持同步。只在startMaintenance的每分钟 tick 里,当autoUpdateDueNow(deps)为真(这一轮真要跑更新)时,才await fetchLatestVersion()(现成函数,默认 8 秒超时)。结果通过新加的可选依赖latestVersion()传进去。查版本期间守护进程如果被停掉(timer已清),就不再跑这一轮。没有采用「装完发现二进制变了就重启」:npm 每次同版本重装都会改写文件,那样会让包管理器安装的编译版用户在每个没有新版的夜里都重启一次,重启报告还会显示
v3.55.0 → v3.55.0。影响面
src/core/maintenance.ts,即主 daemon 的每日自动更新;不涉及 CLI 适配器、IM、会话类型。latest依赖 npm 配置的 registry,和npm install同源;pnpm / bun 用自己的 registry 配置时,如果查到的值落后,当天会少装一次,第二天照常装。dashboard 的版本提示也基于同样的假设。botmux update的包管理器分支同版本时仍会重装,本 PR 不动。测试
新增用例:
autoUpdateDueNow:到点为真,并且不写状态;关闭、无配置、今天已处理、未到点、过了宽限时间,都为假。变异复验:
compareVersions ≤ 0就跳过:canary 那条变红。周期 tick 和长操作交叠:用真实的
runMaintenanceTick/autoUpdateDueNow,加手动控制的 fetch,模拟两轮 tick 重叠。同版本场景update=0, restart=0;有新版场景update=1, restart=1。原因是第一轮同步地先标记当天,第二轮进来时已判为处理过。startMaintenance里的三行异步包装没有单独的单测,由这个探针覆盖。本地验证:
在 Linux 开发机上跑,bun 1.4.3,代码快照 tree 389b0c05,和本分支一致。
bun install --frozen-lockfilebun run buildbun run workflow-core:testbun run typecheck:scripts/typecheck:test-mocksbun run test:bun:self-checknpx vitest run test/maintenance.test.tsbun run test(全量)bun run test:bun全量里失败的文件:
devbox-dashboard-export、ipc-current-execution-route、traex-auto-model-worker、traex-input-delivery-evidence.integration、worker-codex-app-turn-routing.integration、worker-riff-env.integration;bun 套件另有program-status-relay。maintenance.ts和它的测试换回 master 版本,单跑这 6 个文件,结果一样(20 失败 / 287 通过)。devbox-dashboard-export期望LARK_APP_SECRET为空,但开发机的~/.botmux/.env里有真值,被读了进来。🤖 Generated with Claude Code