Fix summary extraction promotion#316
Merged
Merged
Conversation
fa4f7d5 to
b795029
Compare
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0cf3a43. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fix automatic working-memory promotion for sessions configured with the singular
summaryextraction strategy, and make the resulting thread summaries usable as first-class long-term memory records for dashboards and summary views.Problems
Summary extraction existed as a strategy, but automatic thread promotion did not honor it. The delayed extraction path built the full conversation and then always used the discrete strategy, so a session configured with
long_term_memory_strategy={"strategy":"summary"}would not produce a durable thread summary through the automatic promotion path.Summary records also lacked reliable provenance and filterability. The RedisVL adapter did not store or return
extraction_strategy, strategy config, or generic metadata, which made it hard for dashboards and summary views to reliably select thread summaries by strategy, source session, source messages, or timestamp range.Summary view empty partitions returned placeholder text instead of a structured empty result, and the long-term summary prompt flattened memory text without enough metadata or deterministic ordering.
Solution
extract_memories_from_session_thread()instead of hardcodingdiscrete.thread_summary_<sha256(namespace|user_id|session_id)[:24]>.MemoryRecord.metadata, including source session, source messages, source timestamp range, summary version, and source fingerprint.extraction_strategy,extraction_strategy_config, andmetadatathrough RedisVL and the Python, TypeScript, and Java client models.extraction_strategyfiltering to REST, MCP, Python, TypeScript, and Java search surfaces.extraction_strategy,topics, andevent_datefilters, deterministic memory ordering, metadata-rich JSON prompt lines, and structured empty partition results.Testing
source .venv/bin/activate && pytest tests/test_extraction_logic_fix.py tests/test_summary_views.py tests/test_memory_vector_db.py(110 passed)source .venv/bin/activate && pytest tests/test_client_strategy_support.py tests/test_mcp_strategy_support.py tests/test_working_memory_strategies.py(21 passed)CI=true npm run test:coverage && npm run typecheckinagent-memory-client/agent-memory-client-js(195 passed, coverage and typecheck passed)export JAVA_HOME=$(/usr/libexec/java_home -v 21) && export PATH="$JAVA_HOME/bin:$PATH" && ./gradlew testinagent-memory-client/agent-memory-client-java(BUILD SUCCESSFUL)Note
Medium Risk
Touches core long-term indexing, automatic extraction, and Redis schema fields; deployments need index rebuild for new tag filters, and summary idempotency/dedup behavior changes affect stored thread summaries.
Overview
Automatic thread extraction now uses the session’s configured
long_term_memory_strategyinstead of always runningdiscrete. The summary path builds full thread context, can skip unchanged reruns via fingerprint +summary_version, coalesces model output to one semantic record with a deterministicthread_summary_*id, provenance inmetadata, and skips hash/semantic dedup for those records.Long-term memory gains indexed
extraction_strategy,extraction_strategy_config, andmetadatain RedisVL (schema + read/write),extraction_strategysearch filters on API/MCP/clients, and soft-filter fallback hints for that field.Summary views accept
extraction_strategy,topics, andevent_datefilters; prompts use sorted, metadata-rich JSON lines; empty partitions returnempty/empty_reasoninstead of placeholder text.Python, TypeScript, and Java clients and docs are updated accordingly (including index rebuild note for
extraction_strategy).Reviewed by Cursor Bugbot for commit 8a3589f. Bugbot is set up for automated code reviews on this repo. Configure here.