Skip to content

fix: Improve the extraction link of SkillMemory - #2342

Merged
CarltonXiang merged 8 commits into
mainfrom
dev-v2.0.33
Sep 3, 2026
Merged

fix: Improve the extraction link of SkillMemory#2342
CarltonXiang merged 8 commits into
mainfrom
dev-v2.0.33

Conversation

@whipser030

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.

Related Issue (Required): Fixes #issue_number

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • 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 (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Reviewer Checklist

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

bittergreen and others added 7 commits August 31, 2026 16:35
* fix: preserve fast memories when async fine extraction fails

* fix: filter polluted sources before preference extraction

* fix: refine preference extraction prompts
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes #issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] 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](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## 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 编排层 / 框架底座 / 跨模块问题 area:memory 记忆存储、检索、更新、召回逻辑 area:scheduler 调度模块 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Sep 3, 2026
@Memtensor-AI

Memtensor-AI commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2342
Task: 4f4589eb4fa24f61
Base: main
Head: dev-v2.0.33

🔍 OpenCodeReview found 4 issue(s) in this PR.


1. src/memos/mem_scheduler/task_schedule_modules/handlers/mem_read_handler.py (L182-L183)

The return skips the cleanup block at lines 401–442, which deletes the raw/working memory IDs (text_mem.delete / text_mem.soft_delete) and calls text_mem.memory_manager.remove_and_refresh_memory. When fine_transfer_simple_mem fails, those short-lived working-memory entries are never removed, leaking them permanently.

The old code assigned processed_memories = [], which let execution fall through to the cleanup block and still performed the deletion. Replacing that with return discards the cleanup entirely.

Suggestion: keep processed_memories = [] (or set it to None) so execution continues to the shared cleanup path, which already guards against an empty list before deleting.

💡 Suggested Change

Before:

                logger.warning("%s: Fail to transfer mem: %s", e, memory_items, exc_info=True)
                return

After:

                logger.warning("%s: Fail to transfer mem: %s", e, memory_items, exc_info=True)
                processed_memories = []

2. src/memos/mem_reader/source_filter.py (L164-L171)

The final fallback silently returns {} for any object that is not a SourceMessage, dict, or Pydantic model. This empty dict is subsequently dropped (empty content), with no log or warning. When a caller passes an unexpected type — for instance a plain str or a legacy object — the message is silently discarded, making pipeline bugs hard to diagnose.

Consider logging a warning before returning {}:

import logging
logger = logging.getLogger(__name__)
...
logger.warning("Unexpected source type %s; skipping.", type(source).__name__)
return {}

3. src/memos/templates/prefer_complete_prompt.py (L23-L28)

Requirement 4 was updated to use backtick-fenced `[]`, but the trailing footer instruction still uses plain [] (return []). This is a minor cosmetic inconsistency within the same prompt string. Consider unifying both occurrences to the same style.

💡 Suggested Change

Before:

4. If no explicit preference can be reasonably extracted, return `[]`.

Input:
{qa_pair}

Find ALL explicit preferences. If no explicit preferences found, return []. Output JSON only:

After:

4. If no explicit preference can be reasonably extracted, return `[]`.

Input:
{qa_pair}

Find ALL explicit preferences. If no explicit preferences found, return `[]`. Output JSON only:

4. src/memos/templates/prefer_complete_prompt.py (L64-L69)

Same inconsistency in the ZH version: Requirement 4 uses backtick-fenced `[]` but the footer still uses plain []. Consider aligning both to the same style.

💡 Suggested Change

Before:

4. 如果没有可以合理提取的显式偏好,返回 `[]`。

输入:
{qa_pair}

找出所有显式偏好。如果没有找到显式偏好,返回[]。仅输出JSON:

After:

4. 如果没有可以合理提取的显式偏好,返回 `[]`。

输入:
{qa_pair}

找出所有显式偏好。如果没有找到显式偏好,返回`[]`。仅输出JSON:

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

✅ Automated Test Results: PASSED

All tests passed (13/13 executed). memos_python_core/changed-repo-python: 13/13. Duration: 5s [advisory, non-gating] AI-generated tests on branch test/auto-gen-4f4589eb4fa24f61-20260903181344: 157/159 passed, 2 failed — these do NOT affect the PR verdict; review the branch manually.

Branch: dev-v2.0.33

@Memtensor-AI Memtensor-AI added status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发 and removed status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Sep 3, 2026
@CarltonXiang
CarltonXiang merged commit 78a372a into main Sep 3, 2026
34 checks passed
@CarltonXiang
CarltonXiang deleted the dev-v2.0.33 branch September 3, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core MOS 编排层 / 框架底座 / 跨模块问题 area:memory 记忆存储、检索、更新、召回逻辑 area:scheduler 调度模块 status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants