You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 AI 代码审查声明:本 issue 由 AI 模型 Claude Fable 5(Anthropic,运行于 Claude Code)在一次完整代码审查中发现并撰写,经 @josephmqiu 授权提交。审查基于当前 main 分支 HEAD(commit c5ece53),下述复现步骤已在本地实际运行验证。
English TL;DR: with pypinyin uninstalled (it's documented as optional), slugify() strips all non-ASCII characters, so every Chinese-only nickname collapses to the slug "ex". create_skill() then uses exist_ok=True and unconditionally overwrites memories.md/persona.md/meta.json — creating a second ex silently destroys the first, with no warning and no archive. Verified locally at commit c5ece53. Suggested fixes: error out on empty slug, refuse to overwrite an existing skill dir, and document pypinyin as required for Chinese nicknames.
Important
🤖 AI 代码审查声明:本 issue 由 AI 模型 Claude Fable 5(Anthropic,运行于 Claude Code)在一次完整代码审查中发现并撰写,经 @josephmqiu 授权提交。审查基于当前 main 分支 HEAD(commit
c5ece53),下述复现步骤已在本地实际运行验证。问题描述
pypinyin在 requirements.txt 里被标注为可选依赖(README「依赖(可选)」一节同样如此)。但当用户没有安装它时,skill_writer.py的slugify()会走 fallback 分支(skill_writer.py:77-89),该分支丢弃所有非 ASCII 字符:对本项目的主要用户群(中文昵称)来说,任何纯中文昵称都会变成空字符串,最后统一退化为
"ex"。复现步骤(已实际验证)
在未安装 pypinyin 的环境下(或模拟 ImportError):
实际输出:
数据丢失链条
slug 冲突本身只是难看,真正的问题是它会静默覆盖:
create_skill()全程使用exist_ok=True并无条件写入(skill_writer.py:130-185):组合起来的完整场景:
exes/ex/;ex→ 「小美」的 memories.md、persona.md、meta.json 被静默覆盖,无任何提示、无任何存档;versions/里也没有备份,数据无法找回。对一个以「保存回忆」为核心卖点的项目来说,这是最不应该发生的一类 bug。
修复建议
三层防御,建议都加上:
"ex":--force):如需要,我可以提交对应的 PR。
English TL;DR: with pypinyin uninstalled (it's documented as optional),
slugify()strips all non-ASCII characters, so every Chinese-only nickname collapses to the slug"ex".create_skill()then usesexist_ok=Trueand unconditionally overwritesmemories.md/persona.md/meta.json— creating a second ex silently destroys the first, with no warning and no archive. Verified locally at commit c5ece53. Suggested fixes: error out on empty slug, refuse to overwrite an existing skill dir, and document pypinyin as required for Chinese nicknames.