Skip to content

fix(scripts): bound browser proofs and clean up Chromium - #438

Merged
kitlangton merged 3 commits into
mainfrom
browser-script-budget
Oct 23, 2026
Merged

kitlangton merged 3 commits into
mainfrom
browser-script-budget

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What it does

Stops runaway browser proof/capture scripts and closes their Chromium processes on success, errors, or deadline expiry. Outbreak's first-night simulation runs in Bun by default; GPU stills require --capture.

How it works

  • Adopts a shared await using budget across 229 existing launcher files, including root, game, Lab, sky and production-smoke scripts.
  • Defaults to 180 seconds, prints the budget, and permits an explicit ARCADE_BROWSER_BUDGET_S override up to 300 seconds. Tracks concurrent launches and persistent contexts; early exits close browsers first.
  • A separate watchdog thread handles blocked host JavaScript. Normal deadline expiry exits 124; an unresponsive host gets SIGKILL after three seconds of shutdown grace, along with its own descendants.
  • Long showcase/epic/ship renders build before the browser scope and close Chromium before final encoding/mastering. budget.finish() is idempotent and permanently prevents new launches.
  • Preserves the first-night station's pacing-10m-proof.json filename and Blackout's exported executable lookup.

Risk

Script tooling only. Historical multi-shot captures may need narrower shot selections to fit the browser deadline. Streaming encoders count toward the deadline while Chromium is open. Long showcase renders were typechecked, not rerendered end-to-end.

The release check is not fully green: Getaway/Blackout/Outbreak have wall-clock performance/test-timeout failures in untouched tests, and the Lot readiness smoke timed out under concurrent load. An isolated follow-up on the same production build passed with both main's smoke script and this branch's budgeted script. All typechecks, production builds, deployment dry-runs, and the other nine game smoke checks passed in the release run. The first-night sweep also retains an existing co-op first-contact assertion failure; both baseline and branch fail identically before reaching GPU work.

Proof

All checks ran through HiveMind:

  • bunx tsc --noEmit -p games/blackout/tsconfig.scripts.json and the Getaway equivalent: passed after fixing the reviewed executable-lookup blocker.
  • bun scripts/check-browser-budgets.ts: 230 launcher files passed, including the new lifecycle fixture.
  • bun scripts/browser-budget-proof.ts: success, exception, persistent context, hung page, hung host promise, and blocked host all cleaned up their observed Chromium PIDs. A targeted phases run passed in 21.950 s: 10.5-second preparation and encoding phases each outlast a ten-second browser budget; relaunch after finishing is rejected.
  • bun run verify:release: 72 steps, 473.4 s; all typechecks/builds/dry-runs passed, with the unrelated test and Lot smoke failures described above.
  • Lot isolated smoke comparison on Studio's same production build: main ready in ~25 s; budgeted script ready in ~18 s, both with two validated frames and zero browser errors. This resolves the release-run smoke failure without changing its thresholds.
  • Independent review completed; executable lookup, phase boundaries and report filename findings addressed.
Script Before After Result
Sky GPU occultation 6.25 s 1.94 s Same metrics, zero browser errors
First-night native simulation 72.04 s 54.68 s Same existing assertion failure
Deliberately hung page, 3 s budget No shared script deadline 3.656 s Exit 124; Chromium stopped

Times exclude HiveMind admission. Cache/load differences mean the first two rows do not establish an attributable speedup.

@kitlangton
kitlangton merged commit 6480065 into main Oct 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant