A deleted memory stays on a tag-scoped page when the delete lands while consolidation is pending

Aperta
#6,895 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, python
Ambito
backend, databases

Direzione di ricerca

Start with _submit_refreshes_for_retracted_grounding in hindsight_api/engine/memory_engine.py and _trigger_mental_model_refreshes in engine/consolidation/consolidator.py; trace how a skipped retraction check is handled when consolidation completes. Add a regression test for deleting a memory cited by a tag scoped page while an unrelated consolidation is pending. Done means the page is refreshed after that consolidation finishes, regardless of its tags.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

core

Version: 1.3.0 (Docker ghcr.io/vectorize-io/hindsight:1.3.0), PostgreSQL bundled, observations on.

What happens
DELETE /documents/{id} calls _submit_refreshes_for_retracted_grounding
(hindsight_api/engine/memory_engine.py, line 11956 in 1.3.0). That function returns early when the bank has facts
pending consolidation (line 22005, has_pending_consolidation), and leaves the retraction to the refresh that the
consolidation completion hook triggers. But that hook only considers pages whose scope the consolidation touched:
_trigger_mental_model_refreshes in engine/consolidation/consolidator.py (lines 2608 to 2672) selects tagged pages only
when consolidated_tags overlaps their tags. If the pending consolidation was for an untagged memory (or one with other
tags), a tag-scoped page that cites the deleted memory is never refreshed. It keeps the deleted claim in its content
until some later delete runs the sweep with nothing pending.

Expected
A page whose grounding cites a deleted memory is refreshed (or its retraction re-offered) once the pending consolidation
finishes, whatever that consolidation's tags were.

Minimal repro (made-up data)

  1. Create a bank with an entity label group person (tag: true), default_observation_scopes: per_tag.
  2. Retain "Ananya's phone is +91 90000 11111" with tag person:ananya (document f-21); wait for consolidation.
  3. Create a page: POST /pages {"name": "Ananya", "source_query": "Who is Ananya?", "tags": ["person:ananya"]};
    wait until it holds the number.
  4. Retain an untagged memory "Likes masala chai" (document f-28) and, at once (before its consolidation finishes),
    DELETE /documents/f-21.
  5. The log shows no "Scheduled N refresh(es) ... grounding cites memories that no longer exist" for this delete; the
    consolidation of f-28 triggers only untagged pages. The Ananya page keeps "+91 90000 11111" (25 minutes in our
    test, with trace and histories off) until a later DELETE with nothing pending runs the sweep.

Seen with: gpt-6-luna on Azure (OpenAI provider), at most 2 LLM calls at once. Not model-specific: the skip and
the candidate filter are in code.

Suggested fix: when the sweep is skipped for pending consolidation, record the bank as owing a retraction check,
and have the consolidation completion hook run _has_retracted_grounding over all auto-refreshing pages of that bank
(not only the ones whose tags the consolidation touched).

Lingua principale
Python
Stelle
45.2k
Fork
5.9k
Merge medio
6h 18m
PR unite (30g)
354

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vectorize-io/hindsight

Tutte le issue di vectorize-io/hindsight

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.