Skip to content

fix: normalize path separators in memory path parsing for Windows (#861), replace console.* with structured logging#864

Open
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-windows-path-separators-logging
Open

fix: normalize path separators in memory path parsing for Windows (#861), replace console.* with structured logging#864
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-windows-path-separators-logging

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Fixes #861 — on Windows, path.join produces backslash-separated paths (C:\xxx\memory\global\MEMORY.md), but the regexes in parsePath() and parseCcPath() only match forward slashes, causing all memory files to be skipped with "path outside memory layout, skipping".

Also replaces 3 remaining console.* calls in TUI components with structured logging.

Changes (3 files)

  • packages/opencode/src/memory/paths.ts — Add normalizeSeparators() helper that converts \ to / before regex matching in both parsePath() and parseCcPath(). Harden assertSafeComponent() to split on both / and \ and reject leading backslashes, preventing Windows-style path traversal.
  • packages/opencode/src/cli/cmd/tui/component/dialog-mcp.tsx — Replace 2 console.error calls with Log.Default.warn/Log.Default.error (add Log import from @/util).
  • packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx — Replace 1 console.log with Log.Default.error (add Log import from @/util).

…aomiMiMo#861), replace console.* with structured logging in TUI

- Add normalizeSeparators() to parsePath() and parseCcPath() so backslash
  paths produced by path.join on Windows are correctly matched by the
  forward-slash regexes (fixes XiaomiMiMo#861)
- Harden assertSafeComponent() to split on both / and \ and reject
  leading backslash, preventing Windows-style path traversal
- Replace 2 console.error calls in dialog-mcp.tsx with Log.Default.warn/error
- Replace 1 console.log in prompt/index.tsx with Log.Default.error
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.

windows环境memory.reconcile路径正则只认正斜杠,反斜杠全部匹配失败

1 participant