Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

ci: fix playwright hangs (#8766)

Myles Scolnickcdd1b8014e93
diff --git a/frontend/e2e-tests/global-teardown.ts b/frontend/e2e-tests/global-teardown.ts
index 684d3bbc0d..842ef7aac8 100644
--- a/frontend/e2e-tests/global-teardown.ts
+++ b/frontend/e2e-tests/global-teardown.ts
@@ -10,18 +10,25 @@ async function globalTeardown() {
console.log("🧹 Cleaning up test environment...");
try {
- // Kill marimo processes and their parent uv processes.
- // On macOS, uv doesn't forward SIGTERM to children, so Playwright's
- // webServer termination hangs waiting for the uv process to exit.
+ // Kill marimo processes, kernel workers, and parent uv processes.
+ // uv doesn't forward SIGTERM to children, so Playwright's
+ // webServer termination hangs waiting for the process to exit.
// Using SIGKILL (-9) ensures processes die immediately.
- try {
- await execAsync("pkill -9 -f 'marimo.*--headless' || true");
- await execAsync("pkill -9 -f 'uv.*marimo' || true");
- console.log("✅ Cleaned up marimo/uv processes");
- } catch {
- // Ignore errors - processes might not exist
- console.log("⚠️ No marimo processes to clean up");
+ //
+ // The character-class trick (e.g. [m]arimo) prevents pkill from
+ // matching its own shell wrapper process.
+ //
+ // We kill broadly — any process with "marimo" in its command line —
+ // to catch orphan kernel workers that survive the parent being killed.
+ const killCmds = [
+ "pkill -9 -f '[m]arimo' || true",
+ "pkill -9 -f '[u]v.*run.*[m]arimo' || true",
+ ];
+ for (const cmd of killCmds) {
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ await execAsync(cmd).catch(() => {});
}
+ console.log("✅ Cleaned up marimo/uv processes");
// Small delay to ensure cleanup completes
await new Promise((resolve) => setTimeout(resolve, 1000));
diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts
index 4c756033f4..ab0ce0f501 100644
--- a/frontend/playwright.config.ts
+++ b/frontend/playwright.config.ts
@@ -210,9 +210,11 @@ const config: PlaywrightTestConfig = {
reuseExistingServer: true,
timeout: 30 * 1000,
ignoreHTTPSErrors: true,
- // Add stdout/stderr for debugging
- stdout: "pipe" as const,
- stderr: "pipe" as const,
+ // Use "ignore" to prevent child processes from inheriting pipe FDs.
+ // With "pipe", orphan kernel workers keep the FDs open after the
+ // parent is killed, causing Playwright's webServer teardown to hang.
+ stdout: "ignore" as const,
+ stderr: "ignore" as const,
};
}),
{
@@ -221,9 +223,8 @@ const config: PlaywrightTestConfig = {
reuseExistingServer: true,
timeout: 30 * 1000,
ignoreHTTPSErrors: true,
- // Add stdout/stderr for debugging
- stdout: "pipe" as const,
- stderr: "pipe" as const,
+ stdout: "ignore" as const,
+ stderr: "ignore" as const,
},
// WASM_SERVER,
],