Windows: tryExec probes binaries with `command -v`, so every binary check false-negatives (DetectEnv reports bun/git absent; LinkUser silently skips git init)

Đang mở Phù hợp với người mới
#3,023 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

Chưa có ai nhận issue nà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
78/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ệ
bun, typescript
Lĩnh vực
operating-systems, tooling

Hướng nghiên cứu

Bắt đầu với skills/LifeOS/Tools/InstallEngine.ts, đặc biệt là tryExec, detectTool, detectHarness và initLocalRepo, sau đó chạy bài kiểm tra detectTool được cung cấp trên Windows. Thay thế việc phát hiện binary chỉ dành cho POSIX bằng cách tra cứu an toàn trên nhiều nền tảng, vẫn giữ nguyên các lệnh phiên bản, rồi xác minh DetectEnv, việc phát hiện harness và quá trình khởi tạo repository qua LinkUser. Hoàn thành khi các binary git, bun và harness đã cài đặt được phát hiện trên Windows, git init chạy khi có Git và hành vi hiện có trên các hệ thống không phải Windows vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Version

LifeOS 8.761.0 · attestation: unattested (could not extract v8.761.0: tar (child): Cannot connect to C: resolve failed

gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now)

What is broken

On Windows every binary-presence probe in the install tools returns a false negative, because tryExec hands its argument to execSync with no shell override: Node then spawns %ComSpec% (cmd.exe), where command -v is not a command, so the call throws and the helper returns null. Three call sites read that as "the binary is not installed". detectTool backs the bun and git fields of DetectEnv and the environment block of Report.ts collect, both of which report the tools absent on a machine where they run normally. detectHarness's hasBin can never match a harness binary, so harness confidence is pinned at assumed even when the claude CLI is on PATH, and Setup step 1 asks the operator to confirm a harness the code could have proven. initLocalRepo takes its git-missing branch, so LinkUser skips git init on both the USER tree and the config root and records "reason": "git not found on PATH". That last one is the costly symptom: the boundary symlinks are established and the install reports success, so a Windows install silently ends up with no local history on the principal's personal tree, which is the thing that step exists to provide.

Where (file:line)

skills/LifeOS/Tools/InstallEngine.ts:85 (tryExec); call sites :113 detectTool, :137 detectHarness hasBin, :1070 initLocalRepo

Repro on a clean tree
# Windows 11, git-bash shell. git and bun are both installed and resolve on PATH.

git clone --depth 1 https://github.com/danielmiessler/LifeOS   # HEAD 94bd8f2
T="$PWD/LifeOS/LifeOS"

# p.ts calls the SHIPPED exported detectTool and prints no filesystem paths:
#   const root = process.argv[2];
#   const { detectTool } = await import(`${root}/Tools/InstallEngine.ts`);
#   for (const [bin, v] of [["git","git --version"], ["bun","bun --version"]])
#     console.log(bin, detectTool(bin, v).installed, !!Bun.which(bin));

bun p.ts "$T"
# Seen:     git: detectTool says installed=false | resolves on PATH=true
#           bun: detectTool says installed=false | resolves on PATH=true
# Expected: installed=true for both

# The same cause, observed through the shipped tools on a real install:

bun Tools/DetectEnv.ts
#   "bun": { "installed": false }     <- bun is running this very script
#   "git": { "installed": false }
#   "harness": { "name": "claude-code", "confidence": "assumed" }   <- claude IS on PATH

bun Tools/InstallAll.ts --yes --json
#   LinkUser "repo"       -> { "action": "skipped", "reason": "git not found on PATH" }
#            "configRepo" -> { "action": "skipped", "reason": "git not found on PATH" }
#   ...while `git --version` in the same shell prints git version 2.56.1.windows.1
Negative control

Probe: bun C:/lifeos-repro/probes/p-commandv.ts C:/lifeos-repro/upstream/LifeOS · exit 1 · captured 2026-11-29T01:31:58.967Z

Red looks like: RED: shipped detectTool reports a binary absent while it is installed and on PATH

git: detectTool says installed=false | resolves on PATH=true
bun: detectTool says installed=false | resolves on PATH=true
RED: shipped detectTool reports a binary absent while it is installed and on PATH
Suggested fix

Untested shape. Resolve binary presence with a runtime API rather than a POSIX shell builtin: Bun.which(name) is already used elsewhere in the payload (LIFEOS/TOOLS/lifeos.ts uses it for the claude lookup) and is platform-correct. detectTool could use it for the presence check and keep tryExec only for the version string, which is a real command on every platform. Alternatively branch tryExec on process.platform and use where instead of command -v on Windows. The guard at :1070 has a third option: drop the probe entirely and let git init fail, since initLocalRepo already handles a failed init and reports it.

Note that the POSIX assumption in tryExec is wider than these three call sites: detectOS also shells out to sw_vers, uname and cat /etc/os-release through the same helper, which is why the Windows branch there already special-cases ver.

Environment
  • OS: Windows (x64)
  • Harness: claude-code
  • bun: not found · git: not found
  • Doctor broken: identity-placeholders, ripgrep, imagemagick, ffmpeg, ytdlp, jq
Ngôn ngữ chính
TypeScript
Star
20k
Fork
2.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của danielmiessler/LifeOS

Tất cả issue của danielmiessler/LifeOS

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.