fix(memory): use source conversation_id in AOI tier promotion#2105
Merged
fix(memory): use source conversation_id in AOI tier promotion#2105
Conversation
ConversationId(0) sentinel was used as FK reference for promoted semantic-tier messages, but SQLite autoincrement starts at 1 so id=0 never exists in the conversations table. Every promotion attempt resulted in a FOREIGN KEY constraint error and promoted=0 indefinitely. Replace the sentinel with the conversation_id of the highest-ranked candidate in the cluster (cluster[0].0.conversation_id, ordered by session_count DESC). Add conversation_id field to PromotionCandidate and propagate it through find_promotion_candidates(). Closes #2102
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.
Closes #2102
Summary
ConversationId(0)sentinel inpromote_to_semantic()caused FK violations on every promotion attempt — SQLite autoincrement starts at 1, soid=0never existscluster[0].0.conversation_id(highest-ranked candidate bysession_count DESC)conversation_id: ConversationIdfield toPromotionCandidatestruct and propagate throughfind_promotion_candidates()SELECT queryTest plan
cargo +nightly fmt --check— cleancargo clippy --workspace --features full -- -D warnings— clean (0 warnings)cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 6365 passed (+2 new)promote_to_semantic_with_sentinel_zero_fails— FK regression guard confirmsConversationId(0)failsfind_promotion_candidates_returns_conversation_id— verifies correctconversation_idpropagation through real SQLite store