Repository navigation
feat(eval): long-horizon memory benchmark, and the stale-memory bugs it found - #5340
Conversation
Conversation History rows showed the first 8 characters of the session ID. They now show the chat's sidebar title, keeping the short ID only for chats the sidebar no longer has, and the conversation detail gets an Open chat button. Closes amd#5188
…ge with it Memory was storing document and tool content as facts about the user (a weather chat filled it with weather trivia), forgotten facts came back when old chats were consolidated, and a running extraction made the next message wait behind it. Extraction now keeps only what the user says about themselves, forgetting is recorded so old conversations don't teach it again, and a new turn stops a running extraction, which reruns when idle. The memory page opens on "What GAIA knows about you", with an Edit and a Forget button on each item, plus Undo and Add; stats, confidence and sources move to an Advanced tab. Also fixes the page's stale views after profile saves, silent goal failures, keyboard access, and stats that showed zeros or success where operations failed. Closes amd#5027, amd#5022, amd#4730, amd#4824, amd#4814, amd#4815.
…lands first The test raced on slow runners: with no turn in flight the job could start before the forget, and stored the fact (failed on macOS CI).
The forget-vs-turn comparison was strict, so a forget stamped in the same tick as the turn was missed and the fact stored. The queued-before-forget test also pins the turn a second back so it never rests on two clock reads.
If the About-you list's reload landed after a Forget, it restored the stale list and the forgotten item reappeared; this also made the undo test flaky under the parallel run. Loads and changes now share a generation counter, and a load that is no longer the latest is dropped.
…rst-177da6 # Conflicts: # src/gaia/apps/webui/src/components/__tests__/MemoryDashboard.conversations.test.tsx
…unning it mid-turn A stopped extraction went back on the queue even when it was full, and a full queue starts work at once, so it restarted during the user's turn. It is the oldest job, so it is now the one dropped, as a new turn on a full queue already does. Also corrects the stats endpoint's docstring.
At 375 px the add-a-memory input shrank to a sliver and the four-tab bar clipped Advanced. The input now takes its own row and the tab bar scrolls.
|
Verdict: Request changes This PR adds
Real-world evidenceN/A: there is no evidence bundle for this run, and no Python test environment was available here, so I couldn't run the PR's tests. The verdict rests on a static review, plus a standalone reproduction of the source check (below). The author's description reports a passing 🔍 Technical details🟡 For an When the target row's content is added to the user side, both are kept: in the second case own_words = user_input
if op_type == "update":
target = next((i for i in existing_items if i.get("id") == op.get("knowledge_id")), None)
if target:
own_words += "\n" + target.get("content", "")
if op_type in ("add", "update") and _copied_from_material(
str(op.get("content", "")), own_words, material
):Please add a 🟢 Extraction The 🟢 Each consolidated fact loads every active row in its category and re-stems each one. That's fine at today's sizes, but it is O(items × rows) per session on a long-lived store. Worth caching the stems if stores grow. Strengths
|
Memory went stale over long use. Every turn's extraction lookup counted as a
"use" and raised the confidence of up to 40 matching memories, so old facts
out-ranked new ones in the system prompt: a user who moved was still shown the
old city, and the new one not at all. Extraction dropped due dates, so a
mentioned appointment never came up and rewording a dated reminder replaced it
with an undated copy. And consolidating an old chat filed an untagged copy of
a fact that the user's later correction never reached ("Ada is 6" survived
"Ada is 7").
- Only an explicit recall counts as a use, and only for the results it
returns; it no longer touches updated_at.
- Extraction carries due_at; an update keeps the old date only while it is
still a reminder; an unparseable date is dropped with a warning, the fact
kept.
- Consolidation skips what a current memory already says (whatever its
entity tag) and what the user changed after that chat.
- Tokens with digits stay whole in content matching, so "Ada is 6" and
"Ada is 7" differ.
Upkeep stamped updated_at, which the agent is shown as "last confirmed" and which now orders memories newest first, on rows nobody confirmed. Confidence decay used updated_at as its "already decayed" marker, so every chat opened after a month re-dated every idle memory to that day; reconciliation's confidence nudges re-dated up to 40 rows per chat. With every row "confirmed" the same day, newest-first ordering stopped meaning anything. - Decay records its own decayed_at (schema v7) and runs at most once a month. - update_confidence moves updated_at only when confirmed: a lesson whose fix just worked again. - Rows that tie on a timestamp keep insertion order, so newest-first holds.
…gain Decay checked only when it last ran, so a memory decayed six weeks ago and confirmed last week lost confidence again on the next chat. It now waits a full month from both the last decay and the last confirmation. Adversarial tests cover the decay boundary, negative nudges, superseded and cross-category copies, changed numbers, changes made before an old chat, and malformed due dates.
Nothing tested what memory does after weeks of use. gaia eval memory replays six people's months of chats through the real memory pipeline on a simulated clock - facts that change, forgets, a repository's quirks, documents and emails full of other people's first-person lines - and checks what the agent is shown and what is stored at points in time. The pr suite is offline and deterministic and gates check by check against tests/fixtures/eval_baselines/memory-bench/pr.json; the full suite uses the local model and real embedder under the eval lock. Refs amd#4727.
… change With last-confirmed no longer moved by upkeep, the bench's Maya scenario has its careful model retire the old team-lead fact on the job change too; whether a real model does is the full suite's question.
The Email Agent Unit Tests job has no faiss-cpu, so every replay logged "vector search disabled" and the strict replay failed the baseline test. The two replay tests now skip with the reason when faiss is absent; the Unit Tests workflow, which installs it, still runs them. The scripting-slip test also checks that the slip itself failed the replay, so a missing faiss can't make it pass for the wrong reason.
03aa82e to
b10ae71
Compare
# Conflicts: # docs/sdk/sdks/memory.mdx # src/gaia/agents/base/memory.py # src/gaia/agents/base/memory_store.py # src/gaia/ui/routers/memory.py # tests/integration/test_memory_integration.py # tests/unit/test_memory_extraction_yields.py # tests/unit/test_memory_forget_sticks.py # tests/unit/test_memory_store.py # tests/unit/test_skill_synthesis_incremental.py
A short correction such as "actually make it Friday" was dropped whenever the
assistant's reply repeated the old memory back ("I moved your dentist
appointment to Friday"): the old memory's words came from the reply, so the
update looked copied from what the turn read.
The words of the memory an update replaces now count on neither side. A
borrowed addition to an existing memory still has to rest on the user's own
words, so padding an update with document text is still refused.
|
Verdict: Approve with suggestions This adds The Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description reports the 🔍 Technical detailsIssues found 🟢 Scripted 🟢 Checked and fine
Strengths
|
… needs --suite full A loose update_of/delete_of pattern quietly updated whichever matching row SQLite returned first. It now fails the replay unless exactly one current memory matches; session summaries, which repeat the facts they cover, are not candidates. `gaia eval memory --model X` without --suite full ran the scripted model and ignored X. It is now refused with an error naming the fix.
# Conflicts: # src/gaia/agents/base/memory.py # src/gaia/agents/base/memory_store.py # tests/unit/test_memory_stays_current.py
Memory went stale over months of use. Old facts out-ranked new ones
because every turn's background lookup raised their confidence, so a
user who moved was still shown the old city. Dated plans lost their
date, consolidating an old chat could undo a later correction ("Ada is
6" came back after "Ada is 7"), and routine upkeep re-dated every idle
memory as "last confirmed" today. After this, only a real recall counts
as a use, reminders keep their dates, old chats don't overwrite newer
facts, and "last confirmed" moves only on a real confirmation.
**Depends on amd#5243.** This branch is stacked on it, so until amd#5243
merges the diff includes its commits; review the last three commits. It
merges cleanly with amd#5324 (no shared changes; this keeps amd#5324's
newest-first ordering meaningful). Split out of amd#5340 so the fixes can
land without the benchmark.
Changes memory extraction and consolidation behavior, so it needs a
flagship eval on the `memory` and `gaia_memory` categories before merge.
## Test plan
- [ ] `python -m pytest tests/unit/test_memory_stays_current.py
tests/unit/test_memory_store.py tests/unit/test_memory_forget_sticks.py
tests/unit/test_skill_synthesis_incremental.py
tests/integration/test_memory_integration.py`
- [ ] An existing v6 memory database upgrades to v7 on first start
(`test_a_v6_database_gains_decayed_at`)
- [ ] Flagship eval: `memory` and `gaia_memory` categories show no PASS
to FAIL against the baseline
---------
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Nothing tested what memory does after weeks of use. Unit tests mock the model, and eval scenarios last one chat.
gaia eval memoryreplays six people's months of chats through the real memory pipeline on a simulated clock. Their facts change, they ask GAIA to forget things, the agent trips over a repo's quirks, and documents and emails full of other people's first-person lines pass through. The bench then checks what the agent is shown and what is stored. Theprsuite is deterministic and gates PRs check by check, so memory can't quietly regress. Its runs found four bugs that made memory go stale, fixed in #5395: the share of what the agent is shown that is current and correct went from 81% to 100%.Builds on #5395 (the stale-memory fixes, split out so they can land on their own), which builds on #5243. Their commits are included; review only the last three. Refs #4727.
due_at, so a mentioned appointment never came up as upcoming, and rewording a dated reminder replaced it with an undated copy.Eval categories to watch on the next RC:
memory,gaia_memory(the extraction prompt gaineddue_at, and recall ranking changed).prsuite, 88 checksRemaining failures are recall gaps: an older fact or a far-off reminder doesn't reach the agent. #5324 targets those, and this bench measures them.
Test plan
gaia eval memory --suite pr --gate tests/fixtures/eval_baselines/memory-bench/pr.jsonpasses; three runs gave identical resultspython -m pytest tests/unit/eval/test_memory_bench.py tests/unit/test_memory_stays_current.pypython -m pytest tests/unit/ -k "memory or sdk or lemonade_chat_slots or skill_synthesis or cli_memory" tests/integration/test_memory_integration.pypython util/lint.py --allgaia eval memory --suite full(not run: two other sessions'gaia eval agentruns held the machine-wide eval lock, and the bench doesn't bypass it)🔍 Technical details
src/gaia/eval/memory/):MemoryMixinagent on one shared DB:init_memory, the first message's upkeep, then every turn throughprocess_query. That covers tool calls and the tool record, extraction, lessons, and the scenario's explicitremember/update_memory/forgetcalls.datetimeinmemory.pyandmemory_store.py, with DST-safe aware arithmetic.prreplay fails on any warning from memory's loggers, so a scripted-model slip can't pass as "nothing stored".maya_moves_and_changes_jobs: a move, a new job, a swapped race, a dog's surgery, weather lookups.sam_family_health: an outgrown allergy, a corrected diagnosis, a diet change, a sister's diet, a hypothetical, a quoted text.chen_learns_project_quirks: lessons learned and replaced, a README injection.priya_work_documents_and_forgetting: report and email content, a password, "forget my manager".alex_three_months_of_life: about 30 facts built week by week.jordan_reminders_change: reschedules, cancellations, completions.tests/fixtures/eval_baselines/memory-bench/pr.jsonmust still pass. A baseline check that no longer runs fails too.--scenariogates only the scenarios it ran.MemoryStore.search(count_as_use=),MemoryStore.count_use()(doesn't touchupdated_at), and_hybrid_search(count_as_use=).due_at. An update keeps the old date only if the result is still a reminder. An unparseable date is dropped with a warning and the fact kept.MemoryStore.is_current()andchanged_since().content_stemskeeps tokens that contain digits, so "Ada is 6" and "Ada is 7" differ.decayed_at(schema v7) instead of movingupdated_at.update_confidence(confirmed=)moves it only for a confirmed lesson.get_all_knowledgebreaks timestamp ties by insertion order.docs/reference/eval.mdx(Memory Benchmark),docs/reference/cli.mdx,docs/sdk/sdks/memory.mdx.