Commit Graph
1 Commits
Author SHA1 Message Date
onibot 0ef4f32c8f knowledge: subject guard + boundary matching + answer log (run H fixes)
Run H (his E2E of run G's fixes) answered Q1 'three longest rivers of
Italy' with the WORLD list (Nile/Amazon/Yangtze fanned out, 226 rows).
Three root causes, all deterministic code (one is an LLM-side miss the
code now guards):

1. THE SUBJECT GUARD (new, _list_from_page): proper nouns of the
   question ('Italy') must appear in the article title or the tables'
   caption/headers — whole token, stem, or word prefix ('Europe' ->
   'European', the gentilici pattern). The disjointness guard was vacuous
   (first hop, empty evidence) and the fetch order put the world list
   first; the guard now refuses it BEFORE the SELECT_TABLE call (zero
   budget spent), logged as 'subject guard: ... refusing LIST'. Live
   verified: world article refused, Italy article answered 22 members,
   top-3 by table order = Po, Adige, Tiber.

2. WORD-BOUNDARY MATCHING (run H's KG pollution): the harvest ingested
   227 world rows as 'Outflow' edges because goal term 'flow' matched
   'Outflow' by substring; the discharge-list page did the same with 929
   rows. _term_hits/_tokens/_col_hits replace every substring goal-term
   match (harvest goal_hit + val_i, promote val_i, skim notice filter);
   the keyword fallback ('flow'/'discharge' in ANY header) is gone — the
   column must carry a goal term. Live: 0 Outflow edges.

3. THE EXPERT ANSWER LOG (his ask): 'OUTPUT EXPERT: Q1 -> ANSWER
   value=3 (list of 3 members: Po, Adige, Tiber) quote=... url=...
   [knowledge_graph]' — the answer is now IN the log, not deduced from
   the fan-out that follows. Every expert output line carries the qid.

Tests: knowledge/tests/guards.py (boundary matching incl. flow !=
Outflow, proper-noun extraction, subject guard both ways, harvest
boundary, the new ANSWER log format). store.py fixture now names its
subject in the title (predates the law). Suite 52/52. Live smoke: the
full run-H regression chain on real Wikipedia.
2026-10-21 09:42:51 +02:00