setup-learning.ts fails on Windows with "spawn npx.cmd EINVAL"
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 80/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nodejs, typescript
Hướng nghiên cứu
Bắt đầu từ runCli trong server/src/learning/ensure-container.ts (khoảng dòng 124-149), nơi spawn được gọi mà không có shell trên Windows, rồi lần theo điểm vào từ scripts/setup-learning.ts. Tái hiện trên Windows bằng bun scripts/setup-learning.ts để thấy lỗi EINVAL, và kiểm tra xem trình xử lý child.on("error") có bị bỏ qua hay không. Hoàn thành khi script thiết lập chạy được trên Windows và các lệnh CLI thành công, đồng thời hành vi trên macOS và Linux không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- TypeScript
- Star
- 6.3k
- Fork
- 863
- Merge trung bình
- 17 giờ 52 phút
- Pull request đã merge (30 ngày)
- 155
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CopilotKit/OpenBot
-
Wrong key location at startupCó thể đã có người làm @charan-rathore đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
CopilotKit/OpenBot#800 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
CopilotKit/OpenBot#804 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
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)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 Hơn một tuần Mức phù hợp với người mới 22/100
CopilotKit/OpenBot#786 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
server/tests leaks database connections: 55 files open a pool and never close itCó thể đã có người làm @adamsiwiec1 đã nhận 2 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
CopilotKit/OpenBot#785 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
brokered_connections: two reads carry no provider predicate (blocks the provider sunset flow)Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
CopilotKit/OpenBot#783 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của CopilotKit/OpenBot
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
auth: agent-bearer --manager-call is told to use the MCP instance argument on an ambiguous managerĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Lyric and ApostrophesĐang mởbug module: playback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
chthollyphile/folia-major#739 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
agilepathway/label-checker#773 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày