Repository navigation
Description
A re-pushed document's facts read as stale until its new version is extracted
First, thank you for the record axis and the stale reading: being able to tell a fact whose words are gone from one that is still said is exactly what we lean on for our mirror. This is a note on one gap we ran into between the two moments a re-push has.
What we see
Our CI re-pushes the same statements items after every merge. On our instance, fact 01a18869-d0f6-7102-b2a4-5c96a68346b7 (an open covers statement in base 01a14133-f48c-7183-a3e2-48296b6752d6) has evidence on versions 3, 4 and 5 of document 01a16d0d-1942-70f1-b7ea-dea997a07a5c, all of them superseded, and GET /kbs/{kb}/entities/{id} reads it as stale: true. Version 6 of that document was ingested at 2026-11-05T00:49Z and has attached nothing yet: it is still in the extraction queue, which on our base runs days behind during a backfill. Nothing was dropped; the new version has simply not spoken.
The same reading sits in three places, so the effect is wider than one flag:
graph.rs entity_detail, thestalecolumn (around line 1794);review.rs UNCONFIRMED_FACT, which the Review queue andgraph::stale_factsuse;- any closing built on
UNCONFIRMED_FACT(on our fork, the batch close of RC-004), which in this window would close facts that are still true.
Why
documents::replace_chunks_for_snapshot supersedes the old chunks at the moment version N+1 is written (UPDATE chunks SET superseded_at = now() … NOT (id = ANY($2))), while the new chunk's evidence arrives only when extract_document runs run_open. Between the two, every fact of the item has evidence on superseded chunks only, which the three readers take as "no longer said".
Proposed change
One clause, shared by the three readers: a fact is unconfirmed or stale only when, besides having no live evidence chunk, none of the documents citing it still holds a live chunk that awaits extraction.
AND NOT EXISTS (SELECT 1 FROM fact_evidence fe
JOIN chunks c ON c.document_id = fe.document_id
WHERE fe.fact_id = f.id AND c.superseded_at IS NULL AND c.extracted_at IS NULL)Once the new version is extracted the clause stops holding, and a fact it did not restate reads stale as today. Nothing else changes.
We will build and run this on our fork first, with a test that holds the fact live in the gap and lets it go once the new chunk is read. If this shape looks right to you, we would be glad to send it here; if you would rather see it done differently, we will follow your lead.
Activity
gedaiu commentedon Nov 5, 2026
The clause is up on our fork first, re-cinq#49, with a test that holds the fact live while the new version is unread and lets it go once the chunk is read. I will send it here once it has run on our instance, or sooner if you prefer; and if you would shape it differently, I am glad to follow.
Utopia: pin 0.1.0-re.29 (#4129)
Run Utopia re.30: a fact waits only for a new version that something …
gedaiu commentedon Nov 7, 2026
A small refinement after running it on our instance: waiting for any unread version was too broad. A document whose extraction is off, skipped or failed also has an unread version, and nothing will ever read it, so the facts it cites waited forever (about 12,500 on one of our bases). On our fork, re-cinq#52 now lets a fact wait only while its document is still being ingested or its extraction is queued or running. The ingest stage matters because a re-push resets
graph_statustononeuntil the extraction is queued. It is one more join in the same clause, with a test for each case. When this comes upstream, I would send both changes together as one. Thank you for the patience with the back and forth.WaylandYang commentedon Nov 25, 2026
Fixed by #1489 (merged into dev): a fact is not stale while a new version of its document is still waiting for extraction. Closing; closing keywords don't fire on dev, so this one had to be closed by hand.