Skip to content

test(e2e): kill the login CLI directly instead of its process tree [RED-1142] [ship] - #1538

Merged
sorccu merged 1 commit into
mainfrom
simo/red-1142-flaky-windows-e2e-empty-output
Oct 16, 2026
Merged

sorccu merged 1 commit into
mainfrom
simo/red-1142-flaky-windows-e2e-empty-output

Conversation

@sorccu

@sorccu sorccu commented Oct 13, 2026

Copy link
Copy Markdown
Member

Linear: RED-1142

On Windows, checks-empty-account.spec.ts sometimes fails because one pnpm checkly checks … run exits with code 1 and prints nothing. This PR changes how login.spec.ts stops its hanging checkly login runs, which is the likely cause.

Cause (inferred from timing)

  • The failure has been seen twice: run 38394891270 and run 37968092180.
  • Both times it was in shard 3/4. login.spec.ts ran in a parallel worker in that shard.
  • Both times the failing command ended at the same moment login.spec.ts finished its last test, within the precision of vitest's per-test timings.
  • That test stopped pnpm checkly login with taskkill /F /T. A process killed this way exits with code 1 and no output.
  • /T finds child processes by their recorded parent PID, and Windows reuses PIDs. So it can kill processes that aren't children of the login run, including other tests' CLI runs.

Change

  • runAndKill now runs the CLI entry point node_modules/checkly/bin/run.cjs directly under node, instead of through pnpm checkly.
  • The subprocess is therefore the CLI process itself, and a plain subprocess.kill('SIGKILL') stops it on every platform.
  • This removes taskkill /T on Windows and the detached process-group kill on POSIX.
  • Trade-off: the two login tests that use runAndKill no longer go through pnpm's bin shim. Every other e2e test still does.

Verification

  • login.spec.ts passes 3/3 locally on macOS, and no CLI process is left behind.
  • Windows can only be checked in CI. The failure was rare, so one green run doesn't prove the fix. RED-1142 should stay open until several Windows e2e runs have passed. If the empty-output failure comes back, this diagnosis was wrong.

🤖 Generated with Claude Code

…ED-1142]

login.spec.ts stopped the hanging `pnpm checkly login` with
`taskkill /F /T` on Windows. /T walks recorded parent PIDs, which
Windows reuses, so it can also kill CLI runs of other test files in
parallel workers. Those fail with exit code 1 and empty output, which
matches the intermittent failures in checks-empty-account.spec.ts on
Windows: in both observed runs the failing command ended exactly when
login.spec.ts finished its last kill.

Run the CLI entry point directly under node so the subprocess is the
CLI process itself, and stop it with a plain kill on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sorccu
sorccu force-pushed the simo/red-1142-flaky-windows-e2e-empty-output branch from 47b719d to 9dd7b4f Compare October 16, 2026 14:05
@sorccu sorccu changed the title test(e2e): kill the login CLI directly instead of its process tree [RED-1142] test(e2e): kill the login CLI directly instead of its process tree [RED-1142] [ship] Oct 16, 2026
@sorccu
sorccu enabled auto-merge (squash) October 16, 2026 14:08

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: ship/show PR from a same-repo branch.

@sorccu
sorccu merged commit b39d123 into main Oct 16, 2026
16 checks passed
@sorccu
sorccu deleted the simo/red-1142-flaky-windows-e2e-empty-output branch October 16, 2026 14:11
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