github doobidoo/mcp-memory-service v8.27.1
v8.27.1 - Critical Timestamp Preservation Hotfix

latest releases: v10.30.0, v10.29.1, v10.29.0...
4 months ago

Critical Timestamp Regression Fix

This is a critical hotfix addressing a timestamp corruption bug that affected v8.25.0-v8.27.0.

Problem

The bidirectional sync and drift detection features incorrectly reset created_at timestamps to the current time during metadata updates. This caused all synced memories to appear "just created", destroying historical timestamp data.

Impact: 2,174+ memories in production databases had timestamps corrupted. All hybrid backend users on v8.25.0-v8.27.0 are affected.

Root Cause

The preserve_timestamps=False parameter in update_memory_metadata() reset both created_at and updated_at timestamps, when it should only update updated_at.

Solution

  • Modified update_memory_metadata() to always preserve created_at from source memory during sync
  • Hybrid storage now passes all 4 timestamp fields during drift detection
  • Cloudflare storage updated for consistent timestamp handling across backends

Files Modified:

  • src/mcp_memory_service/storage/sqlite_vec.py (lines 1389-1406)
  • src/mcp_memory_service/storage/hybrid.py (lines 625-637, 935-947)
  • src/mcp_memory_service/storage/cloudflare.py (lines 833-864)

Tests Added:

  • tests/test_timestamp_preservation.py - 7 comprehensive regression tests

Recovery Tools

If your database was affected (hybrid backend, v8.25.0-v8.27.0), use these recovery tools:

1. Validate Timestamp Integrity

python scripts/validation/validate_timestamp_integrity.py

This checks for:

  • Impossible timestamps (created_at > updated_at)
  • Suspicious timestamp clusters (bulk reset indicators)
  • Timestamp distribution anomalies

2. Recover Corrupted Timestamps

# Preview recovery (dry-run)
python scripts/maintenance/recover_timestamps_from_cloudflare.py --dry-run

# Apply recovery
python scripts/maintenance/recover_timestamps_from_cloudflare.py --apply

This restores correct created_at timestamps from Cloudflare backups.

Upgrade Instructions

For all hybrid backend users:

  1. Upgrade immediately:

    pip install --upgrade mcp-memory-service
    # or
    uv pip install --upgrade mcp-memory-service
  2. Validate your database:

    python scripts/validation/validate_timestamp_integrity.py
  3. If validation shows issues, run recovery:

    # Preview first
    python scripts/maintenance/recover_timestamps_from_cloudflare.py --dry-run
    
    # If preview looks good, apply
    python scripts/maintenance/recover_timestamps_from_cloudflare.py --apply
  4. Re-validate after recovery:

    python scripts/validation/validate_timestamp_integrity.py

Changed Semantics

The preserve_timestamps parameter now has clearer behavior:

  • preserve_timestamps=True (default): Only updates updated_at to current time, always preserves created_at
  • preserve_timestamps=False: Uses timestamps from updates dict if provided, always preserves existing created_at
  • created_at is never reset to current time (this was the bug)

What's Fixed

  • Timestamp preservation during hybrid sync operations
  • Drift detection no longer corrupts created_at timestamps
  • Bidirectional sync preserves historical timestamp data
  • Cloudflare ↔ SQLite-vec sync maintains timestamp integrity
  • Comprehensive regression tests prevent future issues

Affected Versions

  • v8.25.0: Introduced drift detection with timestamp bug
  • v8.27.0: Enhanced bidirectional sync amplified the issue

For More Information

  • See CHANGELOG.md for full technical details
  • Test suite: tests/test_timestamp_preservation.py
  • Recovery tools in scripts/maintenance/ and scripts/validation/

This is a critical update. All hybrid backend users should upgrade immediately and run validation tools.

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude noreply@anthropic.com

Don't miss a new mcp-memory-service release

NewReleases is sending notifications on new releases.