Skip to content

fix(runtime-path): add ~/.kimi-code/bin + ~/.grok/bin to spawn PATH (#98)#102

Merged
chorus-codes merged 1 commit into
mainfrom
fix/kimi-grok-spawn-path
May 31, 2026
Merged

fix(runtime-path): add ~/.kimi-code/bin + ~/.grok/bin to spawn PATH (#98)#102
chorus-codes merged 1 commit into
mainfrom
fix/kimi-grok-spawn-path

Conversation

@chorus-codes
Copy link
Copy Markdown
Owner

Third #98 follow-up — closes codex's PR #101 review note that a fallback-detected kimi not on the daemon PATH would ENOENT.

Root cause: two per-CLI install-dir lists drifted. cli-detect.ts:fallbackPaths() (detection) probes ~/.kimi-code/bin + ~/.grok/bin; runtime-path.ts:KNOWN_INSTALL_DIRS (spawn PATH) didn't. Native Kimi Code / grok installed to its dot-dir but absent from the user's PATH → detected-but-ENOENT on bare-name spawn.

Fix: add the two dirs to KNOWN_INSTALL_DIRS (existence-gated + deduped, same as every other CLI). One-list change + behavioural test.

Tests: buildRuntimePath() with a temp $HOME includes the dirs when present, omits when absent, and still includes the pre-existing ~/.kimi/bin. Full suite 1024 passed.

Review: chorus review-only → approved 6/7. The lone dissent (gemini) asked to (a) spawn the resolved absolute path and (b) extract a shared constant. Both intentionally out of scope: (a) is a larger refactor tracked as a separate issue; (b) over-couples two lists that legitimately differ (detection also probes npm/yarn/volta prefixes the spawn list shouldn't carry). Cross-reference comment + #98 anchor is the chosen guardrail.

)

Detection (cli-detect.ts fallbackPaths) probes ~/.kimi-code/bin and
~/.grok/bin, but the daemon's spawn-PATH builder (runtime-path.ts
KNOWN_INSTALL_DIRS) didn't list them. So a native Kimi Code (or grok)
install in its dot-dir that isn't on the user's interactive PATH got a
green "detected" yet ENOENT'd when runHeadless spawned the bare binary
name. Aligning the two lists closes that drift — the dirs are still
existence-gated (fs.existsSync) and deduped, matching every other CLI.

Test: buildRuntimePath() with a temp $HOME includes ~/.kimi-code/bin and
~/.grok/bin when present, omits when absent, still includes ~/.kimi/bin.

Chorus self-review: approved (6 of 7; lone dissent asked for a larger
absolute-path-spawn refactor + shared-constant dedup — both deliberately
out of scope: the deeper spawn-by-path item is tracked separately, and a
shared constant would over-couple two lists that legitimately differ).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant