fix(cli)!: a proxy that drops the connection fails a request once instead of retrying nonstop (#8311)

* fix(cli): a proxy that drops the connection fails a request once instead of retrying nonstop

Raises the minimum Node.js to 22.19, which undici 8 requires.

* fix(cli): drop the comments the comment-share check refuses

* docs: the engine, producer and CLI skill say Node.js 22.19

* test(engine): the dropping proxy matches its host exactly

* chore(skills): rehash the CLI skill after the merge

* docs(skills): keep the CLI skill within its size budget

* chore(skills): rehash the CLI skill after the trim
This commit is contained in:
Miguel Ángel
2026-11-21 18:05:46 +00:00
committed by GitHub
parent f01d1f32b0
commit 2960319749
31 changed files with 120 additions and 29 deletions
+1
View File
@@ -72,6 +72,7 @@
"packages/cli/src/warmCheckClient.fixture.ts",
"packages/cli/src/browser/chromeOrphans.fixture.ts",
"packages/cli/src/capture/publicNetwork.fixture.ts",
"packages/cli/src/registry/envProxy.fixture.ts",
"packages/cli/src/utils/commandResult.fixture.ts",
"packages/studio-server/src/routes/recoveryDrafts.fixture.ts",
// Test fixture worker, spawned by path via the pools' workerEntryPath
+1 -1
View File
@@ -137,7 +137,7 @@ npx hyperframes preview # preview in browser with live reload
npx hyperframes render # render to MP4
```
**Requirements:** Node.js 22+, FFmpeg
**Requirements:** Node.js 22.19+, FFmpeg
## What You Can Build
+5 -3
View File
@@ -85,7 +85,7 @@
"open": "^10.0.0",
"postcss": "^8.5.8",
"puppeteer-core": "^25.10.0",
"undici": "7.30.1",
"undici": "8.13.0",
"yauzl": "^3.4.0",
},
"devDependencies": {
@@ -175,7 +175,7 @@
"linkedom": "^0.18.12",
"puppeteer": "~25.13.0",
"puppeteer-core": "^25.13.0",
"undici": "7.30.1",
"undici": "8.13.0",
},
"devDependencies": {
"@types/node": "^25.0.10",
@@ -2164,7 +2164,7 @@
"unbash": ["unbash@3.0.0", "", {}, "sha512-FeFPZ/WFT0mbRCuydiZzpPFlrYN8ZUpphQKoq4EeElVIYjYyGzPMxQR/simUwCOJIyVhpFk4RbtyO7RuMpMnHA=="],
"undici": ["undici@7.30.1", "", {}, "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg=="],
"undici": ["undici@8.13.0", "", {}, "sha512-mxbeyRlRhHUTWE1zf/FwDOXTKMhE1vMQRz/o2oOir/5fIWsB79TeZrByMkj019EdDuxPg03jprCjFLxLkmxTCQ=="],
"undici-types": ["undici-types@7.21.0", "", {}, "sha512-w9IMgQrz4O0YN1LtB7K5P63vhlIOvC7opSmouCJ+ZywlPAlO9gIkJ+otk6LvGpAs2wg4econaCz3TvQ9xPoyuQ=="],
@@ -2402,6 +2402,8 @@
"istanbul-reports/html-escaper": ["html-escaper@2.0.2", "", {}, "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="],
"jsdom/undici": ["undici@7.30.1", "", {}, "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg=="],
"jsdom/whatwg-mimetype": ["whatwg-mimetype@5.0.0", "", {}, "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw=="],
"make-dir/semver": ["semver@7.8.0", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA=="],
+1 -1
View File
@@ -484,7 +484,7 @@ A HyperFrames video composition. Plain HTML + GSAP; rendered to MP4 by the `hype
## Requirements
- **Node.js 22+** -- [nodejs.org](https://nodejs.org/)
- **Node.js 22.19+** -- [nodejs.org](https://nodejs.org/)
- **FFmpeg** -- `brew install ffmpeg` (macOS) or `sudo apt install ffmpeg` (Debian/Ubuntu) or [ffmpeg.org/download](https://ffmpeg.org/download.html) (Windows)
Verify: `npx hyperframes doctor`
+1 -1
View File
@@ -22,7 +22,7 @@ OpenCode and other agents, or when you prefer the smaller core-only install.
| Codex | Use your existing HyperFrames plugin; directory updates are published separately |
| OpenCode | Use standalone skills |
You need Node.js 22+ and npm for the local CLI, plus FFmpeg for rendering.
You need Node.js 22.19+ and npm for the local CLI, plus FFmpeg for rendering.
Install on each machine you use; a plugin does not synchronize your machines.
## Claude Code
+1 -1
View File
@@ -17,7 +17,7 @@ claude plugin install hyperframes@hyperframes
- [Claude Code](https://code.claude.com/docs), signed in with your Claude account
or an Anthropic Console account. Its usage bills to that account.
- Node.js 22 or newer, and npm.
- Node.js 22.19 or newer, and npm.
- FFmpeg, for rendering MP4 files. Run `npx hyperframes doctor` to check.
## Install
+1 -1
View File
@@ -19,7 +19,7 @@ This installs the core skills into your user's shared skills folder,
- [Codex](https://developers.openai.com/codex), signed in with your ChatGPT
account or an OpenAI API key. Its usage bills to that account.
- Node.js 22 or newer, and npm.
- Node.js 22.19 or newer, and npm.
- FFmpeg, for rendering MP4 files. Run `npx hyperframes doctor` to check.
## Install
+1 -1
View File
@@ -18,7 +18,7 @@ and **Cursor** in the picker.
## Before you start
- [Cursor](https://cursor.com), signed in. Agent usage bills to your Cursor plan.
- Node.js 22 or newer, and npm.
- Node.js 22.19 or newer, and npm.
- FFmpeg, for rendering MP4 files. Run `npx hyperframes doctor` to check.
## Install
+1 -1
View File
@@ -110,6 +110,6 @@
}
},
"engines": {
"node": ">=22"
"node": ">=22.19.0"
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ Or use directly with npx:
npx hyperframes <command>
```
**Requirements:** Node.js >= 22, FFmpeg
**Requirements:** Node.js >= 22.19, FFmpeg
## Commands
+2 -2
View File
@@ -71,7 +71,7 @@
"open": "^10.0.0",
"postcss": "^8.5.8",
"puppeteer-core": "^25.10.0",
"undici": "7.30.1",
"undici": "8.13.0",
"yauzl": "^3.4.0"
},
"devDependencies": {
@@ -105,6 +105,6 @@
"sharp": "^0.35.5"
},
"engines": {
"node": ">=22"
"node": ">=22.19.0"
}
}
@@ -1,4 +1,5 @@
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { checkForUpdate } from "./utils/updateCheck.js";
import { refreshSkillsCache } from "./utils/skillsUpdateCheck.js";
+1
View File
@@ -34,6 +34,7 @@ for (const stream of [process.stdout, process.stderr]) {
// We emit the worker entry next to cli.js (see tsup.config.ts) and tell
// the pool where to find it via the published env-var override.
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
+1 -1
View File
@@ -1,5 +1,5 @@
// fallow-ignore-file unused-file
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { injectDeterministicFontFaces } from "@hyperframes/producer";
import { runFontLocalize, stampFontVersions } from "./fontLocalize.js";
+1
View File
@@ -1,4 +1,5 @@
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { writeFileSync } from "node:fs";
import { isAbsolute, join } from "node:path";
@@ -0,0 +1,8 @@
import "../utils/envProxyFetch.js";
import { readRegistryManifest } from "./remote.js";
const started = Date.now();
await readRegistryManifest("https://registry.proxy-fixture.com/registry", { skipCache: true }).then(
() => process.stdout.write("read\n"),
() => process.stdout.write(`failed after ${Date.now() - started} ms\n`),
);
@@ -0,0 +1,50 @@
import { spawn } from "node:child_process";
import { mkdtempSync, rmSync } from "node:fs";
import { createServer } from "node:http";
import type { AddressInfo } from "node:net";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { expect, it, onTestFinished } from "vitest";
const fixture = join(dirname(fileURLToPath(import.meta.url)), "envProxy.fixture.ts");
// fails without the fix: Node's own env proxy reconnects with no pause when the proxy drops the tunnel, so one
// registry read opened thousands of connections a second and the process outlived its own error.
it("a registry read through an env proxy that drops the tunnel fails once and the process ends", async () => {
let tunnels = 0;
const proxy = createServer((_, res) => res.writeHead(502).end());
proxy.on("connect", (_, client) => {
tunnels++;
client.destroy();
});
await new Promise<void>((resolve) => proxy.listen(0, "127.0.0.1", resolve));
onTestFinished(() => void proxy.close());
const url = `http://127.0.0.1:${(proxy.address() as AddressInfo).port}`;
const home = mkdtempSync(join(tmpdir(), "hf-env-proxy-"));
onTestFinished(() => rmSync(home, { recursive: true, force: true }));
const child = spawn(process.execPath, ["--import", "tsx", fixture], {
env: {
...process.env,
HOME: home,
HYPERFRAMES_CACHE_DIR: home,
HTTPS_PROXY: url,
HTTP_PROXY: url,
NO_PROXY: "",
NODE_USE_ENV_PROXY: "1",
},
stdio: ["ignore", "pipe", "inherit"],
});
onTestFinished(() => void child.kill("SIGKILL"));
setTimeout(() => child.kill("SIGKILL"), 8_000).unref();
let printed = "";
child.stdout.setEncoding("utf8");
child.stdout.on("data", (chunk: string) => (printed += chunk));
const ended = await new Promise((resolve) =>
child.once("exit", (code, signal) => resolve(code ?? signal)),
);
expect(printed).toMatch(/^failed after \d+ ms/);
expect(Number(printed.match(/\d+/)?.[0])).toBeLessThan(2_000);
expect(ended).toBe(0);
expect(tunnels).toBeLessThanOrEqual(2);
}, 30_000);
+1
View File
@@ -1,4 +1,5 @@
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { readFile, rm } from "node:fs/promises";
import { constants, setPriority } from "node:os";
+10 -3
View File
@@ -4,17 +4,24 @@ import { runtimeVersionError, runtimeVersionJson } from "./runtimeVersion.js";
describe("runtimeVersionError", () => {
it("rejects Node 20 before the bundled CLI is imported", () => {
expect(runtimeVersionError("20.11.1")).toBe(
"HyperFrames requires Node.js >= 22 (current: 20.11.1). Switch Node versions and retry.",
"HyperFrames requires Node.js >= 22.19 (current: 20.11.1). Switch Node versions and retry.",
);
});
it("accepts supported Node releases", () => {
expect(runtimeVersionError("22.0.0")).toBeNull();
expect(runtimeVersionError("22.19.0")).toBeNull();
expect(runtimeVersionError("23.0.0")).toBeNull();
expect(runtimeVersionError("24.14.0")).toBeNull();
});
it("rejects a Node 22 older than 22.19, which undici 8 needs", () => {
expect(runtimeVersionError("22.18.0")).toContain(
"requires Node.js >= 22.19 (current: 22.18.0)",
);
});
it("rejects malformed versions safely", () => {
expect(runtimeVersionError("unknown")).toContain("requires Node.js >= 22");
expect(runtimeVersionError("unknown")).toContain("requires Node.js >= 22.19");
});
});
+5 -4
View File
@@ -1,9 +1,10 @@
const MINIMUM_NODE_MAJOR = 22;
const MINIMUM_NODE_FOR_UNDICI_8 = { major: 22, minor: 19 };
export function runtimeVersionError(version: string): string | null {
const major = Number.parseInt(version.split(".", 1)[0] ?? "", 10);
if (Number.isFinite(major) && major >= MINIMUM_NODE_MAJOR) return null;
return `HyperFrames requires Node.js >= ${MINIMUM_NODE_MAJOR} (current: ${version}). Switch Node versions and retry.`;
const [major = Number.NaN, minor = Number.NaN] = version.split(".").map(Number);
const { major: needMajor, minor: needMinor } = MINIMUM_NODE_FOR_UNDICI_8;
if (major > needMajor || (major === needMajor && minor >= needMinor)) return null;
return `HyperFrames requires Node.js >= ${needMajor}.${needMinor} (current: ${version}). Switch Node versions and retry.`;
}
export function runtimeVersionJson(message: string, argv: readonly string[]): string | null {
+6
View File
@@ -0,0 +1,6 @@
import { envProxyEnabled } from "@hyperframes/core/env-proxy";
if (envProxyEnabled()) {
const { EnvHttpProxyAgent, setGlobalDispatcher } = await import("undici/index.js");
setGlobalDispatcher(new EnvHttpProxyAgent());
}
+1
View File
@@ -1,4 +1,5 @@
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { randomBytes } from "node:crypto";
import { unlinkSync } from "node:fs";
+1
View File
@@ -1,4 +1,5 @@
import "./utils/hideChildConsoles.js";
import "./utils/envProxyFetch.js";
import "./utils/windowsExeSearch.js";
import { spawn } from "node:child_process";
import { randomBytes } from "node:crypto";
+1 -1
View File
@@ -10,7 +10,7 @@ Framework-agnostic: works with GSAP, Lottie, Three.js, CSS animations, or any we
npm install @hyperframes/engine
```
**Requirements:** Node.js >= 22, FFmpeg, and the pinned `chrome-headless-shell`: run `npx hyperframes browser ensure` once, or name a browser in `PRODUCER_HEADLESS_SHELL_PATH`. A cached browser is used only when its files match the pinned build. HDR capture needs a full Chrome named in `HYPERFRAMES_BROWSER_PATH`.
**Requirements:** Node.js >= 22.19, FFmpeg, and the pinned `chrome-headless-shell`: run `npx hyperframes browser ensure` once, or name a browser in `PRODUCER_HEADLESS_SHELL_PATH`. A cached browser is used only when its files match the pinned build. HDR capture needs a full Chrome named in `HYPERFRAMES_BROWSER_PATH`.
## What it does
+2 -2
View File
@@ -121,7 +121,7 @@
"linkedom": "^0.18.12",
"puppeteer": "~25.13.0",
"puppeteer-core": "^25.13.0",
"undici": "7.30.1"
"undici": "8.13.0"
},
"devDependencies": {
"@types/node": "^25.0.10",
@@ -131,6 +131,6 @@
"vitest": "^4.1.12"
},
"engines": {
"node": ">=22"
"node": ">=22.19.0"
}
}
@@ -293,6 +293,8 @@ describe("downloads with the render-service setting off", () => {
describe("downloads on a render service through the egress proxy in HYPERFRAMES_CAPTURE_PROXY", () => {
const HOST = "cdn.egress-assets.com";
/** A host the egress proxy drops the tunnel for, as one that refuses the upstream does. */
const DROPPED = "gone.egress-assets.com";
const tunnels: string[] = [];
const defaultCAs = getCACertificates("default");
let origin: Server;
@@ -316,6 +318,7 @@ describe("downloads on a render service through the egress proxy in HYPERFRAMES_
egress = createServer();
egress.on("connect", (request, client) => {
tunnels.push(request.url ?? "");
if (request.url === `${DROPPED}:443`) return void client.destroy();
const upstream = connect(originPort, "127.0.0.1", () => {
client.write("HTTP/1.1 200 Connection Established\r\n\r\n");
upstream.pipe(client).pipe(upstream);
@@ -340,6 +343,13 @@ describe("downloads on a render service through the egress proxy in HYPERFRAMES_
);
});
// fails without the fix: undici 7 reconnects with no pause when the proxy drops the tunnel, thousands a second.
it("a tunnel the proxy drops fails the download without opening it again and again", async () => {
await expect(downloadToTemp(`https://${DROPPED}/a.png`, tempDir())).rejects.toBeTruthy();
expect(tunnels.length).toBeGreaterThan(0);
expect(tunnels.length).toBeLessThanOrEqual(4);
}, 10_000);
it("downloads by hostname through the proxy, with the usual headers, resolving no names", async () => {
routes[`https://${HOST}/a.png`] = { status: 200, body: BODY };
const path = await downloadToTemp(`https://${HOST}/a.png`, tempDir());
+1 -1
View File
@@ -85,6 +85,6 @@
"yaml": "^2.9.0"
},
"engines": {
"node": ">=22"
"node": ">=22.19.0"
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ Full HTML-to-video rendering pipeline: capture frames with Chrome's BeginFrame A
npm install @hyperframes/producer
```
**Requirements:** Node.js >= 22, FFmpeg, and the pinned `chrome-headless-shell`: run `npx hyperframes browser ensure` once, or name a browser in `PRODUCER_HEADLESS_SHELL_PATH`. A cached browser is used only when its files match the pinned build. HDR capture needs a full Chrome named in `HYPERFRAMES_BROWSER_PATH`.
**Requirements:** Node.js >= 22.19, FFmpeg, and the pinned `chrome-headless-shell`: run `npx hyperframes browser ensure` once, or name a browser in `PRODUCER_HEADLESS_SHELL_PATH`. A cached browser is used only when its files match the pinned build. HDR capture needs a full Chrome named in `HYPERFRAMES_BROWSER_PATH`.
## Usage
+1 -1
View File
@@ -96,6 +96,6 @@
"vitest": "^4.1.12"
},
"engines": {
"node": ">=22"
"node": ">=22.19.0"
}
}
+1 -1
View File
@@ -10,7 +10,7 @@
"files": 81
},
"hyperframes-cli": {
"hash": "132e56038dbd2365",
"hash": "9709d3caa4d3be18",
"files": 14
},
"hyperframes-registry": {
+1 -1
View File
@@ -9,7 +9,7 @@ description: HyperFrames CLI - scaffold, check frames, edit timelines, preview,
# HyperFrames CLI
Run `npx hyperframes <command>` as above, never a project's own scripts or wrapper unless the person names that command. A job with no TTY pins the release with the launcher's `--cli-version <exact-version>`, taking the version from the person or from `--cli-version latest --version`, never from the project's files and never a floating install (`references/unattended.md`). It needs Node.js 22+ and FFmpeg. Every command has `--help`; most take `--json`, and a failure prints `✗ …`, a `Fix:` line and exits non-zero.
Run `npx hyperframes <command>` as above, never a project's own scripts or wrapper unless the person names that command. A job with no TTY pins the release with the launcher's `--cli-version <exact-version>`, taking the version from the person or from `--cli-version latest --version`, never from the project's files or a floating install (`references/unattended.md`). It needs Node.js 22.19+ and FFmpeg. Every command has `--help`; most take `--json`, and a failure prints `✗ …`, a `Fix:` line and exits non-zero.
A `--json` result may carry `_meta.updateNotice`: a newer HyperFrames release is out. Pass it to the person once per conversation, in your own words, at a natural pause; updating is theirs to decide.