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)
This commit is contained in:
@@ -104,6 +104,31 @@ def test_empty_decomposition_stops():
|
||||
assert len(rep.questions) == 1 # only the goal, no subs
|
||||
|
||||
|
||||
def test_lm_death_aborts_cleanly():
|
||||
"""A dead LM (timeout/transport) must abort with notes + evidence kept,
|
||||
never crash the run with a traceback (Emili's 2026-10-19 home run)."""
|
||||
class DeadLM(Exception):
|
||||
pass
|
||||
|
||||
cause = TimeoutError("read timed out waiting for headers")
|
||||
dead = DeadLM("wrapper")
|
||||
dead.__cause__ = cause
|
||||
|
||||
class DeadModules(FakeModules):
|
||||
def route_question(self, question, catalog, evidence):
|
||||
raise dead
|
||||
|
||||
def synthesize(self, goal, evidence, unverified):
|
||||
raise dead # the LM is dead everywhere, synthesis included
|
||||
|
||||
fm = DeadModules(init_subs=[{"text": "q?", "deps": [], "answer_type": "CONSTANT"}],
|
||||
route_fn=lambda q: "numeric")
|
||||
rep = FloopRun("goal?", budget(), modules=fm).run()
|
||||
assert rep.final_answer == "" # no answer beats a fake
|
||||
assert any("LM unreachable" in n for n in rep.notes)
|
||||
assert rep.notes, "notes must explain the abort"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
fns = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
|
||||
for fn in fns:
|
||||
|
||||
Reference in New Issue
Block a user