Skip to content

npx vitest run hangs when running full test suites via Copilot CLI terminal #3308

Closed

Description

@JackUkleja

Describe the bug

Summary

Running npx vitest run for a full test suite hangs indefinitely when executed through the GitHub Copilot CLI terminal. The same command works fine in a regular PowerShell/cmd terminal.

Environment

  • Tool: GitHub Copilot CLI (VS Code)
  • OS: Windows
  • Node: v22.14.0
  • npm: 10.9.2
  • Vitest: v4.1.2

Reproduction Steps

  1. Open a Copilot CLI terminal session in VS Code
  2. Run npx vitest run
  3. Vitest starts, queues all test files, runs a few, then hangs with no further output
  4. Typically nothing is seen piped back to the session window (the above has been deduced)

What Works

  • Running a single test file works fine: npx vitest run some.test.ts
  • Running batches of up to ~10 files works fine
  • Running with JSON output to file works and completes successfully:
    npx vitest run --reporter=json --outputFile=test-results.json
    

Root Cause

According to copilot which tried to diagnose this:
Vitest's default live reporter continuously rewrites terminal output using ANSI escape sequences (cursor movement, line clearing) for all queued files simultaneously. This high-volume ANSI output appears to overflow or deadlock the Copilot CLI's stdout pipe, causing the process to hang.

Redirecting output to a file bypasses the pipe entirely and the suite completes normally.

Workaround

npx vitest run --reporter=json --outputFile=test-results.json

Suggested Fix

Affected version

vs code 1.120.0

Steps to reproduce the behavior

  1. Open a Copilot CLI terminal session in VS Code
  2. Run npx vitest run
  3. Vitest starts, queues all test files, runs a few, then hangs with no further output
  4. Typically nothing is seen piped back to the session window (the above has been deduced)

Expected behavior

See output of vitest

Additional context

No response

Activity

  1. added theissue type on May 13, 2026
  2. added
    area:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior
    area:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminal
    on May 14, 2026
  3. JackUkleja commented on May 26, 2026

    @JackUkleja
    Author

    This has occurred again, and not for vitest so that may be unrelated. This is what copilot has deduced:

    A Copilot CLI session entered a permanent Processing state (for 6+ hours) even though no tool process was still running.
    The session event stream ended on a tool start event and never emitted the corresponding tool completion event.

    Environment

    OS: Windows 11
    VS Code: 1.121.0
    GitHub Copilot Chat extension: 0.49.0
    Session type: Copilot CLI isolated worktree session
    Workspace: large TypeScript repo with npm verify scripts

    What happened

    Session showed Processing indefinitely in the UI.
    No active child process remained for the reported command.
    Event stream count mismatch: 53 tool starts, 52 tool completions.
    Last recorded event was tool.execution_start at 2026-05-26 19:06:41 local time.
    No matching tool.execution_complete was ever written for that final tool call.

    Expected behavior

    Every tool.execution_start should eventually resolve to one terminal state:
    tool.execution_complete success, or
    tool.execution_complete error, or
    explicit cancellation/failure state
    UI should not remain in Processing forever when no active process exists.

    Actual behavior

    UI remained stuck on Processing for hours.
    Session did not self-recover or fail fast.
    Manual session reset was required.

    Repro notes

    I cannot provide a guaranteed minimal repro yet, but this occurred during a normal multi-step coding run where the agent executed verification scripts, then continued with follow-up tool calls.
    In this incident, the verify command was not the direct hanging point; the wedge happened after a later tool call started and never emitted completion.

    Relevant log signals

    Session created normally and tracked by OpenTelemetry.
    Early warning observed once: failed to get session title due to missing events file ENOENT.
    Repeated MCP transport warnings were present in the same window (SSE disconnected), which may be related but are unproven as root cause.
    The critical signal is the unmatched lifecycle event: tool start without tool completion.

    Impact

    Session appears active but is deadlocked.
    User cannot distinguish real progress from zombie state.
    Wastes significant time and requires manual cleanup.

    Can provide on request

    Redacted session events stream showing final unmatched tool start.
    Redacted extension host log excerpt around the failure window.
    Screenshot of stuck Processing UI.

  4. JackUkleja commented on May 26, 2026

    @JackUkleja
    Author

    possible duplicates:
    #3366
    #2543
    microsoft/vscode#302551

  5. JackUkleja commented on May 28, 2026

    @JackUkleja
    Author

    Last thoughts from copilot investigating itself:

    Root cause of the interruptions (from log analysis): The VS Code extension host became unstable in the original session (in-memory DB fallback, .git/config ENOENT, session repeatedly closing/reopening). Both apply_patch calls started but never got execution_complete events — the extension host was killed mid-flight.

  6. copilot-cli-bot commented on Oct 26, 2026

    @copilot-cli-bot

    This appears to be resolved as of GitHub Copilot CLI v1.0.103. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

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

    area:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminalarea:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions