His 23/10 review of the merged run found Q1's answer missing from the
stream. Chain, verified against the real code:
1. Q1 ('...does the title "President" refer to in relation to
PERSON_1?') fired the mask-seed detector's loose mechanism clause —
any 'refer to' in the sentence, even when the verb governs the
TITLE, not the placeholder. The seed answered 'Pedro Sanchez' to a
question that asked which OFFICE 'President' means: wrong semantics,
a false positive born from the collision of the detector's word
list with INIT's new hidden-precondition phrasing.
Fixes (both his ask):
- identity_answer STRICT: the mechanism clause now fires only with the
placeholder as the REFERENT of 'refer(s) to' (regex adjacency, both
orders). The literal 'who/what is <ph>' clause is unchanged.
- Found while verifying: the literal clause's lookahead accepted
apostrophes, so 'Who is PERSON_1's predecessor?' (possessive) seeded
too — the old test only covered 'Who WAS...'. Apostrophe removed from
the end-of-question char class; possessives never seed again.
- THE SEED IS NOW LOUD: RunStreams.warn() (new channel — WARNING line
in run.log, [W] on screen ALWAYS, even non-verbose) fires on every
seeded answer: 'WARNING SEED auto-answered Q1 ... (mask map; zero
expert calls)'. Self-improvement signal (META): which phrasings the
seed eats belongs to the lessons bank, and it must be legible that
the machine auto-answered without any expert.
Also: ARCHITECTURE.md §9-bis — OpenTelemetry observability roadmap
(his future plan ask): run = trace, calls/steps/rows = spans carrying
today's log fields, events.jsonl as the shared bus, warnings as
first-class span events; deferred until the loop hardening settles.
Tests: anonymize +4 assertions (his false positive, possessive trap,
strict positive shapes), machine +1 (seed WARNING lands in run.log).
Suite 17/17.
His local run: the term-start question answered '15' — not a date —
and the dependent predecessor question became unclear downstream.
- AnswerType.DATE joins the enum; the Subquestion desc the model sees
now says: DATE for a specific date (day, month and year — '15' alone
is NOT a date)
- _looks_like_date: deterministic admission bar — a plausible year
(1500-2999). '2 June 2018'/'June 2018'/'2018' pass; '15', a month
name alone, garbage: refused
- _append_checked: a DATE answer without a year becomes UNKNOWN, the
question fails honestly, a note lands in the run log — the wrong
type never flows silently into dependents
VERIFIED: tests/date_type.py 4/4 (enum+desc in the rendered schema,
deterministic admission, '15' rejected end-to-end, real date accepted);
suite 16/16.
His two-part direction after the PR-16 live run (the model spent a
subquestion asking 'who is PERSON_1?'):
1. INIT desc now says masked entities (PERSON_1, ORGANIZATION_1...) are
ALREADY-RESOLVED named entities — treat each as a known specific
entity; do not ask what or who the placeholder is.
2. Safety net: identity_answer() detects a subquestion that ONLY asks
who/what one placeholder refers to — the mask map already knows. The
machine seeds it as evidence (engine=mask:seed, verified, zero LLM
calls) instead of routing it to an expert.
Detection is deterministic and conservative by law: exactly one
placeholder in the text, literal 'who/what is <ph>' (ending there or in
punctuation — possessives like 'who is PERSON_1's predecessor' do NOT
match) or the text names the mask mechanism. Detection runs on the
MASKED text (placeholders still present) before restore.
VERIFIED: tests/anonymize.py 6/6 (seed marking, conservative detection
incl. possessives/comparatives/no-placeholder forms); suite 15/15.
Live E2E (glm-5.3-flash): with the new desc INIT returns exactly the
TWO subquestions he wants (term years + predecessor) — no identity
question, seed unused but armed; run answers Rajoy (E1+E2, 30 calls).
The model was using its own knowledge of the people in the question
to decide decomposition (his qwen collapsed Pedro Sanchez to ONE
subquestion: 'the question is nearly atomic because I know who he
is'). Structural fix: INIT sees the question's SHAPE, not identity.
- EntityMaskSignature (typed NER proposal): entities as list[NamedEntity]
(name verbatim + kind) — the typed-output law, no string parsing
- apply_mask/restore_mask: DETERMINISTIC code (LLMs propose, code
applies): longest names first, one placeholder per surface text,
typed prefixes PERSON_1/ORGANIZATION_1/..., restore longest-first
(PERSON_10 never eaten by PERSON_1)
- init_decompose: mask -> INIT -> restore in each returned subquestion;
MASK finding no entities OR dying (AdapterParseError) -> passthrough,
never a dead run
- MASK stage in the prompt log (prompts/01-MASK.txt)
VERIFIED: tests/anonymize.py 4/4 (deterministic apply/restore, E2E
mask+restore, no-entity passthrough, mask-death passthrough); suite
15/15. Live E2E (glm-5.3-flash): MASK found exactly Pedro Sanchez
(reasoning explicitly excluded 'President' as a role, not entity);
INIT saw 'Who was the President before PERSON_1?' and returned FOUR
subquestions (identity, office, term start, predecessor) — the shape
split he wanted, plus a 'who is PERSON_1' question; run answers Rajoy
correctly (E1-E4).
OPEN (his question pending): the model now asks WHO the placeholder
is, spending one call per run. Options: (a) keep, (b) desc note that
placeholders are known entities, (c) give INIT the masked question PLUS
the original as context. Not decided — he answers when back.
The last floop signatures migrate to the typed-output law:
- ExpertSignature.confidence: Confidence(str, Enum) high|medium|low,
with guidance in the desc — out-of-set values are schema violations
- AnswerSignature.unverified: real bool InputField (callers already
passed bools; the old signature stringified them)
- expert_draft/synthesize consume the typed values directly
VERIFIED: suite 14/14 green (new tests/typed_expert.py: enum parses
through the real adapter path, bad confidence raises, bool renders).
The floop side of the typed migration is COMPLETE — knowledge
signatures are the next (last) block.
ROUTE migrates to the typed-output law: the attendant is a closed enum
rendered into the prompt's JSON schema — an invalid pick is impossible
by contract (AdapterParseError after dspy's own re-ask).
- Attendant(str, Enum): knowledge logic analytic numeric floop user
(str mixin keeps the machine's == and `in EXPERT_ENGINES` intact)
- The per-field desc now carries the routing guidance (what each
attendant is FOR) — replacing the 'one of: ...' list in the old
string contract
- The machine's invalid-attendant branch stays as a contract guard
- New tests/typed_route.py: enum parses through the real adapter path
(RawEngine + cache=False), out-of-set attendant raises, str
compatibility holds
VERIFIED: suite 13/13 green; wire test with real glm-5.3-flash routes
all three probes correctly (knowledge / numeric / knowledge).
The typed-output migration starts with the machine's decomposition step:
the pipe contract ('text | deps | answer_type' lines) is gone — dspy
renders the Subquestion schema natively.
- Subquestion(BaseModel): text + depends_on: list[int] +
answer_type: AnswerType (enum rendered into the prompt's JSON schema)
- InitSignature/MissingSignature.subquestions: list[Subquestion]
- init_decompose keeps the (subs, raw) machine contract: a
schema-violating response raises AdapterParseError after dspy's own
JSON re-ask; its lm_response becomes the degrade signal so the
run-I law survives typing — the machine still routes the ORIGINAL
question, never garbage
- bare-number texts still dropped (now in _subs_from_typed)
- parse_subquestions kept as LEGACY for tests
Tests rewritten for the REAL adapter path (RawEngine + cache=False):
DummyLM bypasses the adapter; and dspy's disk cache (~/.dspy_cache)
cross-contaminates scripted tests sharing a fake model name — both
pitfalls found while migrating.
VERIFIED:
- suite 12/12 green (robust_init rewritten: 6/6 — E2E typed parse,
bare-number drop, garbage degrade, machine degrade, atomic case,
raw-response prompt log)
- live E2E (ollama-cloud glm-5.3-flash): INIT renders the enum schema,
glm returns depends_on ints + valid enums, machine dicts clean,
full run answers Rajoy with citations. NOTE: dspy's disk cache made
the second run's INIT a 0.2s cache hit — runs share the cache.
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.
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.
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
(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).
- 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)
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.