Skip to content

Register start-bb signal handlers before spawning - #2055

Merged
ymichael merged 1 commit into
mainfrom
bb/investigate-and-fix-test-flake-thr_jayk4zng5r
Aug 20, 2026
Merged

Register start-bb signal handlers before spawning#2055
ymichael merged 1 commit into
mainfrom
bb/investigate-and-fix-test-flake-thr_jayk4zng5r

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

runBuildProcess spawned its build process before registering SIGINT and SIGTERM handlers. A fast child could become externally observable during that window, allowing another process to send SIGTERM while Node still had its default signal behavior. The parent then exited with signal=SIGTERM instead of cleaning up the build leader and grandchild, which caused the flaky packages job on PR #2050.

What changed

Register the build signal handlers before spawning the child. Keep spawn inside the existing try/finally lifecycle so synchronous startup failures also remove both handlers. There are no wire, daemon protocol, CLI, persistence, or documentation contract changes.

How you verified

  • The first CI attempt on PR Make machine settings text-first and responsive #2050 failed in test/start-bb.test.mjs with code=null and signal=SIGTERM; its rerun passed, confirming the timing-dependent behavior.
  • Repeated the focused @bb/scripts process-group integration test 100 times with Turbo cache bypass; all 100 passed without Vitest retries.
  • pnpm exec turbo run test --filter=@bb/scripts --force — 18 files and 97 tests passed.
  • pnpm exec turbo run typecheck --filter=@bb/scripts — passed.
  • git diff --check — passed.

Follow-up to #2050.

AGENT GENERATED: by GPT-5.6 Codex

@ymichael
ymichael merged commit 3225431 into main Aug 20, 2026
13 checks passed
@ymichael
ymichael deleted the bb/investigate-and-fix-test-flake-thr_jayk4zng5r branch August 20, 2026 18:23
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