-
Notifications
You must be signed in to change notification settings - Fork 972
test(windows): widen the launcher health budget for loaded runners #2983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,16 @@ const nodeAvailable = spawnSync("node", ["--version"], { | |
| }).status === 0; | ||
| const runnable = process.platform === "win32" && nodeAvailable; | ||
|
|
||
| // /healthz is the launcher's first trustworthy end-to-end startup signal: a | ||
| // live Node parent or Bun child does not prove that the proxy is serving. The | ||
| // old 25s budget expired on a loaded Windows runner, and equivalent real-proxy | ||
| // starts elsewhere in this suite have taken 46-47s. 90s is more than twice the | ||
| // measured high-water mark while still turning a hung launch into a bounded | ||
| // failure. Keep the case budget derived so process inspection and cleanup have | ||
| // their own headroom after readiness settles. | ||
| const PROXY_HEALTH_TIMEOUT_MS = 90_000; | ||
| const EFFECTIVE_RUNTIME_TEST_TIMEOUT_MS = PROXY_HEALTH_TIMEOUT_MS + 30_000; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
file="tests/ocx-launcher-runtime.test.ts"
python3 - "$file" <<'PY'
import re
import sys
text = open(sys.argv[1], encoding="utf-8").read()
def value(pattern):
match = re.search(pattern, text)
if not match:
raise SystemExit(f"missing pattern: {pattern}")
return int(match.group(1).replace("_", ""))
health = value(r"PROXY_HEALTH_TIMEOUT_MS\s*=\s*([\d_]+)")
headroom = value(r"EFFECTIVE_RUNTIME_TEST_TIMEOUT_MS\s*=\s*PROXY_HEALTH_TIMEOUT_MS\s*\+\s*([\d_]+)")
inspection = 5 * 10_000 + 4 * 100
if headroom < inspection:
raise SystemExit(
f"cleanup inspection bound ({inspection} ms) exceeds headroom ({headroom} ms)"
)
print("Timeout headroom covers one bounded inspection.")
PYRepository: lidge-jun/opencodex Length of output: 221 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732 -maxdepth 2 -type f -name '*.md' -print \
-exec sh -c 'echo "--- $1"; head -80 "$1"' _ {} \;
echo '--- test structure and timeout-related code ---'
sed -n '1,70p' tests/ocx-launcher-runtime.test.ts
sed -n '180,230p' tests/ocx-launcher-runtime.test.ts
sed -n '340,405p' tests/ocx-launcher-runtime.test.ts
rg -n "inspectWindowsProcessIdentity|removeTree|spawnSync|setTimeout|timeout|test\\.each|bun:test" tests/ocx-launcher-runtime.test.ts package.json bun.lockb bun.lock 2>/dev/null || trueRepository: lidge-jun/opencodex Length of output: 25999 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- bounded helper implementations ---'
sed -n '70,180p' tests/ocx-launcher-runtime.test.ts
sed -n '220,295p' tests/ocx-launcher-runtime.test.ts
echo '--- project Bun version and test scripts ---'
rg -n -C 3 '"(packageManager|engines|bun|test)"' package.json bunfig.toml tsconfig.json .github 2>/dev/null || trueRepository: lidge-jun/opencodex Length of output: 7927 🌐 Web query:
💡 Result: In Bun 1.4, the per-test timeout implementation was significantly updated to handle both asynchronous and synchronous execution [1][2][3]. For synchronous execution—such as tests containing blocking infinite loops or heavy computation that would otherwise prevent the event loop from firing a standard timer—Bun integrates a watchdog mechanism [1]. This watchdog wraps the test callback in the Citations:
Make the case timeout cover the cleanup bound. In 🤖 Prompt for AI Agents |
||
|
|
||
| type Health = { | ||
| status: string; | ||
| service: string; | ||
|
|
@@ -196,7 +206,7 @@ async function effectiveRuntime(override: string): Promise<string> { | |
| launcherPid = launcher.pid; | ||
| ownedLauncher = captureWindowsProcessIdentity(launcherPid); | ||
|
|
||
| const health = await waitForHealth(port, 25_000, launcher); | ||
| const health = await waitForHealth(port, PROXY_HEALTH_TIMEOUT_MS, launcher); | ||
| if (!health) throw new Error("proxy did not become healthy"); | ||
| const identity = windowsProcessIdentity(health.pid); | ||
| if (!identity || identity.parentPid !== launcher.pid) { | ||
|
|
@@ -357,7 +367,7 @@ describe.skipIf(!runnable)("ocx npm launcher effective Bun runtime", () => { | |
| } finally { | ||
| removeTree(root); | ||
| } | ||
| }, 120_000); | ||
| }, EFFECTIVE_RUNTIME_TEST_TIMEOUT_MS); | ||
|
|
||
| test("falls back to bundled Bun for a sub-1MB override stub", async () => { | ||
| const root = mkdtempSync(join(tmpdir(), "ocx-launcher-runtime-stub-")); | ||
|
|
@@ -370,5 +380,5 @@ describe.skipIf(!runnable)("ocx npm launcher effective Bun runtime", () => { | |
| } finally { | ||
| removeTree(root); | ||
| } | ||
| }, 120_000); | ||
| }, EFFECTIVE_RUNTIME_TEST_TIMEOUT_MS); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a loaded Windows runner where readiness consumes most of the new 90-second allowance, this 120-second case deadline can expire during process inspection or cleanup. The extra 30 seconds also includes the pre-poll
captureWindowsProcessIdentity, several PowerShell/CIM calls with 10-second timeouts,killProxywaits, and two potentially 10-secondremoveTreeretry loops, so a startup that succeeds within the advertised health budget can still time out and interrupt cleanup, possibly leaving the proxy running for later tests. Increase the case timeout to cover these bounded operations in addition to the readiness deadline.Useful? React with 👍 / 👎.