Skip to content

fix: log_working_memory_replacement reports incorrect memory_len (delta instead of total) #1790

@nuthalapativarun

Description

@nuthalapativarun

Problem

In src/memos/mem_scheduler/general_modules/scheduler_logger.py, log_working_memory_replacement has a # TODO: Log output count is incorrect comment at line 167.

The method passes memory_len=len(memcube_content) to create_event_log, where memcube_content only contains the newly added memories (delta). This means the scheduler UI shows the count of changes, not the actual size of the output working memory.

Example:

  • Original working memory: [A, B, C] (3 items)
  • New working memory: [A, B, D] (3 items)
  • memcube_content = [D] → memory_len = 1
  • Correct value: memory_len = 3 (total memories in output)

Expected Behavior

memory_len should reflect the total number of memories in the working memory after replacement (len(new_memory)), consistent with how other log entries represent the output size.

Steps to Reproduce

Trigger a working memory replacement operation via the scheduler and observe the memory_len field in the scheduler log output.

Proposed Fix

Change line 227:

# Before
memory_len=len(memcube_content),
# After
memory_len=len(new_memory),

Files

  • src/memos/mem_scheduler/general_modules/scheduler_logger.py line 167, 227

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-taskAutoDev taskmemosCore MemOS logic (memory, MCP, scheduler, API, database)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions