Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(golden): a retry is handed the attempt that failed

esengine32c61eabb969
diff --git a/tools/lib/deadGpu.mjs b/tools/lib/deadGpu.mjs
index 9b6d3a3ed..c9c69a222 100644
--- a/tools/lib/deadGpu.mjs
+++ b/tools/lib/deadGpu.mjs
@@ -207,7 +207,7 @@ export function retryOnDeadGpu(attempt, note, stepMs = STEP_MS) {
if (!noVerdict && !aftermath) return { ...last, retried: i > 0 };
if (i < MAX_ATTEMPTS - 1) {
- note(noVerdict);
+ note(noVerdict, last);
backoff(i, stepMs);
}
}
diff --git a/tools/tests/dead-gpu.test.ts b/tools/tests/dead-gpu.test.ts
index 842a9f7c2..6040ab2aa 100644
--- a/tools/tests/dead-gpu.test.ts
+++ b/tools/tests/dead-gpu.test.ts
@@ -330,6 +330,14 @@ describe('retryOnDeadGpu', () => {
// golden reports measured:false when a launch fails, which is exactly what a
// dead GPU looks like — so a nightly with no xvfb retried eleven projects
// six times each and spent 24 minutes calling it a GPU that died.
+ it('hands each retry the attempt that failed', () => {
+ const seen: string[] = [];
+ let n = 0;
+ retryOnDeadGpu(() => ({ ok: false, measured: false, output: `attempt ${++n}` }),
+ (_noVerdict: boolean, last: { output: string }) => seen.push(last.output), 0);
+ expect(seen).toEqual(['attempt 1', 'attempt 2', 'attempt 3', 'attempt 4', 'attempt 5']);
+ });
+
it('does not retry a launch that never happened', () => {
const r = runReporting([{ ok: false, measured: false, output: 'pnpm did not start: ENOENT' }]);
expect(r.attempts).toBe(1);