Repository navigation
fix(memory): make generated URIs Windows-safe - #4517
Merged
Merged
Conversation
chenjw
approved these changes
Aug 31, 2026
10 of 14 tasks
ZaynJarvis
pushed a commit
that referenced
this pull request
Sep 2, 2026
This was referenced Sep 3, 2026
12 of 21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景与问题原因
在 Windows 上,如果 LLM 提取出的 Memory 名称中,某个目录段以空格或英文句号结尾,例如:
OpenViking 原来会直接使用这段内容生成保存地址:
Windows 实际创建目录时,会把
Desktop末尾的空格去掉,落盘目录变成Desktop;但 OpenViking 后续创建文件锁时,仍然使用带空格的原地址。两边地址不一致,最终导致文件锁创建失败,整个 Memory 提取流程中断。如果简单删除末尾的空格或英文句号,还会产生新的问题:
Desktop、Desktop和Desktop.都会变成同一个保存地址,可能造成不同 Memory 互相覆盖。Fixes #4308
修复内容
在所有 Memory 共用的 URI 生成入口,对模板生成后的每一段地址进行检查。
地址段在 Windows 上不可用时,保留可读部分,并追加稳定的短标识。例如:
短标识根据原始地址段生成,因此同一个原始名称每次得到相同地址;
Desktop、Desktop、Desktop.等不同名称也不会落到同一个地址。同时处理 Windows 不允许的字符、控制字符、保留名称,以及末尾空格和英文句号。
保留
~ov~作为 OpenViking 生成地址的标记,避免用户原本就使用相同名称时再次发生冲突。原始 Memory 字段保持不变,不新增名称与地址的映射表。
Memory 合并或调整所属对象后重新计算 URI 时,也会再次经过相同处理。
修复后的影响
Desktop /new。memory_fields保存原始内容,现有uris保存实际地址。测试情况
新增并验证了以下场景:
Desktop /new场景;Desktop、Desktop、Desktop.不发生地址冲突;本地检查结果:
104 passed;tests/session/memory测试:365 passed, 3 failed。3 个失败来自当前分支已有的图页面和数据模型测试,不涉及本次修改的 URI 代码。测试平台:macOS。Windows 行为通过路径规则单元测试覆盖,尚未在 Windows 实机运行完整测试。
人工参与
本次修复方案经过人工讨论和确认。