Commit d78115a
authored
fix(memory): guard against self-supersede hiding recalled preferences (#2452)
A saved priority-sender preference could end up with `superseded_by`
pointing at **its own id** — the update-consolidation path dedups
identical content back into the same row and then marked that row
superseded — so `recall(category=preference)` returned **0 results**.
Asking "what priority-sender rules do I have saved?" in a new session
answered "none" even though the rule was saved. Now the consolidation
path only supersedes when a genuinely new row was created, and the
memory store hard-rejects a self-supersede, so saved preferences stay
recallable.
## Test plan
- [x] Unit — `tests/unit/test_memory_store.py` +
`tests/unit/test_memory_mixin.py` → **507 passed** (incl. the two
regression tests)
- [x] Real-world, Linux + macOS — reproduced the exact dedup-collapse
trigger through the real installed package (log shows `knowledge deduped
id=…` — same id), then `get_by_category("preference")` returns the pref
with `superseded_by: None`; sqlite `SELECT id FROM knowledge WHERE
superseded_by = id` → `[]`
- [x] Agent UI, Linux + macOS — in a brand-new session, asked "what
priority-sender rules do I have saved?" → the RECALL tool fired and the
agent answered with the planted preference `zephyr-otter-9x@example.com`
**Real-world Agent UI evidence** (planted, unguessable fact
`zephyr-otter-9x@example.com`):


Closes #2446
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>1 parent 6bf96e5 commit d78115a
4 files changed
Lines changed: 71 additions & 5 deletions
File tree
- src/gaia/agents/base
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1364 | 1364 | | |
1365 | 1365 | | |
1366 | 1366 | | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1370 | 1374 | | |
1371 | 1375 | | |
1372 | 1376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1324 | 1324 | | |
1325 | 1325 | | |
1326 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
1327 | 1336 | | |
1328 | 1337 | | |
1329 | 1338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2371 | 2371 | | |
2372 | 2372 | | |
2373 | 2373 | | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
2374 | 2408 | | |
2375 | 2409 | | |
2376 | 2410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
168 | 185 | | |
169 | 186 | | |
170 | 187 | | |
| |||
3963 | 3980 | | |
3964 | 3981 | | |
3965 | 3982 | | |
| 3983 | + | |
| 3984 | + | |
3966 | 3985 | | |
3967 | 3986 | | |
3968 | | - | |
| 3987 | + | |
3969 | 3988 | | |
3970 | 3989 | | |
3971 | 3990 | | |
3972 | | - | |
| 3991 | + | |
3973 | 3992 | | |
3974 | 3993 | | |
3975 | 3994 | | |
| |||
0 commit comments