feat: add Redis Cloud memory migration#305
Conversation
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Reviewed by Cursor Bugbot for commit fe16ef0. Configure here.
| target = cloud_hash_to_local_hash(source) | ||
| if target is None: | ||
| stats.failed += 1 | ||
| continue |
There was a problem hiding this comment.
Malformed records abort migration
High Severity
The migration loop calls cloud_hash_to_local_hash without catching errors, yet that helper can raise on bad pinned/access_count values or tag fields with commas via int() and encode_tag_values. One bad Cloud hash stops the entire run instead of incrementing failed, contrary to the module’s stated per-record handling.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit fe16ef0. Configure here.
| } | ||
| target["memory_hash"] = hashlib.sha256( | ||
| json.dumps(content_fields, sort_keys=True).encode() | ||
| ).hexdigest() |
There was a problem hiding this comment.
Generated hash mismatches server
Medium Severity
When Cloud omits memory_hash, the migration builds one from content_fields using empty strings for missing user_id, session_id, and namespace. generate_memory_hash in utils/recency.py serializes those optional fields as JSON null, so the same memory content gets a different hash after migration than for natively created records.
Reviewed by Cursor Bugbot for commit fe16ef0. Configure here.
|
|
||
| if not overwrite and await redis.exists(target_key): | ||
| stats.skipped_existing += 1 | ||
| continue |
There was a problem hiding this comment.
Cross-store IDs collide silently
Medium Severity
Target keys are only {target_prefix}:{memory_id}, so scanning memory:*:ltm:* merges every store into one namespace. Duplicate IDs across stores are skipped as existing or overwritten with --overwrite, with no warning that memories from another store were dropped.
Reviewed by Cursor Bugbot for commit fe16ef0. Configure here.


Summary
Adds a Redis Cloud Agent Memory Service to local
agent-memory-servermigration path.This handles the schema/key-layout mismatch found when Cloud Agent Memory data is copied directly into a local Redis deployment:
memory:<store_id>:ltm:<memory_id>memory_idx:<memory_id>id,owner_id,text_vectorid_,user_id,vectorThe migration command copies source hashes into local-shaped hashes, preserves source data, converts timestamps from milliseconds to seconds, and downcasts vectors when needed.
New command
Docs
docs/redis-cloud-migration.mdTest plan
Local results:
5 passedAll checks passed!Real-world verification
On a local Redis copy of Cloud Agent Memory data:
memory_recordsFT.INFO memory_recordsreportednum_docs=753,hash_indexing_failures=0/v1/long-term-memory/searchreturned migrated memories successfullyNote
Cursor Bugbot is generating a summary for commit fe16ef0. Configure here.