Skip to content

fix(memory): inject created_at/updated_at into MEMORY_FIELDS#2565

Open
huang-yi-dae wants to merge 1 commit into
volcengine:mainfrom
huang-yi-dae:fix/memory-fields-timestamps
Open

fix(memory): inject created_at/updated_at into MEMORY_FIELDS#2565
huang-yi-dae wants to merge 1 commit into
volcengine:mainfrom
huang-yi-dae:fix/memory-fields-timestamps

Conversation

@huang-yi-dae

Copy link
Copy Markdown

The vector DB layer already stores timestamps for all memories, but the Markdown file layer (MEMORY_FIELDS metadata) never included them. This meant that reading a memory file directly gave no indication of when it was created or last updated.

Changes:

  • memory_updater.py: _apply_upsert now injects created_at (preserved on updates, set to now for new files) and updated_at (always refreshed) into MEMORY_FIELDS after merging schema fields.
  • memory_type_registry.py: initialize_memory_files now includes created_at/updated_at when creating initial identity.md, soul.md, etc.
  • Added TestUpsertTimestamps with two regression tests covering new-file and update scenarios.

The serialization/deserialization infrastructure in memory_file_utils.py already supported these fields — the gap was only in the write path.

🤖 Generated with [Qoder][https://qoder.com]

Description

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

The vector DB layer already stores timestamps for all memories, but the
Markdown file layer (MEMORY_FIELDS metadata) never included them. This
meant that reading a memory file directly gave no indication of when it
was created or last updated.

Changes:
- memory_updater.py: _apply_upsert now injects created_at (preserved on
  updates, set to now for new files) and updated_at (always refreshed)
  into MEMORY_FIELDS after merging schema fields.
- memory_type_registry.py: initialize_memory_files now includes
  created_at/updated_at when creating initial identity.md, soul.md, etc.
- Added TestUpsertTimestamps with two regression tests covering new-file
  and update scenarios.

The serialization/deserialization infrastructure in memory_file_utils.py
already supported these fields — the gap was only in the write path.

🤖 Generated with [Qoder][https://qoder.com]
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant