Phase 0 — judge value cleanup + --no-cache + import assert

The (K5) bug fix (his 24-25/10 session): glm-5.3-flash glues row
citations and glosses onto the judge's value field, killing the ablation
audit silently ("the judge invented it: nothing to ablate") and leaking
LLM prose into typed payloads. Fixed at the judge's output boundary
(_answer_from_rows): trailing-only, marker-anchored cleanup (_clean_value)
that strips the three live citation shapes and survives legitimate
parentheticals ("(PSOE)", "(since 2018)"). The AnswerFromKG value desc
now says what the value must be.

--no-cache CLI flag (his ruling: the dspy disk cache is not a bug, the
default stays; the flag exists for A/B and freshness testing) — builds
dspy.LM with cache=False for the process; verified live: repeated runs
re-run real inference instead of replaying.

Import assert at startup: floop/knowledge SUBMODULE files must resolve
inside this repo's tree. Namespace-package __path__ lies (it recomputes
dynamically and lists every tree), so the check pins the actual module
files (run 085457 was main's pipeline inside the branch worktree, no
signal). Abort loudly, don't log.
This commit is contained in:
2026-10-25 20:00:34 +01:00
parent e594339629
commit 985aec2f60
5 changed files with 200 additions and 6 deletions
+8 -1
View File
@@ -171,9 +171,14 @@ _STAGE_BY_MODULE = {
}
def configure_lm() -> dict:
def configure_lm(no_cache: bool = False) -> dict:
"""Configure dspy's default LM from config.yaml + FLOOP_LM env override.
no_cache=True builds the LM with dspy's response cache DISABLED for this
process (his ruling 25/10: the cache is caching doing its job — the
default stays cache=True; the flag exists for A/B and freshness testing
so a repeated question is a real run, not a byte-identical replay).
Returns the active provider settings (for provenance logs).
"""
cfg = _load_yaml()["lm"]
@@ -190,6 +195,8 @@ def configure_lm() -> dict:
"temperature": p["temperature"],
"api_key": os.environ.get(p.get("api_key_env", ""), "empty"),
}
if no_cache:
kwargs["cache"] = False
lm = dspy.LM(**kwargs)
global _ACTIVE
_ACTIVE = lm