Skip to content

fix: 存储项按归属区分、World 实例 id 校验,补配置生效与 dataDir 文档 - #287

Merged
Phantivia merged 3 commits into
mainfrom
fix/issue-259-storage-owner
Oct 19, 2026
Merged

Phantivia merged 3 commits into
mainfrom
fix/issue-259-storage-owner

Conversation

@Phantivia

Copy link
Copy Markdown
Member

Refs Pal-AI-Lab/Coopanion#259

外部作者自建多个 World 时遇到的三处问题。

存储项按归属与 key 一起区分

  • manifest 的 storageKeys 换成 storageParts({ owner, key }),页贡献的存储项由装配层盖上归属。
  • WebUI 数据页按 owner+key 过滤;POST /api/storage/clear 加可选 owner,省略且 key 有多个归属时回 409;clear-all 的逐项结果带 owner。
  • 同名 key 不报错,也不自动加前缀,已有数据位置不变。
  • 下游注意:Coopanion 设置窗口高级模式读 storageKeys,随子模块升级改读 storageParts。

World 实例 id 校验

  • create() 返回的实例 id 与定义 id 不一致时不建槽位、不挂载,进 missing,原因写明两个 id(11 种语言)。

文档

  • docs/worlds.md:ctx.cfg 是共享引用,现读即生效,构造时存下的值要实例重新构造,这类项标 x-hot: false;ctx.dataDir 部署共用,文件名与 storage key 以 World id 开头。
  • docs/configuration.md 的 x-hot 说明、docs/webui.md 的清除接口同步。

测试:同名 key 时两个 World 的数据页各画自己的、清除只清带 owner 的那个、无 owner 回 409;实例 id 不一致进 missing。本地 typecheck、typecheck:web、test 通过。

🤖 Generated with Claude Code

Phantivia and others added 3 commits October 19, 2026 14:18
- 根因:manifest 只带 storageKeys,数据页按 key 过滤、清除接口按 key 取第一个匹配;
  两个 World 声明同一个 key 时,数据页列出对方的项,清除可能清到对方的数据。
- manifest 改带 storageParts(owner + key),页贡献的 storage 项由装配层盖上归属;
  清除接口加可选 owner,省略且 key 有多个归属时回 409,一键清空的逐项结果带 owner。
- 不为同名 key 报错,也不给 key 自动加前缀,已有数据的位置不变。
- 测试:两个 World 同名 key 时各自数据页只画自己那项;带 owner 只清对应 World,不带回 409。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 根因:装配层调 create() 后不核对实例 id,Core 按实例 id 归属工具与事件、
  装配层按定义 id 找槽位,缺 id 时日志记到 worlds.undefined、设置页也找不到这个 World。
- 现在不建槽位、不挂载,进 missing,原因写明两个 id;与 check:extension 的检查一致。
- 测试:实例 id 不一致的定义进 missing,其余 World 照常挂载。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread docs/worlds.md
Comment on lines +88 to +89
`ctx.dataDir` 是部署的数据目录,Core 与这个部署的全部 World 共用,同名文件会互相覆盖。World 的文件名与
`webUi().storage` 的 key 都以 World id 开头,仓内 World 写作 `minecraft-chests.json` 与 `minecraft-chests`。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句话不成立:仓内 QQ World 的 webUi().storage key 是 vision,落盘目录是 data/vision/,都不以 World id qq 开头。

AGENTS.md §4 Accuracy after editing:改完之后保留的行为、条件和边界必须仍然准确、具体。

docs/worlds.md 第 88–89 行:「World 的文件名与 webUi().storage 的 key 都以 World id 开头,仓内 World 写作 minecraft-chests.json 与 minecraft-chests。」PR 说明里同一句:「ctx.dataDir 部署共用,文件名与 storage key 以 World id 开头。」

请按清单核对该句:对照现有 World 的文件名与 storage key,使它与代码一致。

— Cortico PR Gate via Cursor Cloud Agent

@Phantivia
Phantivia merged commit 4a14385 into main Oct 19, 2026
4 checks passed
@Phantivia
Phantivia deleted the fix/issue-259-storage-owner branch October 19, 2026 19:25
Phantivia added a commit to Pal-AI-Lab/Coopanion that referenced this pull request Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phantivia added a commit to Pal-AI-Lab/Coopanion that referenced this pull request Oct 19, 2026
* docs(desktop-pet): 写明形象包沙箱不加载视频、音频和字体,声音走 sounds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(console): 高级模式数据页按归属与 key 挑存储项,清除带 owner

- 根因:数据页只按 manifest 的 storageKeys 过滤,两个 World 同名 key 时互相显示,
  清除按 key 取第一个匹配。Core 改发 storageParts(owner + key),清除接口收 owner。
- 提示词页重开 session 时清 core 的 session。
- 依赖 vendor/cortico 带上 storageParts 的版本。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* build(vendor): cortico 暂指 Pal-AI-Lab/Cortico#287 分支(合并后改指 main)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* build(vendor): cortico 指向 main 上 Pal-AI-Lab/Cortico#287 的合并提交

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <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.

1 participant