setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 80/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- nodejs, typescript
Rechercherichtung
Beginne mit runCli in server/src/learning/ensure-container.ts (etwa Zeilen 124-149), wo spawn unter Windows ohne shell aufgerufen wird, und verfolge den Einstieg von scripts/setup-learning.ts. Reproduziere das unter Windows mit bun scripts/setup-learning.ts, um den EINVAL zu sehen, und prüfe, ob der child.on("error")-Handler umgangen wird. Fertig ist es, wenn das Setup-Skript unter Windows läuft und die CLI-Befehle erfolgreich sind, während das Verhalten unter macOS und Linux unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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).
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.3k
- Forks
- 863
- Ø Merge
- 17 Std. 38 Min.
- Gemergte PRs (30 T.)
- 161
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CopilotKit/OpenBot
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
CopilotKit/OpenBot#800 ·
Maintainer antworten meist innerhalb von 1 Tag
-
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)Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 4/5 Über eine Woche Anfängerfreundlichkeit 22/100
CopilotKit/OpenBot#786 ·
Maintainer antworten meist innerhalb von 1 Tag
-
server/tests leaks database connections: 55 files open a pool and never close itEvtl. vergeben @adamsiwiec1 hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
CopilotKit/OpenBot#785 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
CopilotKit/OpenBot#783 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
CopilotKit/OpenBot#767 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in CopilotKit/OpenBot
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 83/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
ranxianglei/billion-context#3583 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
callstackincubator/simlock#673 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation v3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
anomalyco/opencode#56380 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag