-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
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:
#!/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:
# 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
copilotCLI binary continuously forks child processes without termination. - Root Cause Hypothesis: A "ping-pong" recursion between the
copilotshim 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/codepath) - 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