Skip to content

fix(opencode): normalize windows path separators in memory path parsing#912

Open
hzhongzhong wants to merge 1 commit into
XiaomiMiMo:mainfrom
hzhongzhong:fix/memory-windows-path-separator
Open

fix(opencode): normalize windows path separators in memory path parsing#912
hzhongzhong wants to merge 1 commit into
XiaomiMiMo:mainfrom
hzhongzhong:fix/memory-windows-path-separator

Conversation

@hzhongzhong

Copy link
Copy Markdown

Fixes #908

Problem

On Windows the memory system rejects every file with "path outside memory layout" and never loads, so the agent loses all context between sessions.

parsePath/parseCcPath in memory/paths.ts match a forward-slash-only regex, but buildPath composes paths with path.join(), which emits backslashes on Windows — so the regex never matches and every locator comes back null.

Fix

Normalize backslashes to forward slashes before matching, in both parsers.

Verification

Added Windows backslash cases to test/memory/paths.test.ts and cc-paths.test.ts (fail before, pass after).
Ran bun test test/memory test/tool/memory-path-guard.test.ts → 133 pass, 0 fail.

parsePath/parseCcPath matched a forward-slash-only regex, but buildPath
composes paths with path.join() which emits backslashes on Windows. As a
result every memory file was rejected with "path outside memory layout"
and the memory system never loaded, causing per-session amnesia on Windows.

Normalize backslashes to forward slashes before matching.

Fixes XiaomiMiMo#908

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

[Bug] Memory system fails to load on Windows - path outside memory layout

1 participant