← reports

#5195 · Windows teardown rejects a terminated root before exit notification

BugHighEffort: Mediumhostclipartial-repro Issue on GitHubOctober 8, 2026 · base 8d9195d8e0f123ea32b21eb9eb1104b35d97b916

Verdict: PARTIALLY REPRODUCED · Root-cause confidence: medium.

The delayed-notification failure is verified in two clean checkouts on Linux. Native Windows turn submission and the native CLI assertion are not reproduced.

1. TL;DR

A submission can await stopping an old provider bridge, and the Windows stop helper can reject even after the operating system has removed the root process. A focused test uses a real child process, verifies its PID no longer exists, and delays only the lifecycle notification exposed to the Windows helper. That helper still fails after its fixed one-second deadline; the same result occurs in a second clean trusted checkout. The managed-stop wrapper also insists on exit metadata, so changing only the helper to return early would not address the entire caller path. These findings support a teardown timing hypothesis, but do not establish the reporter's Windows timing or connect it to the separate native CLI crash.

2. Claims vs findings

ClaimStatusEvidence
A new turn can fail while a previous process is finishing.Unverified nativelyTrusted source contains an awaited bridge-restart path before starting a turn. No Windows machine or real provider turn was used.
A terminated root can still produce a termination-timeout error.Verified in a modelTwo runs terminate real children, verify ESRCH from a zero-signal PID probe, and observe rejection while exit metadata is deliberately withheld for 1.5 seconds.
Retry succeeds and no work remains.UnverifiedThe test verifies only root death. It does not establish provider retry behavior or descendant-tree cleanup.
CLI exit intermittently asserts in the Windows native event loop after normal output.Unverified20 built-source version invocations per checkout exit cleanly on Linux. This baseline does not exercise plugin commands, network handles, Windows, or Node 24.
Both failures have one underlying cause.UnverifiedNo native stack, dump, or handle trace establishes that relationship.
The earlier process-shutdown issue shares the mechanism.Supported statically, not proven nativelyShared Windows stop code remains present; the earlier issue's report is not reused as reproduction evidence here.

3. Environment

4. Minimal reproduction

This is an explicitly modeled Windows-notification delay, not a faithful native Windows end-to-end reproduction. The real production Windows helper is called directly on Linux, avoiding a fake platform switch.

  1. Create a trusted checkout and install/build existing dependencies:
    git clone https://github.com/get-bb/bb.git issue-5195-first
    cd issue-5195-first
    git checkout --detach 8d9195d8e0f123ea32b21eb9eb1104b35d97b916
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build
  2. Save the linked investigator-authored test to packages/process-utils/test/issue-5195-delayed-notification.test.ts. The complete source appears below; no production edit is needed.
  3. Run from the repository root:
    pnpm exec turbo run test --force --filter=@bb/process-utils -- test/issue-5195-delayed-notification.test.ts
  4. The test starts a real Node child and models successful tree termination by killing that root. A proxy exposes exitCode/signalCode as absent and forwards exit notification after 1.5 seconds. Independently, the test awaits the real child's exit and confirms process.kill(pid, 0) throws ESRCH before checking the helper's result.
    Expected: a resolved stop result for an already-terminated root
    Actual:   rejection after the fixed 1,000 ms notification wait
    @bb/process-utils:test: {"kernelRootGone":true,"status":"rejected","message":"Process did not exit after termination: 6977"}
    Test result: 1 failed, 2 passed; command exit 1
  5. Run existing owner controls:
    pnpm exec turbo run test --force --filter=@bb/process-utils -- test/windows-process-tree.test.ts test/process-tree.test.ts
    Expected and actual: 11 existing tests pass; command exit 0

The two added controls establish that a notification inside the deadline resolves and that failed termination of a still-live root rejects. They do not claim to prove taskkill itself or descendant cleanup.

The complete reproduction test is inline here; save it at the package path shown in step 2.

import { ChildProcess, execFile, spawn } from "node:child_process";
import { EventEmitter, once } from "node:events";
import { expect, it, onTestFinished, vi } from "vitest";
import { stopWindowsProcessTree } from "../src/windows-process-tree.js";

vi.mock("node:child_process", async (importOriginal) => {
  const actual = await importOriginal<typeof import("node:child_process")>();
  return { ...actual, execFile: vi.fn() };
});

async function startChild(notificationDelayMs: number) {
  const child = spawn(
    process.execPath,
    ["-e", 'process.stdout.write("ready"); setInterval(() => {}, 1000);'],
    { stdio: ["ignore", "pipe", "ignore"] },
  );
  const notifications = new EventEmitter();
  let notified = false;
  let notificationTimer: NodeJS.Timeout | undefined;
  const exited = once(child, "exit");
  child.once("exit", (code, signal) => {
    notificationTimer = setTimeout(() => {
      notified = true;
      notifications.emit("exit", code, signal);
    }, notificationDelayMs);
  });
  onTestFinished(() => {
    clearTimeout(notificationTimer);
    vi.restoreAllMocks();
    child.kill("SIGKILL");
    vi.mocked(execFile).mockReset();
  });
  await once(child.stdout, "data");
  const visibleChild = new Proxy(child, {
    get(target, property, receiver) {
      if (property === "exitCode") return notified ? target.exitCode : null;
      if (property === "signalCode") return notified ? target.signalCode : null;
      if (property === "once") return notifications.once.bind(notifications);
      if (property === "off") return notifications.off.bind(notifications);
      return Reflect.get(target, property, receiver);
    },
  });
  return { child, exited, visibleChild };
}

function arrangeTaskkill(child: ChildProcess, success: boolean) {
  vi.mocked(execFile).mockImplementationOnce((...args: unknown[]) => {
    const callback = args.at(-1);
    queueMicrotask(() => {
      if (success) child.kill("SIGKILL");
      if (typeof callback === "function") {
        callback(success ? null : new Error("termination unavailable"), "", "");
      }
    });
    return new ChildProcess();
  });
}

it("accepts a terminated root while its Windows exit notification is delayed", async () => {
  const { child, exited, visibleChild } = await startChild(1_500);
  arrangeTaskkill(child, true);
  const stopping = stopWindowsProcessTree(visibleChild);
  const outcome = stopping.then(
    (result) => ({ status: "resolved", result }),
    (error: Error) => ({ status: "rejected", message: error.message }),
  );
  await exited;
  const rootPid = child.pid;
  if (rootPid === undefined) throw new Error("Child did not receive a PID");
  expect(() => process.kill(rootPid, 0)).toThrowError(
    expect.objectContaining({ code: "ESRCH" }),
  );
  expect(visibleChild.exitCode).toBeNull();
  expect(visibleChild.signalCode).toBeNull();
  const result = await outcome;
  console.log(JSON.stringify({ kernelRootGone: true, ...result }));
  expect(result).toEqual({
    status: "resolved",
    result: { treeTermination: "confirmed" },
  });
});

it("accepts a root whose exit notification arrives within the deadline", async () => {
  const { child, visibleChild } = await startChild(50);
  arrangeTaskkill(child, true);
  await expect(stopWindowsProcessTree(visibleChild)).resolves.toEqual({
    treeTermination: "confirmed",
  });
});

it("still rejects when root termination fails and the root remains alive", async () => {
  const { child, visibleChild } = await startChild(0);
  arrangeTaskkill(child, false);
  vi.spyOn(child, "kill").mockReturnValue(false);
  await expect(stopWindowsProcessTree(visibleChild)).rejects.toThrow(
    "Process did not exit after termination",
  );
  const rootPid = child.pid;
  if (rootPid === undefined) throw new Error("Child did not receive a PID");
  expect(() => process.kill(rootPid, 0)).not.toThrow();
});

CLI baseline

Save the following inline script as cli-exit-check.mjs, then run node cli-exit-check.mjs /absolute/path/to/trusted/built/checkout. It repeatedly calls the repository-defined version flag, not any command supplied in the issue. This is a limited negative control, not a native assertion test.

import { spawnSync } from "node:child_process";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";

const checkout = process.argv[2];
if (!checkout) throw new Error("Pass a trusted built checkout path");
const home = mkdtempSync(path.join(tmpdir(), "issue-5195-cli-"));
const failures = [];
const versions = new Set();
try {
  for (let attempt = 0; attempt < 20; attempt += 1) {
    const result = spawnSync(process.execPath, [
      path.join(checkout, "apps/cli/dist/index.js"),
      "--version",
    ], {
      encoding: "utf8",
      timeout: 10_000,
      env: { HOME: home, PATH: process.env.PATH, BB_CLI_REEXEC: "1" },
    });
    versions.add(result.stdout.trim());
    if (result.status !== 0 || result.stderr.length > 0 || result.error) {
      failures.push({
        attempt,
        status: result.status,
        signal: result.signal,
        stderr: result.stderr,
        error: result.error?.message,
      });
    }
  }
  console.log(JSON.stringify({
    platform: process.platform,
    node: process.version,
    attempts: 20,
    versions: [...versions],
    failures,
  }, null, 2));
  process.exitCode = failures.length === 0 ? 0 : 1;
} finally {
  rmSync(home, { recursive: true, force: true });
}
{
  "platform": "linux",
  "node": "v22.19.0",
  "attempts": 20,
  "versions": [
    "0.45.0"
  ],
  "failures": []
}

5. Root cause

Observed mechanism: absence of a lifecycle notification is treated as failed termination

The Windows helper runs the tree killer, attempts a root kill if exit metadata is absent, then waits for an exit event. Its one-second timer unconditionally rejects; it does not distinguish a still-live PID from a terminated root whose notification is pending. The reproduction separates those two facts with a real kernel liveness check.

packages/process-utils/src/windows-process-tree.ts:46

function waitForRootExit(child: ChildProcess): Promise<void> {
  if (hasExited(child)) return Promise.resolve();
  return new Promise((resolve, reject) => {
    const onExit = (): void => {
      clearTimeout(timer);
      resolve();
    };
    const timer = setTimeout(() => {
      child.off("exit", onExit);
      reject(new Error(`Process did not exit after termination: ${child.pid}`));
    }, 1_000);
    child.once("exit", onExit);
  });
}

export async function stopWindowsProcessTree(
  child: ChildProcess,
): Promise<ProcessStopResult> {
  if (child.pid === undefined || hasExited(child)) {
    return { treeTermination: "unverified" };
  }
  const terminated = await terminateWindowsProcessTrees([child.pid]);
  if (!hasExited(child)) child.kill("SIGKILL");
  await waitForRootExit(child);
  return { treeTermination: terminated ? "confirmed" : "unverified" };

Successful taskkill status is tracked separately, but the test-controlled callback does not prove Windows taskkill's native success semantics:

packages/process-utils/src/windows-process-tree.ts:23

    try {
      killer = execFile(
        path.join(
          process.env.SystemRoot ?? "C:\\Windows",
          "System32",
          "taskkill.exe",
        ),
        [...pids.flatMap((pid) => ["/pid", String(pid)]), "/T", "/F"],
        { windowsHide: true },
        (error) => finish(error === null),
      );
      timer = setTimeout(() => {
        finish(false);
        try {
          killer?.kill("SIGKILL");
        } catch {}
      }, 2_000);

The wrapper imposes a second metadata requirement

Managed stop caches its first stop promise and checks exit metadata again after the lower-level stop returns. An early return from the helper alone can still trigger the same error here. The Linux model directly tests the helper; this wrapper finding is static.

packages/process-utils/src/managed-process.ts:31

export function createProcessStop(child: ChildProcess): ManagedProcess["stop"] {
  let stopping: Promise<ProcessStopResult> | undefined;
  return function stop({ gracePeriodMs } = { gracePeriodMs: 1_000 }) {
    stopping ??= (async () => {
      if (child.pid === undefined) {
        return { treeTermination: "confirmed" };
      }
      const result = await stopProcessGroupLeaderFirst({
        child,
        timeoutMs: gracePeriodMs,
        killGraceMs: 1_000,
      });
      if (child.exitCode === null && child.signalCode === null) {
        throw new Error(`Process did not exit after termination: ${child.pid}`);
      }
      return result;
    })();
    return stopping;

The portable dispatcher selects that helper on Windows:

packages/process-utils/src/process-group.ts:71

export function stopProcessGroupLeaderFirst(
  args: StopProcessGroupLeaderFirstArgs,
): Promise<ProcessStopResult> {
  const { child, timeoutMs, killGraceMs } = args;
  if (process.platform === "win32") return stopWindowsProcessTree(child);
  if (hasChildExited(child) && !isProcessGroupAlive(child)) {
    return Promise.resolve({ treeTermination: "confirmed" });
  }
  return new Promise<ProcessStopResult>((resolveStop) => {

Why this can surface during a submit rather than only an explicit stop

The daemon's submit handler awaits starting or steering a turn. Starting a turn can await a recommended bridge restart, which awaits provider shutdown and then the managed stop. Thus a stop rejection can propagate through a submit path. Whether this is the exact branch used in the reported session is unverified: no provider-specific restart hint or native trace was supplied.

The companion CLI assertion is not explained

The CLI contains explicit exit branches in plugin-command proxying and error handling, but their existence is not evidence of a double-close or of the reported native failure. This investigation neither runs the Windows native event loop nor exercises successful plugin/network command shutdown. It would be unsafe to claim that the root-exit timeout explains the companion assertion.

CLI proxy completion and explicit exit branch. The source's native dependencies and the reporter's executable packaging also have not been compared.

6. Proposed fix and next experiment

No automatic patch is justified until a native Windows run reproduces the reported failure on trusted main. Capture the real root's liveness, taskkill status, exitCode/signalCode, and monotonic timestamps around its exit/close notifications while submitting tiny consecutive turns. Preserve the process-start identity to avoid confusing a recycled PID with the original child; distinguish access-denied probes from confirmed absence. Capture an assertion stack or dump separately for the CLI.

If native evidence confirms the modeled state, align the Windows stop helper and managed-stop wrapper around the same bounded definition of completed root termination. Retain independent descendant-tree verification, keep live-root termination failures fatal, and do not silently convert every timeout into success. A longer bounded wait may be appropriate, but its budget should be based on the native timeline rather than an arbitrary universal increase.

No PR: the automatic-fix gate requires reproducing the reported bug on trusted main. Only a modeled helper state is reproduced; native Windows turn submission and the CLI assertion remain unverified. No fix branch is created or pushed.

7. Related issues and pull requests

Issue #4866 concerns Windows process shutdown. Its metadata was reviewed as untrusted evidence, not executed or reused as test output. This report adds direct inspection of submit-time bridge restart and a separately authored, twice-run reproduction artifact. It does not close either issue as a duplicate because the companion CLI assertion remains unexplained.

No linked open PR was found in issue timeline cross-references, closing-PR metadata, or the repository's open-PR search for issue 5195 at investigation time. No PR branch was checked out or run.

8. Verification

The same investigator repeated the experiment in a second initially clean detached checkout at 8d9195d8e0f123ea32b21eb9eb1104b35d97b916. A fresh frozen install and full build succeeded. The same test was added without any production change, and Turbo test cache was forced off. Both test runs use new real process IDs; the CLI baseline uses another fresh temporary HOME. No ports or runtime data are needed for this unit-level experiment. This is a repeated verification by the same agent, not an independent review.

Second checkout command:
pnpm exec turbo run test --force --filter=@bb/process-utils -- test/issue-5195-delayed-notification.test.ts
@bb/process-utils:test: {"kernelRootGone":true,"status":"rejected","message":"Process did not exit after termination: 7959"}
Result: 1 failed, 2 passed; command exit 1

Existing-control command:
pnpm exec turbo run test --force --filter=@bb/process-utils -- test/windows-process-tree.test.ts test/process-tree.test.ts
Result: 11 passed; command exit 0

The second run supports the same partial verdict. No promotion to a native reproduction was made. Test cleanup was corrected during authoring to restore the child kill method before killing the live-root control; the published first and second logs both use that corrected cleanup. No production files were altered. All referenced code excerpts and line links were checked against the recorded base.

{
  "platform": "linux",
  "node": "v22.19.0",
  "attempts": 20,
  "versions": [
    "0.45.0"
  ],
  "failures": []
}

9. Appendix

Sanitized evidence

In accordance with the public report repository's policy, standalone tests, scripts, raw logs, and process scratch files are kept in the local report workspace, not committed. Both reproduction programs are complete inline above; sanitized test output is inline below.

First reproduction

• turbo 2.10.12

   • Packages in scope: @bb/process-utils
   • Running test in 1 packages
   • Remote caching disabled, using shared worktree cache

//:ensure-native-modules: cache bypass, force executing bb093d58c29b8635
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules FIRST_CHECKOUT
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
@bb/process-utils:test: cache miss, executing bc3534db0a148b05
@bb/process-utils:test: 
@bb/process-utils:test: > @bb/process-utils@0.0.1 test FIRST_CHECKOUT/packages/process-utils
@bb/process-utils:test: > vitest run --config vitest.config.ts "test/issue-5195-delayed-notification.test.ts"
@bb/process-utils:test: 
@bb/process-utils:test: 
@bb/process-utils:test:  RUN  v4.1.1 FIRST_CHECKOUT/packages/process-utils
@bb/process-utils:test: 
@bb/process-utils:test: stdout | test/issue-5195-delayed-notification.test.ts > accepts a terminated root while its Windows exit notification is delayed
@bb/process-utils:test: {"kernelRootGone":true,"status":"rejected","message":"Process did not exit after termination: 6977"}
@bb/process-utils:test: 
@bb/process-utils:test:  ❯ |@bb/process-utils:isolated| test/issue-5195-delayed-notification.test.ts (3 tests | 1 failed) 2260ms
@bb/process-utils:test:    × accepts a terminated root while its Windows exit notification is delayed 1062ms
@bb/process-utils:test:    ✓ accepts a root whose exit notification arrives within the deadline 124ms
@bb/process-utils:test:    ✓ still rejects when root termination fails and the root remains alive  1071ms
@bb/process-utils:test: 
@bb/process-utils:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
@bb/process-utils:test: 
@bb/process-utils:test:  FAIL  |@bb/process-utils:isolated| test/issue-5195-delayed-notification.test.ts > accepts a terminated root while its Windows exit notification is delayed
@bb/process-utils:test: AssertionError: expected { status: 'rejected', …(1) } to deeply equal { Object (status, result) }
@bb/process-utils:test: 
@bb/process-utils:test: - Expected
@bb/process-utils:test: + Received
@bb/process-utils:test: 
@bb/process-utils:test:   {
@bb/process-utils:test: -   "result": {
@bb/process-utils:test: -     "treeTermination": "confirmed",
@bb/process-utils:test: -   },
@bb/process-utils:test: -   "status": "resolved",
@bb/process-utils:test: +   "message": "Process did not exit after termination: 6977",
@bb/process-utils:test: +   "status": "rejected",
@bb/process-utils:test:   }
@bb/process-utils:test: 
@bb/process-utils:test:  ❯ test/issue-5195-delayed-notification.test.ts:77:18
@bb/process-utils:test:      75|   const result = await outcome;
@bb/process-utils:test:      76|   console.log(JSON.stringify({ kernelRootGone: true, ...result }));
@bb/process-utils:test:      77|   expect(result).toEqual({
@bb/process-utils:test:        |                  ^
@bb/process-utils:test:      78|     status: "resolved",
@bb/process-utils:test:      79|     result: { treeTermination: "confirmed" },
@bb/process-utils:test: 
@bb/process-utils:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
@bb/process-utils:test: 
@bb/process-utils:test: 
@bb/process-utils:test:  Test Files  1 failed (1)
@bb/process-utils:test:       Tests  1 failed | 2 passed (3)
@bb/process-utils:test:    Start at  09:27:35
@bb/process-utils:test:    Duration  2.65s (transform 45ms, setup 0ms, import 92ms, tests 2.26s, environment 0ms)
@bb/process-utils:test: 
@bb/process-utils:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/process-utils#test:  ERROR  command (FIRST_CHECKOUT/packages/process-utils) /usr/local/bin/pnpm run test test/issue-5195-delayed-notification.test.ts exited (1)

 Tasks:    1 successful, 2 total
Cached:    0 cached, 2 total
  Time:    4.927s 
Failed:    @bb/process-utils#test

 ERROR  run failed: command  exited (1)

Second reproduction

• turbo 2.10.12

   • Packages in scope: @bb/process-utils
   • Running test in 1 packages
   • Remote caching disabled, using shared worktree cache

//:ensure-native-modules: cache bypass, force executing bb093d58c29b8635
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules SECOND_CHECKOUT
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
//:ensure-native-modules: [ensure-native-modules] Detached hardlinked better-sqlite3 binary before verification
@bb/process-utils:test: cache bypass, force executing bc3534db0a148b05
@bb/process-utils:test: 
@bb/process-utils:test: > @bb/process-utils@0.0.1 test SECOND_CHECKOUT/packages/process-utils
@bb/process-utils:test: > vitest run --config vitest.config.ts "test/issue-5195-delayed-notification.test.ts"
@bb/process-utils:test: 
@bb/process-utils:test: 
@bb/process-utils:test:  RUN  v4.1.1 SECOND_CHECKOUT/packages/process-utils
@bb/process-utils:test: 
@bb/process-utils:test: stdout | test/issue-5195-delayed-notification.test.ts > accepts a terminated root while its Windows exit notification is delayed
@bb/process-utils:test: {"kernelRootGone":true,"status":"rejected","message":"Process did not exit after termination: 7959"}
@bb/process-utils:test: 
@bb/process-utils:test:  ❯ |@bb/process-utils:isolated| test/issue-5195-delayed-notification.test.ts (3 tests | 1 failed) 2218ms
@bb/process-utils:test:    × accepts a terminated root while its Windows exit notification is delayed 1062ms
@bb/process-utils:test:    ✓ accepts a root whose exit notification arrives within the deadline 106ms
@bb/process-utils:test:    ✓ still rejects when root termination fails and the root remains alive  1048ms
@bb/process-utils:test: 
@bb/process-utils:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
@bb/process-utils:test: 
@bb/process-utils:test:  FAIL  |@bb/process-utils:isolated| test/issue-5195-delayed-notification.test.ts > accepts a terminated root while its Windows exit notification is delayed
@bb/process-utils:test: AssertionError: expected { status: 'rejected', …(1) } to deeply equal { Object (status, result) }
@bb/process-utils:test: 
@bb/process-utils:test: - Expected
@bb/process-utils:test: + Received
@bb/process-utils:test: 
@bb/process-utils:test:   {
@bb/process-utils:test: -   "result": {
@bb/process-utils:test: -     "treeTermination": "confirmed",
@bb/process-utils:test: -   },
@bb/process-utils:test: -   "status": "resolved",
@bb/process-utils:test: +   "message": "Process did not exit after termination: 7959",
@bb/process-utils:test: +   "status": "rejected",
@bb/process-utils:test:   }
@bb/process-utils:test: 
@bb/process-utils:test:  ❯ test/issue-5195-delayed-notification.test.ts:77:18
@bb/process-utils:test:      75|   const result = await outcome;
@bb/process-utils:test:      76|   console.log(JSON.stringify({ kernelRootGone: true, ...result }));
@bb/process-utils:test:      77|   expect(result).toEqual({
@bb/process-utils:test:        |                  ^
@bb/process-utils:test:      78|     status: "resolved",
@bb/process-utils:test:      79|     result: { treeTermination: "confirmed" },
@bb/process-utils:test: 
@bb/process-utils:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
@bb/process-utils:test: 
@bb/process-utils:test: 
@bb/process-utils:test:  Test Files  1 failed (1)
@bb/process-utils:test:       Tests  1 failed | 2 passed (3)
@bb/process-utils:test:    Start at  09:28:52
@bb/process-utils:test:    Duration  2.54s (transform 46ms, setup 0ms, import 88ms, tests 2.22s, environment 0ms)
@bb/process-utils:test: 
@bb/process-utils:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/process-utils#test:  ERROR  command (SECOND_CHECKOUT/packages/process-utils) /usr/local/bin/pnpm run test test/issue-5195-delayed-notification.test.ts exited (1)

 Tasks:    1 successful, 2 total
Cached:    0 cached, 2 total
  Time:    4.463s 
Failed:    @bb/process-utils#test

 ERROR  run failed: command  exited (1)

First existing controls

• turbo 2.10.12

   • Packages in scope: @bb/process-utils
   • Running test in 1 packages
   • Remote caching disabled, using shared worktree cache

//:ensure-native-modules: cache bypass, force executing de5fe194269c8dee
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules FIRST_CHECKOUT
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
@bb/process-utils:test: cache miss, executing 7307ec5619fc7b5d
@bb/process-utils:test: 
@bb/process-utils:test: > @bb/process-utils@0.0.1 test FIRST_CHECKOUT/packages/process-utils
@bb/process-utils:test: > vitest run --config vitest.config.ts "test/windows-process-tree.test.ts" "test/process-tree.test.ts"
@bb/process-utils:test: 
@bb/process-utils:test: 
@bb/process-utils:test:  RUN  v4.1.1 FIRST_CHECKOUT/packages/process-utils
@bb/process-utils:test: 
@bb/process-utils:test:  ✓ |@bb/process-utils| test/process-tree.test.ts (7 tests) 802ms
@bb/process-utils:test:      ✓ escalates to the group when a member outlives the leader  325ms
@bb/process-utils:test:  ✓ |@bb/process-utils:isolated| test/windows-process-tree.test.ts (4 tests) 3217ms
@bb/process-utils:test:    ✓ falls back within a deadline when taskkill never completes  2052ms
@bb/process-utils:test:    ✓ rejects within a deadline when taskkill and root termination both fail  1051ms
@bb/process-utils:test: 
@bb/process-utils:test:  Test Files  2 passed (2)
@bb/process-utils:test:       Tests  11 passed (11)
@bb/process-utils:test:    Start at  09:27:40
@bb/process-utils:test:    Duration  3.60s (transform 170ms, setup 0ms, import 368ms, tests 4.02s, environment 0ms)
@bb/process-utils:test: 

 Tasks:    2 successful, 2 total
Cached:    0 cached, 2 total
  Time:    5.703s 

Second existing controls

• turbo 2.10.12

   • Packages in scope: @bb/process-utils
   • Running test in 1 packages
   • Remote caching disabled, using shared worktree cache

//:ensure-native-modules: cache bypass, force executing de5fe194269c8dee
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules SECOND_CHECKOUT
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
@bb/process-utils:test: cache bypass, force executing 7307ec5619fc7b5d
@bb/process-utils:test: 
@bb/process-utils:test: > @bb/process-utils@0.0.1 test SECOND_CHECKOUT/packages/process-utils
@bb/process-utils:test: > vitest run --config vitest.config.ts "test/windows-process-tree.test.ts" "test/process-tree.test.ts"
@bb/process-utils:test: 
@bb/process-utils:test: 
@bb/process-utils:test:  RUN  v4.1.1 SECOND_CHECKOUT/packages/process-utils
@bb/process-utils:test: 
@bb/process-utils:test:  ✓ |@bb/process-utils| test/process-tree.test.ts (7 tests) 791ms
@bb/process-utils:test:      ✓ escalates to the group when a member outlives the leader  323ms
@bb/process-utils:test:  ✓ |@bb/process-utils:isolated| test/windows-process-tree.test.ts (4 tests) 3230ms
@bb/process-utils:test:    ✓ falls back within a deadline when taskkill never completes  2056ms
@bb/process-utils:test:    ✓ rejects within a deadline when taskkill and root termination both fail  1052ms
@bb/process-utils:test: 
@bb/process-utils:test:  Test Files  2 passed (2)
@bb/process-utils:test:       Tests  11 passed (11)
@bb/process-utils:test:    Start at  09:28:57
@bb/process-utils:test:    Duration  3.60s (transform 209ms, setup 0ms, import 411ms, tests 4.02s, environment 0ms)
@bb/process-utils:test: 

 Tasks:    2 successful, 2 total
Cached:    0 cached, 2 total
  Time:    5.525s 

Build and typecheck

build-first.log
@bb/desktop:build: 
@bb/desktop:build: @bb/desktop: built Electron entries

 Tasks:    65 successful, 65 total
Cached:    4 cached, 65 total
  Time:    1m27.104s 



build-second.log
@bb/desktop:build: 
@bb/desktop:build: @bb/desktop: built Electron entries

 Tasks:    65 successful, 65 total
Cached:    63 cached, 65 total
  Time:    3.623s 



typecheck-first.log
@bb/process-utils:typecheck: > tsc --noEmit
@bb/process-utils:typecheck: 

 Tasks:    1 successful, 1 total
Cached:    0 cached, 1 total
  Time:    930ms 

Trust and test-value notes

Issue title, body, comments, suggestions, and links were untrusted claims. No issue-provided script, command, patch, binary, branch, or external URL was executed or fetched. Reproduction code was written from trusted repository evidence. No dependency was added, no real user daemon was contacted, and no credential was read or published. Both target and report repositories were checked as public before publication.

The test protects the distinction between actual root liveness and delayed exit notification. Existing Windows tests cover prompt exit, taskkill timeout, live-root failure, and recycled-PID avoidance, but not delayed notification after confirmed root death. It requires no production seam and restores its mocked module behavior; a real child and independent ESRCH probe keep the kernel-death observation outside the mock. Notification delay and taskkill status remain explicit model assumptions, not proof of native behavior.

Execution inventory

git fetch origin main
git worktree add --detach FIRST_CHECKOUT 8d9195d8e0f123ea32b21eb9eb1104b35d97b916
git worktree add --detach SECOND_CHECKOUT 8d9195d8e0f123ea32b21eb9eb1104b35d97b916
pnpm install --frozen-lockfile --prefer-offline  (in each checkout)
pnpm exec turbo run build  (in each checkout)
pnpm exec oxfmt packages/process-utils/test/issue-5195-delayed-notification.test.ts
pnpm exec turbo run test --filter=@bb/process-utils -- test/issue-5195-delayed-notification.test.ts
pnpm exec turbo run test --filter=@bb/process-utils -- test/windows-process-tree.test.ts test/process-tree.test.ts
pnpm exec turbo run typecheck --filter=@bb/process-utils
pnpm exec turbo run test --force --filter=@bb/process-utils -- test/issue-5195-delayed-notification.test.ts  (second checkout)
pnpm exec turbo run test --force --filter=@bb/process-utils -- test/windows-process-tree.test.ts test/process-tree.test.ts  (second checkout)
node cli-exit-check.mjs FIRST_CHECKOUT
node cli-exit-check.mjs SECOND_CHECKOUT
git diff --check
GitHub metadata reads: target/report visibility, issue properties/labels, comments, related issue metadata, PR cross-references and open PR search.
GitHub classification writes: Bug / High / Medium / host / cli, using the supplied SlopCop write command.
Publication: single-issue skill publisher without its comment or label flags; all GitHub writes route through the supplied SlopCop wrapper.
Finalization: partial-repro label and one final marked issue comment, using the supplied SlopCop write command.

The versioned report contains sanitized, inline reproduction code and output limited to this issue. The report's reproduction label denotes partial modeled evidence, not native confirmation.