setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 80/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
調査の方向性
server/src/learning/ensure-container.ts の runCli(124〜149行目付近)から始めてください。Windows では shell を指定せずに spawn が呼ばれています。scripts/setup-learning.ts からのエントリポイントもたどってください。Windows で bun scripts/setup-learning.ts を実行して EINVAL を再現し、child.on("error") のハンドラが迂回されていないか確認してください。セットアップスクリプトが Windows で動作し、CLI コマンドが成功すれば完了です。macOS と Linux の動作は変わらないことが条件です。
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- TypeScript
- スター
- 6.3k
- フォーク
- 863
- 平均マージ
- 17時間 38分
- マージ済み PR(30日)
- 161
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CopilotKit/OpenBot のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
CopilotKit/OpenBot#800 ·
メンテナーはふだん 1 日以内に返信
-
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)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 1週間以上 初心者へのやさしさ 22/100
CopilotKit/OpenBot#786 ·
メンテナーはふだん 1 日以内に返信
-
server/tests leaks database connections: 55 files open a pool and never close it対応中かも @adamsiwiec1 が 2 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
CopilotKit/OpenBot#785 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
CopilotKit/OpenBot#783 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
CopilotKit/OpenBot#767 ·
メンテナーはふだん 1 日以内に返信
CopilotKit/OpenBot の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ranxianglei/billion-context#3583 ·
メンテナーはふだん 1 日以内に返信
-
bug:new
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
callstackincubator/simlock#673 ·
メンテナーはふだん 1 日以内に返信
-
documentation v3
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
anomalyco/opencode#56380 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信