setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 80/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- nodejs, typescript
Direção de pesquisa
Comece por runCli em server/src/learning/ensure-container.ts (por volta das linhas 124-149), onde spawn é chamado sem shell no Windows, e acompanhe a entrada a partir de scripts/setup-learning.ts. Reproduza no Windows com bun scripts/setup-learning.ts para ver o EINVAL, e verifique se o handler child.on("error") é contornado. Concluído quando o script de configuração rodar no Windows e os comandos da CLI forem bem-sucedidos, com o comportamento em macOS e Linux inalterado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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).
- Linguagem predominante
- TypeScript
- Estrelas
- 6.6k
- Forks
- 914
- Merge médio
- 17h 52min
- PRs com merge (30d)
- 155
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de CopilotKit/OpenBot
-
Wrong key location at startupTalvez já em andamento @charan-rathore assumiu há 1 dia. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
CopilotKit/OpenBot#800 ·
Mantenedores costumam responder em até 1 dia
-
Remote AG-UI Bots can't use the browser in chat: `computer_*` calls refused as "unavailable for this headless turn"Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
CopilotKit/OpenBot#804 ·
Mantenedores costumam responder em até 1 dia
-
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)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 4/5 Mais de uma semana Facilidade para iniciantes 22/100
CopilotKit/OpenBot#786 ·
Mantenedores costumam responder em até 1 dia
-
server/tests leaks database connections: 55 files open a pool and never close itTalvez já em andamento @adamsiwiec1 assumiu há 3 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 70/100
CopilotKit/OpenBot#785 ·
Mantenedores costumam responder em até 1 dia
-
brokered_connections: two reads carry no provider predicate (blocks the provider sunset flow)Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
CopilotKit/OpenBot#783 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de CopilotKit/OpenBot
Issues semelhantes
-
freshness freshness:observed-only
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
thoroc/context-radar#280 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
-
documentation story
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Billing: computeBundleEconomicsFrom treats a NULL component cost as 0, inflating bundle marginAbertabug category:billing priority:p3 track:fast
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
LanternOps/breeze#9223 ·
Mantenedores costumam responder em até 1 dia