Skip to content

Windows: turn.submit fails with Process did not exit after termination: <pid>, plus UV_HANDLE_CLOSING assertion on bb CLI exit (0.45.0) #5195

Closed as not planned

Description

@kvginnovate

Environment. bb 0.45.0 desktop, Windows 11 (x64), Node v24.14.1, local host daemon.

Related. This looks like the same underlying Windows process-teardown race as #4866 (Process did not exit after termination: <pid> on thread stop / idle runtime shutdown). Filing separately because the trigger path here is turn.submit between turns rather than thread-stop/idle-shutdown — please close as a duplicate of #4866 if you'd rather track it there.

Symptom. Sending a new message while the previous turn is still finishing fails with:

Command turn.submit failed
Process did not exit after termination: 33268

The lingering PID (33268 in this run) is a bb.exe child from the prior turn. The work from the previous turn had already completed; retrying the submit recovers and nothing is actually left running.

Companion crash on CLI exit. In the same sessions, individual bb <command> invocations frequently print, on process exit:

Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 76

This is emitted after the command's normal output has already been written to stdout, so the command's effect lands and only the clean shutdown fails. Example: bb plugin reload <id> reports the plugin as running and then exits non-zero with this assertion.

Impact. Benign but disruptive to automation: any script or agent that chains bb subcommands, or submits a turn promptly after the previous one, hits spurious failures even though the operations succeeded.

Reproduction (observed, not a minimal repro).

  1. On Windows, drive bb via the CLI/ACP so turns run back to back.
  2. Submit a new user message right as the previous turn is wrapping up.
  3. Intermittently: turn.submit failed: Process did not exit after termination: <pid>.
  4. Separately, run several bb subcommands in sequence; some exit with the UV_HANDLE_CLOSING assertion from src\win\async.c:76 after printing their output.

Suggested fix. Same as proposed in #4866: when the win32 root-exit wait times out, treat the stop as confirmed if the process is already terminated (process.kill(pid, 0) throwing ESRCH) instead of throwing, and allow a longer wait once termination is confirmed. The turn.submit path appears to go through the same waitForRootExit / process-stop logic, so that fix should cover this trigger too.

Activity

  1. added theissue type on Oct 8, 2026
  2. added
    host
    cli
    partial-repro
    on Oct 8, 2026
  3. bb-slop-cop commented on Oct 8, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification: Bug · Priority: High · Effort: Medium · host, cli.

    Report: Reproduction and root-cause report.

    Verdict: PARTIALLY REPRODUCED · Confidence: medium · Reproduction label: partial-repro.

    Evidence: The delayed-notification regression fails in two clean trusted-main checkouts: the real root PID is gone, but the Windows helper rejects. Both added controls and 11 existing process-tree tests pass in each checkout. Native Windows submission and the companion CLI assertion remain unverified.

    Root cause: The Windows helper's one-second timeout treats a missing exit notification as failed termination; the managed-stop wrapper separately requires exit metadata. This mechanism is verified in a model, not a native Windows session.

    No PR: The reported native Windows failure was not directly reproduced, so the automatic-fix gate is not met.

    AGENT GENERATED

  4. SawyerHood commented on Oct 19, 2026

    @SawyerHood
    Collaborator

    Consolidated into #4866 at the maintainer's request. Added the source context, evidence links and any distinct/unverified follow-up scope to the canonical tracker: #4866 (comment)

    Closing this report for tracking consolidation, not as fixed. Please continue investigation and updates in #4866; this report remains linked as original evidence.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clihostpartial-repro

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions