Repository navigation
Fixes after M1: no browser profile left by Ctrl-C, captions judged as subtitles, a slow Chrome start, an exported CDPATH - #88
Merged
Conversation
… subtitles, a slow Chrome start, an exported CDPATH - browser.mjs: every browser not closed yet is killed with its helpers (Chrome now runs in a process group of its own) and its profile removed when node exits or gets SIGINT, SIGTERM or SIGHUP; a tool with its own handler (bin/vh render) keeps it and the cleanup runs as it exits. Before, Ctrl-C left a ~17 MB profile per browser in the temp folder. - browser.mjs: 60 s for the browser's first answer instead of 30 (a cold start on a busy CI runner once took longer). - readcheck: caption items (zh / en, no text: what bin/vh captions writes) go by the subtitle rule unless --mode names another; bin/vh readcheck <project> judged the narration's captions as on-screen text. - bin/vh: unset CDPATH, which could send the cd that finds the repo to another folder. - CI for all three; playbook/03 and the CHANGELOG.
- browser.mjs: the signal listeners live only while a browser does (armed at launch, removed after the last close), and use process.on: a listener left in place held a Ctrl-C until the event loop turned, so determinism, comparing frames synchronously after its browsers closed, ran on and exited 0 (or a false 1). Now it ends at once with 130, as on main. - browser.mjs: killGroup leaves a Chrome that is already gone alone (its group id may belong to another process by then); a Chrome that never answered is killed with its group, not sent SIGTERM alone. - readcheck: the run's rule is shown as subtitle only when every item is a caption that got the caption default; --mode's help says so. - tools/ci.sh, tools/fetch_media.sh, references/fetch.sh unset CDPATH too. - CI: the Ctrl-C check first sees a browser, then finds no profile and no Chrome; a Ctrl-C while determinism compares must end it with 130. - Comments: render's signal handler and browser.mjs's tool list.
…one Ctrl-C that can drop
ZLHad
marked this pull request as ready for review
October 11, 2026 16:19
ZLHad
enabled auto-merge (squash)
October 11, 2026 16:19
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.
What and why · 改了什么、为什么
M1 合完以后剩下的几个 bug,都是评审或实测时查出来的:
tools/textcheck/browser.mjs):每个 Chrome 有一个约 17 MB 的配置目录,只在正常关闭浏览器时删掉。bin/vh frames、textcheck、determinism、cues被 Ctrl-C、SIGTERM、SIGHUP 打断时 Node 直接退出,目录留在临时文件夹里;bin/vh render有自己的 Ctrl-C 处理,也照样留下(每个 worker 一个)。现在没关掉的浏览器都登记着,Node 退出或收到这几个信号时,连同辅助进程一起杀掉(Chrome 改成单独一个进程组),再删目录。工具自己处理信号的(render),照旧由它处理,它退出时触发清理。bin/vh readcheck <项目>把旁白字幕当屏幕上的字来查:它读的是项目的audio/captions.json,也就是bin/vh captions写的、旁白的原话,却按屏幕字的规则判,除非加--mode subtitle。showcase 02 因此报出 15 条不对路的 FAIL。现在字幕条目(有zh/en、没有text)默认按字幕的规则查,给了--mode就按给的;playbook/03跟着改了说法。CDPATH会让bin/vh找错仓库:bin/vh开头用cd找仓库根目录,按文档的用法(bin/vh …)这是个相对路径。环境里导出了CDPATH、其中某个目录下又正好有bin时,这个cd会跳过去,并把路径多打印一行,凡是要读仓库里文件的命令都会失败。现在先unset CDPATH。English summary. Ctrl-C, SIGTERM or SIGHUP no longer leaves Chrome's ~17 MB profile folder behind (browsers are killed with their helpers in their own process group and their profiles removed on exit or on those signals, while a tool's own handler, as in
bin/vh render, keeps working); the browser gets 60 s for its first answer;bin/vh readcheck <project>judges the project's captions by the subtitle rule unless--modesays otherwise;bin/vhunsetsCDPATH.How it was verified · 怎么验证的
bin/vh render打断两次、bin/vh frames打断一次,都是退出码 130,临时目录里没有配置目录,也没有 Chrome 进程(改之前:render 剩 2 个,frames 剩 1 个)。kill -9掉 Node 以后,Chrome 在 3 秒内因管道关闭自己退出,不留孤儿进程。--mode onscreen照旧按屏幕字查。bin/vh effort standard在这样的CDPATH下报 awk 打不开文件,这个分支正常。--mode仍然说了算;bin/vh在CDPATH下正常;frames被 Ctrl-C 后退出码 130、不留配置目录。tools/ci.sh --committed通过(VH_BASH=/bin/bash,shellcheck、pyflakes 用 uvx 跑)。Not in this PR · 不在这个 PR 里
Checklist · 自查
tools/ci.sh --committedpasses · 通过CHANGELOG.md→ Unreleased · 已记进 CHANGELOGCLAUDE.md→ ranbin/vh sync-agents· 没改 CLAUDE.md