Skip to content

fix: use platform-native path separators in user-facing output (Windows)#449

Closed
RTCartist wants to merge 3 commits into
MoonshotAI:mainfrom
RTCartist:fix/doctor-windows-path-separators
Closed

fix: use platform-native path separators in user-facing output (Windows)#449
RTCartist wants to merge 3 commits into
MoonshotAI:mainfrom
RTCartist:fix/doctor-windows-path-separators

Conversation

@RTCartist
Copy link
Copy Markdown

@RTCartist RTCartist commented Jun 5, 2026

Summary

Found while installing kimi-code 0.10.1 on Windows. Two user-facing path-display bugs caused by pathe (forward-slash everywhere) leaking into output the user actually sees:

1. kimi doctor mixes separators

SKIP config.toml  C:/Users/sheng/.kimi-code/config.toml
SKIP tui.toml     C:\Users\sheng\.kimi-code\tui.toml
  • config.tomlresolveConfigPath in packages/agent-core/src/config/path.ts uses join from pathe
  • tui.tomlgetTuiConfigPath in apps/kimi-code/src/tui/config.ts uses join from node:path

Normalize each path with node:path.normalize() in formatResults.

2. See log: startup-error fallback uses forward slashes

$ kimi -p "hi"
error: failed to run prompt: No model configured...
See log: C:/Users/sheng/.kimi-code/logs/kimi-code.log    ← / on Windows

resolveGlobalLogPath in packages/agent-core/src/logging/logger.ts uses pathe. Wrap with a tiny formatLogPathForUser helper in main.ts that runs the output through node:path.normalize() before showing it.

Display-only changes — no path comparison, file resolution, JSON output, or test fixture relies on the raw separator. The deeper fix (switching resolveConfigPath / resolveGlobalLogPath to node:path) would touch too many internal callers and risks subtle behavior changes; normalizing at the display boundary is the safe surgical fix.

Test plan

  • Added regression test normalizes path separators in formatted output in doctor.test.ts covering both POSIX and Windows separators
  • All 11 doctor tests pass
  • Verified both bugs exist in published v0.10.1 (npm install -g @moonshot-ai/kimi-code)
  • Verified the fix locally on Windows

RTCartist added 2 commits June 5, 2026 09:43
…ndows

`config.toml`'s path is resolved via `pathe` (forward slashes
everywhere) while `tui.toml`'s path is resolved via `node:path`
(native separators). On Windows this surfaced a mixed-separator
output in `kimi doctor`:

  SKIP config.toml  C:/Users/me/.kimi-code/config.toml
  SKIP tui.toml     C:\Users\me\.kimi-code\tui.toml

Normalize each path with `node:path` `normalize()` in
`formatResults` so both lines render with the platform-native
separator, matching what the user sees elsewhere in the TUI
(working-directory badge, etc.).
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

🦋 Changeset detected

Latest commit: f6c7286

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

The SDK resolves the global log path via `pathe` (forward slashes
everywhere), so startup-error fallbacks were showing
"See log: C:/Users/me/.kimi-code/logs/kimi-code.log" on Windows.
Normalize via `node:path` `normalize()` before display so the path
matches what users see in File Explorer / their shell.
@RTCartist RTCartist changed the title fix(doctor): use consistent path separators on Windows fix: use platform-native path separators in user-facing output (Windows) Jun 5, 2026
@liruifengv
Copy link
Copy Markdown
Collaborator

Sorry, we currently do not accept PRs submitted in batches using AI

@liruifengv liruifengv closed this Jun 5, 2026
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.

2 participants