github / github/copilot-cli

nfinite recursion (Shim <-> Native ping-pong) when executing copilotCLI via copilotCLIShim.js

Abierto
#2,274 0 comentarios 2 reacciones 0 asignados Ver en GitHub
area:installation
Lenguaje dominante
Shell
Estrellas
11.2k
Forks
1.9k
Merge medio
14 h 16 min
PR fusionados (30 d)
6

Descripción

### Describe the bug

## GitHub Issue Draft

**Title:** Infinite recursion (Shim <-> Native ping-pong) when executing `copilotCLI` via `copilotCLIShim.js`

### Description
While developing tools utilizing `copilotCli`, I discovered a critical bug where the process spawns child processes indefinitely, leading to an Out of Memory (OOM) state or system hang.

Based on the analysis of the agent conversation history and process monitoring, the issue is not within the VS Code extension itself, but rather a **recursive execution loop** within the `copilot` CLI binary/shim layer.

### Analysis & Evidence
The `copilot` executable is a shell script that calls `copilotCLIShim.js` using Electron as Node:

```sh
#!/bin/sh
unset NODE_OPTIONS
ELECTRON_RUN_AS_NODE=1 "/usr/share/code/code" "/home/dhyang/.config/Code/User/globalStorage/github.copilot-chat/copilotCli/copilotCLIShim.js" "$@"
```

When a single `copilot` command is executed, the process count explodes exponentially. In a controlled test, a single call resulted in over **2,100 processes** within 60 seconds (approximately 37 forks per second).

### Investigation Log
Below is the terminal output capturing the abnormal process growth during a single execution:

```bash
# Monitoring process count in background
while true; do n=$(pgrep -c -f "copilotCli" 2>/dev/null || echo 0); echo "$(date +%H:%M:%S) procs=$n"; sleep 1; done

# Executing a single command
START: 14:30:01
timeout 60 copilot --yolo --prompt "say hello" --model claude-sonnet-4.6 --silent --disable-builtin-mcps
...
END: 14:31:01 exit:124 (Timeout)
```

**Key Findings:**
* **Process Explosion:** 0 → 2,198 processes in 60 seconds.
* **Symptom:** The `copilot` CLI binary continuously forks child processes without termination.
* **Root Cause Hypothesis:** A "ping-pong" recursion between the `copilot` shim script and the native execution logic, where each process attempts to invoke another instance of itself.

### Environment
* OS: Linux (Ubuntu/Debian based on `/usr/share/code` path)
* Extension: github.copilot-chat
* Component: copilotCli / copilotCLIShim.js

### Affected version

GitHub Copilot CLI 1.0.11.

### Steps to reproduce the behavior

_No response_

### Expected behavior

_No response_

### Additional context

_No response_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.