Skip to content

fix(consolidation): keep an UPDATE when the same response deletes that observation (#2550) - #5577

Merged
nicoloboschi merged 2 commits into
mainfrom
test/consolidation-message-order-2550
Oct 15, 2026
Merged

nicoloboschi merged 2 commits into
mainfrom
test/consolidation-message-order-2550

Conversation

@nicoloboschi

@nicoloboschi nicoloboschi commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Two things, both found while reproducing #2550.

1. Regression test for #2550 (real LLM + judge, hs_llm_core). Session 1 opens on 07-01, session 2 says "React is my favorite" on 07-05, then session 1 is re-retained (same document_id) with a 07-10 message "svelte is my favorite". Consolidation must end on Svelte, both when the update keeps the session-start event_date and when it carries the last message's time.

Passes 5/5 on gemini-3.1-flash-lite (the Core LLM job's model) and gemini-2.5-flash. gemini-2.5-flash-lite fails most runs: it creates "favorite is React" and "favorite is Svelte" as two separate observations instead of resolving the clash.

2. Fix: an UPDATE wins over a DELETE of the same observation. A response can rewrite an observation to its new state and also delete it. Deletes ran first, so the update found no row and was skipped while its source facts were stamped consolidated — the new knowledge was lost. Now the delete is dropped (with a warning). Covered by test_consolidation_update_delete_same_observation.py, which fails without the fix.

@nicoloboschi nicoloboschi changed the title test(consolidation): later message wins across overlapping sessions (#2550) fix(consolidation): keep an UPDATE when the same response deletes that observation (#2550) Oct 15, 2026
When one LLM response both updated and deleted an observation, the delete ran
first and the update found no row, so the new state was lost while its source
facts were stamped consolidated. Drop the delete in that case.

Also read the #2550 test's results through list_memory_units instead of SQL.
@nicoloboschi
nicoloboschi force-pushed the test/consolidation-message-order-2550 branch from e5de73e to 2b736da Compare October 15, 2026 14:36
@nicoloboschi
nicoloboschi merged commit 761c79a into main Oct 15, 2026
231 of 234 checks passed
@nicoloboschi
nicoloboschi deleted the test/consolidation-message-order-2550 branch October 15, 2026 15:47
@nicoloboschi nicoloboschi mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant