Skip to content

Commit 667eb3d

Browse files
axisrowclaude
andcommitted
fix(test-teardown): restore await on endpoint probe + bump CI/Node to 24
Cycle-2 review findings (Codex + Claude subagent): 1. pid-reuse guard regressed in cycle 1: reapWorkerBrokers dropped the `await` on `safeAwait(waitForBrokerEndpoint(...))`, so `ready` was an unresolved Promise (always truthy) → killProcess selected `terminateProcessTree` unconditionally, even for a dead endpoint whose pid the OS may have recycled into an unrelated process. The exact invariant the PR claims to protect. `await` restored; killProcess once again only set when the probe confirms the broker is live. 2. --test-global-setup needs Node 24, but CI ran Node 22 and engines/lockfile/ README still said 18.18. Bumped all four in lockstep: CI workflow 22→24, README "Node.js 18.18 or later" → "Node.js 24 or later", package-lock engines mirrored (already >=24 in package.json from cycle 1). Cycle-2 cleanup (non-blocking, applied in the final pass): - reapWorkerBrokers() called with a stray `true` arg from the old signature; removed. - registerTrackedTempDir docstring clarified: it covers non-broker temp dirs only; plugin-data roots go through registerPluginDataDir. Verified: full npm test → 0 broker leak, 0 leftover test-data dirs; SIGINT mid-run → 0 leftover. Both reviewers (Codex + Claude subagent) ship. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0189cGaohsYdpkB4otKZnpAt
1 parent 9c798cb commit 667eb3d

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎.github/workflows/pull-request-ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Node.js
2020
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
2121
with:
22-
node-version: 22
22+
node-version: 24
2323
cache: npm
2424

2525
- name: Install dependencies

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ they already have.
1717

1818
- **ChatGPT subscription (incl. Free) or OpenAI API key.**
1919
- Usage will contribute to your Codex usage limits. [Learn more](https://developers.openai.com/codex/pricing).
20-
- **Node.js 18.18 or later**
20+
- **Node.js 24 or later**
2121

2222
## Install
2323

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/helpers.mjs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ const trackedWorkspaces = new Set();
7373
let workerTeardownStarted = false;
7474
let workerHandlersRegistered = false;
7575

76-
/** Register any temp path (workspace, binDir, plugin-data root) for rm -rf at exit. */
76+
/** Register a non-broker temp path (workspace, binDir, home) for rm -rf at exit.
77+
* Plugin-data roots go through registerPluginDataDir (removed only after reap). */
7778
export function registerTrackedTempDir(dir) {
7879
if (typeof dir === "string" && dir) {
7980
trackedTempDirs.add(dir);
@@ -124,7 +125,7 @@ function ensureWorkerExitHandlers() {
124125
return;
125126
}
126127
workerTeardownStarted = true;
127-
Promise.resolve(reapWorkerBrokers(true))
128+
Promise.resolve(reapWorkerBrokers())
128129
.catch(() => {})
129130
.finally(() => {
130131
try { rmTrackedTempDirs(); } catch {}
@@ -168,7 +169,7 @@ async function reapWorkerBrokers() {
168169
continue;
169170
}
170171
const ready = session.endpoint
171-
? safeAwait(waitForBrokerEndpoint(session.endpoint, 150), false)
172+
? await safeAwait(waitForBrokerEndpoint(session.endpoint, 150), false)
172173
: false;
173174
const killProcess = ready ? terminateProcessTree : null;
174175
if (ready && session.endpoint) {

0 commit comments

Comments
 (0)