floop: strict mask-seed detection + WARNING on seeded answers
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.
This commit is contained in:
@@ -264,6 +264,32 @@ def test_fanout_respects_top_n_slice():
|
||||
print("ok test_fanout_respects_top_n_slice")
|
||||
|
||||
|
||||
def test_seed_warning_is_emitted():
|
||||
"""The mask seed auto-answering a question must WARN (his 23/10 ask):
|
||||
on the log as WARNING, on screen even non-verbose — self-improvement
|
||||
signal, not silent evidence."""
|
||||
import tempfile
|
||||
from floop.stream import RunStreams
|
||||
streams = RunStreams("seed warn test", verbose=False,
|
||||
runs_dir=tempfile.mkdtemp())
|
||||
fm = FakeModules(
|
||||
init_subs=[
|
||||
{"text": "Who is Pedro Sanchez?", "deps": [],
|
||||
"answer_type": "OPEN", "known_answer": "Pedro Sanchez"},
|
||||
{"text": "What office did Pedro Sanchez hold?", "deps": [1],
|
||||
"answer_type": "OPEN"},
|
||||
],
|
||||
route_fn=lambda q: "knowledge", expert_value="President")
|
||||
run = FloopRun("Who is Pedro Sanchez and what office does he hold?",
|
||||
budget(), modules=fm, streams=streams)
|
||||
run.run()
|
||||
log = streams.log_path.read_text(encoding="utf-8")
|
||||
assert "WARNING SEED auto-answered Q1" in log, log[-400:]
|
||||
assert "mask map; zero expert calls" in log
|
||||
assert any("seeded from anonymization" in n for n in run.notes)
|
||||
print("ok: seed WARNING lands in run.log (auto-answer is loud)")
|
||||
|
||||
|
||||
# keep a handle to restore the real engine after monkeypatching
|
||||
from floop.engine import LLMExpertEngine as _restore_llm_engine
|
||||
|
||||
|
||||
Reference in New Issue
Block a user