- Install required Linux desktop runtime packages before perf trace runs - Increase perf trace timeout in CI and always upload `/tmp/t3code-perf-artifacts` - Add timeout failure hints and recent log-tail output to `desktop-perf-trace` errors
Showing the changes to scripts (1 of 2 files). Show all
Unified · Split
| @@ -339,6 +339,34 @@ async function waitForDoneFile(donePath, child, timeoutMs) { · 338 unmodified lines | |||
| 339 | throw new Error(`Timed out waiting for done marker at ${donePath}`); | 339 | throw new Error(`Timed out waiting for done marker at ${donePath}`); |
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | function tailLogText(logChunks, lineCount = 120) { | ||
| 343 | const lines = logChunks.join("").split(/\r?\n/); | ||
| 344 | return lines.slice(-lineCount).join("\n").trim(); | ||
| 345 | } | ||
| 346 | |||
| 347 | function inferDesktopPerfTimeoutHint(logChunks) { | ||
| 348 | const joined = logChunks.join(""); | ||
| 349 | const lowered = joined.toLowerCase(); | ||
| 350 | |||
| 351 | if (lowered.includes("error while loading shared libraries")) { | ||
| 352 | return "Electron failed to start due missing Linux shared libraries."; | ||
| 353 | } | ||
| 354 | if (lowered.includes("no usable sandbox")) { | ||
| 355 | return "Electron sandbox failed to initialize in CI."; | ||
| 356 | } | ||
| 357 | if (lowered.includes("port is already in use")) { | ||
| 358 | return "Dev server port collision prevented Electron from loading the renderer."; | ||
| 359 | } | ||
| 360 | if (!joined.includes("[desktop-perf]")) { | ||
| 361 | return "Desktop perf automation never started; Electron likely did not boot successfully."; | ||
| 362 | } | ||
| 363 | if (joined.includes("[desktop-perf]") && !joined.includes("[desktop-perf] trace recorded")) { | ||
| 364 | return "Desktop perf automation started but did not complete trace recording."; | ||
| 365 | } | ||
| 366 | |||
| 367 | return "Desktop perf automation timed out before writing the done marker."; | ||
| 368 | } | ||
| 369 | |||
| 342 | async function terminateProcessTree(child) { | 370 | async function terminateProcessTree(child) { |
| 343 | if (child.exitCode !== null) return; | 371 | if (child.exitCode !== null) return; |
| 344 | 372 | ||
| @@ -522,6 +550,19 @@ async function main() { · 177 unmodified lines | |||
| 522 | let donePayload; | 550 | let donePayload; |
| 523 | try { | 551 | try { |
| 524 | donePayload = await waitForDoneFile(donePath, child, timeoutMs); | 552 | donePayload = await waitForDoneFile(donePath, child, timeoutMs); |
| 553 | } catch (error) { | ||
| 554 | const baseMessage = error instanceof Error ? error.message : String(error); | ||
| 555 | const hint = inferDesktopPerfTimeoutHint(logs); | ||
| 556 | const logTail = tailLogText(logs); | ||
| 557 | throw new Error( | ||
| 558 | [ | ||
| 559 | baseMessage, | ||
| 560 | `Hint: ${hint}`, | ||
| 561 | `Artifacts dir: ${artifactsDir}`, | ||
| 562 | `Run log: ${logPath}`, | ||
| 563 | logTail.length > 0 ? `Recent log tail:\n${logTail}` : "Recent log tail: <empty>", | ||
| 564 | ].join("\n"), | ||
| 565 | ); | ||
| 525 | } finally { | 566 | } finally { |
| 526 | await terminateProcessTree(child); | 567 | await terminateProcessTree(child); |
| 527 | } | 568 | } |