Record the version and content hash of each item a read returns

Aperta
#1,759 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à
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
clickhouse, python

Direzione di ricerca

Start with server/memory/app/exposure_ledger.py, then read server/core/hashing.py, server/memory/domain/trust.py, server/memory/api/models_search.py, and server/knowledge/api/models_knowledge.py. Trace the additive migration and namespace and user erasure paths for loom.memory_exposures and the proposed document read table. Done means the acceptance fixtures pass, old rows remain unrecorded, and search latency and per-item storage are measured.

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

Descrizione

enhancement
Company

ClickHouse

Component

Memory and search

Use case

#1149 asks for a receipt that identifies the served revision or content hash of what a read returned, and says a past revision is never reconstructed from the artifact's latest value.

The read record cannot answer that today. loom.memory_exposures names each returned item by key, in returned_keys, with no version and no hash (server/memory/app/exposure_ledger.py). Once a second revision of a key is published, a run that read the first looks the same as a run that read the second. A document search writes no record of what it returned.

Describe the solution you'd like

Put the revision on the read record. This is a proposal; nothing is implemented or measured.

  • Each loom.memory_exposures row carries the version and the content hash of every item it returned, as two arrays aligned with returned_keys.
  • The hash is the canonical content hash: the one memory.get serves (served_content_sha256 in server/core/hashing.py) and an attestation binds to (server/memory/domain/trust.py). If a search hit gains a content hash through other work, the receipt records that same hash.
  • A row written before the change, or by an older build during a rolling upgrade, has empty arrays. It reads as "revision not recorded" and is never filled in from the latest value.
  • A document search gets the same record in a new table, added by an additive migration: source URI, document revision, chunk index, request and run, with the identity fields and the token's actor the memory ledger carries. The revision is the one knowledge.search already returns with each hit (server/knowledge/api/models_knowledge.py). The table is classified for namespace and user erasure in the same change.
  • The record stores no content, no prompt and no query text. A version and a hash leave as the keys do today: with namespace and user erasure and with the ledger's expiry.
  • The write stays best-effort: a missing record is a state the reader reports, not an error.

Acceptance fixture, from the cases #1149 lists:

  1. Two revisions of one memory key: a run that read the first still names its version and hash after the second is published.
  2. A row with empty arrays reads as "revision not recorded".
  3. A document is replaced: the read record names the revision served before the replacement.
  4. Namespace erasure and user erasure remove the document read records.
  5. No record holds content or query text.

Evidence still needed before rollout:

  • memory.search p95 with and without the two arrays, and whether the content hash is available on the read path without a point read per hit. A search hit carries version and no content hash today (server/memory/api/models_search.py).
  • Storage of the ledger with the arrays, per returned item.
Describe alternatives you've considered
  • Join the read record to the version history by time. That infers the revision, and a write between the read and its record makes the answer wrong.
  • Record revisions in loom.search_trace_log. That log is off by default because it stores query text.
  • Let the client send hashes at run.complete. That is client-reported reliance, not what Loom returned.
Where the need comes from

An AI tool suggested this feature

Additional context

Found by source review; no read was recorded and no latency was measured.

This is the storage part only. How reliance is read over this record is a separate proposal under #1149 and does not block this one.

Related: Proposed as part of #1149. Roadmap: #1232.

Lingua principale
Python
Stelle
263
Fork
47
Merge medio
14h 21m
PR unite (30g)
873

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 ClickHouse/loom

Tutte le issue di ClickHouse/loom

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.