setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 80/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- nodejs, typescript
Piste de recherche
Commence par runCli dans server/src/learning/ensure-container.ts (autour des lignes 124-149), où spawn est appelé sans shell sous Windows, puis remonte l'entrée depuis scripts/setup-learning.ts. Reproduis le problème sous Windows avec bun scripts/setup-learning.ts pour voir l'EINVAL, et vérifie que le gestionnaire child.on("error") est contourné. Terminé lorsque le script de configuration s'exécute sous Windows et que les commandes CLI réussissent, le comportement sous macOS et Linux restant inchangé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
On Windows, bun scripts/setup-learning.ts (Quick start, step 2) stops before doing anything, and prints only this:
PS C:\...\openbot> bun scripts/setup-learning.ts
spawn npx.cmd EINVAL
npx --yes copilotkit@latest login and project select had both succeeded beforehand, from the OpenBot root. Nothing is written to .env, so neither the runtime key nor the openbot Learning container is set up.
Cause
runCli in server/src/learning/ensure-container.ts:124-149 starts the CopilotKit CLI like this:
const child = spawn(
process.platform === "win32" ? "npx.cmd" : "npx",
["--yes", "copilotkit@latest", ...args],
{ cwd: directory, env: cliEnvironment(), stdio: ["ignore", "pipe", "pipe"] },
);
Since the fix for CVE-2024-27980, Node refuses to spawn a .cmd or .bat file without shell: true, and Bun does the same. The refusal is a synchronous EINVAL thrown by spawn() itself, not an 'error' event. As a result, the child.on("error", () => finish(127)) handler at line 147 never runs. The throw happens inside the Promise executor, so it becomes a rejection, and setup-learning.ts exits with the bare message.
Minimal reproduction, Bun 1.4.3 on Windows 11:
import { spawn } from "node:child_process";
spawn("npx.cmd", ["--version"]); // throws: spawn npx.cmd EINVAL
spawn("npx.cmd", ["--version"], { shell: true }); // runs, prints 11.19.0
The server calls the same runCli from ensureLearningContainer at boot (server/src/index.ts:360) when a CLI login is present. Automatic container creation should therefore fail the same way on Windows, although I have only reproduced it through the setup helper.
Suggested fix
Run through the shell on Windows only:
{
cwd: directory,
env: cliEnvironment(),
shell: process.platform === "win32",
stdio: ["ignore", "pipe", "pipe"],
}
With shell: true the arguments are joined into a cmd.exe command line rather than passed as an argv. That is safe here because every caller passes literals (whoami, project list --json). cliEnvironment() already keeps COMSPEC, SystemRoot and PATHEXT, so cmd.exe resolves. macOS and Linux are unchanged.
Windows 11 Enterprise 10.0.26200, Bun 1.4.3, Node 24.21.0 / npm 11.19.0, OpenBot at 8c9ad4c. Related: #679 and #681 (other Windows checkout problems).
- Langage dominant
- TypeScript
- Étoiles
- 6.3k
- Forks
- 863
- Merge moyen
- 17 h 38 min
- PR mergées (30 j)
- 161
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de CopilotKit/OpenBot
-
Wrong key location at startupPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
CopilotKit/OpenBot#800 ·
Les mainteneurs répondent en général sous 1 jour
-
Five out-of-subject findings from PR #770's tier-3 review (credential-revoking tests, single-user boot gate, OAuth client rotation, shared-use atomicity, untyped server/tests)Peut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 4/5 Plus d'une semaine Accessibilité débutants 22/100
CopilotKit/OpenBot#786 ·
Les mainteneurs répondent en général sous 1 jour
-
server/tests leaks database connections: 55 files open a pool and never close itPeut-être pris @adamsiwiec1 l’a pris il y a 2 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 70/100
CopilotKit/OpenBot#785 ·
Les mainteneurs répondent en général sous 1 jour
-
brokered_connections: two reads carry no provider predicate (blocks the provider sunset flow)Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
CopilotKit/OpenBot#783 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
CopilotKit/OpenBot#767 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de CopilotKit/OpenBot
Issues similaires
-
backend priority:P3 privacy-fix
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: 【优化】对话消息底部增加发送时间展示Ouvertebug desktop v3 windows
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
esengine/DeepSeek-Reasonix#13697 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
area:security documentation effort:S priority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
Les mainteneurs répondent en général sous 1 jour
-
app:web meta:ops
Difficulté 2/5 Une demi-journée Accessibilité débutants 78/100
osu-tournament-rating/otr#1113 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100