Skip to content

fix(config): generate unique default identifiers - #2201

Open
JiataiWang wants to merge 1 commit into
MemTensor:dev-v2.0.29from
JiataiWang:fix/unique-config-identifiers
Open

fix(config): generate unique default identifiers#2201
JiataiWang wants to merge 1 commit into
MemTensor:dev-v2.0.29from
JiataiWang:fix/unique-config-identifiers

Conversation

@JiataiWang

Copy link
Copy Markdown

Description

MOSConfig.session_id and GeneralMemCubeConfig.cube_id currently call uuid.uuid4() when their modules are loaded. Pydantic then treats those generated strings as static defaults, so separate config instances created in the same process reuse the same identifier.

This switches both fields to default_factory. Explicit IDs and existing serialized configs keep the same behavior; only omitted IDs now get a fresh UUID per instance.

No dependencies are added. I couldn't find an existing issue or PR for this, and the contribution guide says small bug fixes can go directly to a PR.

Related Issue (Required): N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit Test
  • Test Script Or Test Steps

Local verification:

  • uv run --frozen --with 'pytest==8.3.5' pytest tests/configs/ -q — 39 passed
  • uv run --frozen --extra mem-reader --with 'pytest==8.3.5' pytest tests/mem_os/ -q — 36 passed (3 existing Pydantic serialization warnings)
  • uv run --frozen --with 'poetry>=2,<3' --with 'ruff==0.11.13' make format — Ruff passed; 617 files unchanged
  • git diff --check origin/dev-v2.0.29...HEAD — passed

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas (no hard-to-understand code added) | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (not applicable; no documentation behavior changed) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如适用)
  • I have linked the issue to this PR (not applicable; no existing issue found) | 我已将 issue 链接到此 PR(如适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

@WeiminLee when you have a moment, could you take a look?

Reviewer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed
  • Tests have been provided

@Memtensor-AI Memtensor-AI added area:core MOS 编排层 / 框架底座 / 跨模块问题 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Aug 3, 2026
@Memtensor-AI
Memtensor-AI requested a review from WeiminLee August 3, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core MOS 编排层 / 框架底座 / 跨模块问题 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants