Commit Graph
7 Commits
Author SHA1 Message Date
onibot efd539c128 knowledge+llm: dst-first ablation mask (run L) + re-ask budget meter
Two fixes from his 22/10 re-run log, both small and deterministic:

1. THE ABLATION MASK WAS QUOTE-BLINDED (run L: Q1 stayed silent over
   the Pedro page that run J flags). The Pedro paragraph interleaves
   all three readings in ONE quote ('...Secretary-General ... ninth
   president of Socialist International...'), and _carries matched
   the picked value by substring over dst OR quote — so masking SI's
   support masked the PM/PSOE rows too; round 1 answered UNKNOWN and
   the audit died silent. The DST-FIRST LAW: when a row has a
   meaningful dst (non-empty, non-numeric) it is the VALUE BEARER and
   the mask matches IT; the quote is a fallback only for
   empty/numeric dsts. Same law in _carries_target for each round's
   surviving value, with one addition: the judge's round value may be
   an OFFICE DESCRIPTION ('prime minister of Spain') while the row's
   dst is the ENTITY ('Spain') — resolve by reciprocal token
   containment, or the loop dies after one alternative.

2. THE ADAPTER RE-ASK WAS INVISIBLE TO THE BUDGET (run L: prompts #9
   and #10 were both ANSWER — #10 5 chars shorter, 340s, the
   ChatAdapter's JSON-fallback second wire call after a parse
   failure; llm_calls said 9/80 while 10 hit the wire). THE METER:
   the prompt-log callback already sees every LM call — a second LM
   call with NO new module forward between them is the adapter
   fallback re-firing inside the same Predict. Count it, log the
   line, and charge the budget through a meter hook the machine
   wires at construction. A re-ask at the ceiling does not kill the
   run (the call already happened). dspy's BEHAVIOUR IS UNTOUCHED —
   his call: the fallback stays, it is future self-improvement
   signal (which prompts the model formats badly), not a bug.

Tests: knowledge/tests/ablation.py +3 — run-L regression (interleaved
one-paragraph quote flags all three readings), office-description
resolution, numeric-dst quote fallback. tests/reask_meter.py +3 —
fallback detected and charged on the REAL adapter path (custom engine
returning raw text, marker-less first response), separate forwards NOT
flagged (the ablation-rounds shape), ceiling charge survives. Suite
12/12 files green (74 tests). Live smokes: the run-L interleaved-quote
page flags SI+PM+SG through the full pipeline; the run-J
separate-quotes smoke still passes.
2026-10-22 11:21:25 +02:00
onibot b5a9403063 machine: robust INIT parsing + raw-response log (run I fixes)
Run I ('Who was the President before Pedro Sanchez?'): the INIT LM wrote
its own line numbers as an extra first pipe field ('1 | Who was... |
none | OPEN'), the naive parse took '1' as the subquestion text, ROUTE
classified Q1='1' as numeric, and the machine burned four calls on
garbage before luck produced the answer. Two of the fixes close the same
observability gap that hid the root cause for a day.

1. PARSER (parse_subquestions): shifts the numbered form (>=4 fields
   with a bare number first) and drops any text that is a bare number —
   a routable question is text, never '1'. Enumerator prefixes ('1.')
   inside the text field are stripped. Well-formed lines parse exactly
   as before (regression-tested).

2. INIT DEGRADE (machine): init_decompose now returns (subs, raw).
   Non-empty raw that parses to nothing = model garbage — degrade to
   the ORIGINAL question as one OPEN subquestion (routable, logged,
   budget-safe). Empty raw keeps the old law: the question is atomic,
   stop and synthesize — never fabricate a subquestion.

3. RAW RESPONSE LOG (the ask behind the ask): prompts/NN-stage.txt now
   carries the exact LM response after the prompt. Run I's parsed
   'OUTPUT INIT: 1\n2' could not show what the model actually wrote —
   the raw text is in the file from now on; the log stays line-based.

Tests: tests/robust_init.py — the numbered form, bare-number drop,
enumerator strip, happy-path regression, the degrade, the atomic stop,
raw-response capture. Suite 59/59. Smoke: the exact run-I transcript
replayed through the real machine (DummyLM) parses to Q1/Q2 real
subquestions and answers Mariano Rajoy.
2026-10-21 12:08:50 +02:00
onibot 06124a0198 store/expert/machine: keep source order end-to-end; refuse fake top-N
log-09 bug: a KG-served set answered the fan-out top-3 with adda, adige,
arno — the alphabetical list_members order masquerading as a ranking.

- edges.list_ord (auto-migrated): each member_of edge records its row
  position in the source table; list_members(ordered=True) returns source
  order, list_is_ordered() tells whether the set has proven order
- ingest writes ordinals; fresh-serve and _serve_set keep table order and
  set coverage.ranked accordingly
- fan-out top-N: slices ONLY ranked lists; an unranked list refuses the
  slice, expands all entities, and says so in notes + thinking (never
  silently alphabetical)
- regression test: Po/Adige/Tiber first; unordered set -> all expanded
2026-10-19 20:31:04 +02:00
onibot 209909e776 machine: fan-out planner + disjointness guard (runs 07/08 lessons)
(a) Disjointness guard (knowledge/expert.py): a LIST ingest whose members
    don't overlap the entities the parent's evidence names is refused; the
    gather continues to the next article. Run-08's 'flow of Po/Adige/Tiber'
    answered by the Amazon from a world-wide table can no longer happen.
(b) Fan-out planner (floop/machine.py): a 'for each' subquestion over a list
    row expands deterministically into N entity questions + one join.
    Top-N bound respected ('those three' over 22 rows -> top 3 by table
    order, logged). The join is a deterministic sum over the entity rows
    (verified=True: computation is its own proof), partial sums named.
    Entity rows are tagged fan_group in provenance so the join finds them.
Also: LIST ingest keeps TABLE ORDER (ranked tables rank; alphabetical sort
      destroyed the ranking) — dict.fromkeys dedup.
Budget: 40 -> 80 (a 3-entity fan-out needs ~3x a scalar question).

Verified live (cold KG, 2 runs): list ingest in table order, slice top-3,
fan-out -> 3 entity questions + join, Po answered with verbatim quote
(1,460 m3/s). 28/28 tests (fan-out expansion+join, top-N slice, guard).
2026-10-19 20:16:01 +02:00
onibot b14915079e store: auto-migrate old KGs (edges.origin_question); machine: abort honestly on dead LM
- KnowledgeStore._migrate(): idempotent additive migration on open — a
  pre-2026-10-19 KG no longer crashes the set gate with 'no such column'
- _lm_dead(): transport/timeout deaths abort the run with notes (no answer
  beats a made-up one); code bugs still crash loudly
- tests: migration from a hand-built old-schema store; LM-death abort (24/24)
2026-10-19 12:11:59 +02:00
onibot e5482bd092 feat(logic): setop engine + set gate — the Europe count computed end-to-end
A) SET GATE: enumerations are answered only from membership sets, never from mention rows (the probe early-exit that served 'Armenia, Cyprus, Georgia, Turkey' to 'what countries are in Europe' is dead). Sets carry origin_question; the gate matches stem-Jaccard>=0.5 so a set is served to its own question only. B) SETOP ENGINE: logic's first real engine — a count over list rows is computed (difference/intersection/count over norm_name'd items, table markers 'Austria*' == 'Austria'), before ROUTE, zero LLM calls, verified=True because the computation IS the check. C) Catalog honesty: knowledge 'lists are ONE fetch', logic 'how-many over lists in evidence', floop 'NOT mere size'. Plus four substrate bugs the live runs exposed: LM-proxy prompt cache (instant answers are cache hits, never trust zero latency), _context rendering list rows as scalars ('E1: 50' routed 'those countries' to user), <br> concatenation in multi-value name cells, multi-line refs leaking into values ('franceincludes the 101 departments' -> France dropped from EU -> 24 not 23). Cold E2E: Q1 50 states ingested, Q2 27 EU members ingested, Q3 difference computed = 23, cited over E1/E2. 22/22 tests.
2026-10-18 19:49:24 +02:00
onibot d0942bdc69 floop v0.1: design docs + executable dspy draft
Root: README, PIPELINE, ALGORITHM, GAPS, RUNLOG (design + first executable runs). code/: v0.1 draft on dspy 3.4 (INIT/ROUTE/EXPERT/MISSING/ANSWER as dspy calls, machine as fixed code, stub engines — honest Unverified). knowledge/: DESIGN.md for the KG-first knowledge expert (pre-implementation).
2026-10-13 13:39:31 +02:00