Repository navigation
fix(skills): caption and map scripts never fall back to the installed Chrome, and close it cleanly - #5918
Open
JimmySadek wants to merge 1 commit into
Open
fix(skills): caption and map scripts never fall back to the installed Chrome, and close it cleanly#5918JimmySadek wants to merge 1 commit into
JimmySadek wants to merge 1 commit into
Conversation
… Chrome, and close it cleanly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
The embedded-captions scripts and the motion-graphics map baker only launch a
chrome-headless-shell, never the installed Google Chrome app, and close it without killing it.Why
When
hfBrowser()(from #5900) can't reach a CLI, it silently uses/Applications/Google Chrome.app. That happens when skills are installed withskills experimental_installinto a project that hashyperframesonly innode_modules/.bin:hfCli()throws, andhyperframesis not onPATH. With no cached shell,hyperframes browser pathalso prints the system Chrome.On macOS, each run of the Chrome app that does not end with
browser.close()leaves acom.google.Chrome.code_sign_clonefolder of about 1.4 GB in/private/var/folders/.../X/. On our Macs, both SIGKILL and a plain SIGTERM of Chrome.app left one. Onlybrowser.close()(CDPBrowser.close), or a binary outside an app bundle such aschrome-headless-shell, is safe.These scripts kill Chrome on two paths:
process.exit()inside thetrythat owns the browser:measure-layout.cjs("timeline never registered") andcheck-rail-climax.cjsok()/fail(), including the render-blocking duplicate-word fail. Exiting skipsfinally, and Puppeteer's exit handler then SIGKILLs Chrome.measure-layout.cjs,check-rail-climax.cjsandpreview-frames.cjsgives up and leaves Chrome running until the process exits.bake-basemap.mjshas its own lookup that ignoresHYPERFRAMES_BROWSER_PATH, sorts cached shells by name, and ends with/Applications/Google Chrome.app.Related work
Refs #5900.
How
embedded-captions/scripts/hf-cli.cjshfBrowser()order:HYPERFRAMES_BROWSER_PATH, if executable. No subprocess.hyperframes browser pathprints, asked throughhfCli(), then eachnode_modules/.bin/hyperframesup from the working folder and the script folder (each binary once), thenhyperframesonPATH(30 s timeout each).chrome-headless-shellin~/.cache/hyperframes/chrome, then~/.cache/puppeteer, sorted by version.npx hyperframes browser ensure, or set HYPERFRAMES_BROWSER_PATH to a chrome-headless-shell binary."chrome-headless-shell, so the system Chrome the CLI prints with an empty cache is skipped.closeBrowser(browser, ms = 5000): racesbrowser.close()against 5 s, then SIGKILLs the browser process only if it is still alive.measure-layout.cjs,check-rail-climax.cjs: throw instead ofprocess.exit()inside the browsertry;.catch()exits with the same codes (measure 4, rail-climax 0 / 2).finallycallscloseBrowser().preview-frames.cjs,check-overflow.cjs:finally, and check-overflow's inconclusive early return, callcloseBrowser().motion-graphics/categories/maps/bake-basemap.mjs: lookup isCHROME,HYPERFRAMES_BROWSER_PATH, the newest cachedchrome-headless-shell(by version), then the Linux paths. The/Applications/Google Chrome.appfallback is removed. Close uses the same 5 s race, then SIGKILL.skills-manifest.json: regenerated.Behaviour change: a machine with no
chrome-headless-shelland noHYPERFRAMES_BROWSER_PATHnow gets an error with the install command instead of the installed Chrome.HYPERFRAMES_BROWSER_PATHset to the Chrome app still works.check-rail-climax.cjskeeps its rule that infrastructure never blocks: with no headless shell it skips (exit 0).Test plan
On one macOS arm64 machine. Not run on Linux or Windows.
node --test hf-cli.test.mjs preview-frames.test.mjs render-and-composite.test.mjs→ 10/10 pass, withHYPERFRAMES_BROWSER_PATHunset.code_sign_clonecount did not change.bake-basemap.mjsrun with no env var: exit 0, MP4 written, cached headless shell, 0 left.oxfmt --check,oxlint,scripts/lint-skills.ts,gen-skills-manifest.ts(in sync),check-comment-citations.mjs(one warning on an existing comment, not this diff),comment-ratchet.mjs.🤖 Generated with Claude Code