setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 80/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nodejs, typescript
Direzione di ricerca
Inizia da runCli in server/src/learning/ensure-container.ts (intorno alle righe 124-149), dove spawn viene chiamato senza shell su Windows, e segui il punto di ingresso da scripts/setup-learning.ts. Riproduci su Windows con bun scripts/setup-learning.ts per vedere l'EINVAL, e verifica che il gestore child.on("error") venga bypassato. Completato quando lo script di setup viene eseguito su Windows e i comandi CLI hanno successo, con il comportamento su macOS e Linux invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- TypeScript
- Stelle
- 6.3k
- Fork
- 863
- Merge medio
- 17h 38m
- PR unite (30g)
- 161
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CopilotKit/OpenBot
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
CopilotKit/OpenBot#800 ·
I maintainer di solito rispondono entro 1 giorno
-
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)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 Più di una settimana Idoneità per principianti 22/100
CopilotKit/OpenBot#786 ·
I maintainer di solito rispondono entro 1 giorno
-
server/tests leaks database connections: 55 files open a pool and never close itForse già presa @adamsiwiec1 l’ha presa 2 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
CopilotKit/OpenBot#785 ·
I maintainer di solito rispondono entro 1 giorno
-
brokered_connections: two reads carry no provider predicate (blocks the provider sunset flow)Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
CopilotKit/OpenBot#783 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CopilotKit/OpenBot#767 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di CopilotKit/OpenBot
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ranxianglei/billion-context#3583 ·
I maintainer di solito rispondono entro 1 giorno
-
bug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
callstackincubator/simlock#673 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation v3
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
anomalyco/opencode#56380 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno