mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 14:47:11 +01:00
#709 stopped the Groq FALLBACK serving the model's plan as the answer. The same guard was missing on the tool loop — the path that serves nearly every turn. WHY GROUNDING CANNOT COVER THIS A plan asserts nothing, cites nothing and invents no proper noun, so it passes every rule in verifyAnswer while telling the operator nothing at all. That is exactly how it reached production: retrieval was fine, the answer was scratchpad, and every automatic check said the turn was clean. WHY THE GAP IS REAL AND NOT THEORETICAL openai/gpt-oss-20b — the model that demonstrably wrote "We need to answer: … We must cite each claim … Let's go through each:" and spent its whole budget on it — is link TWO of this chain. The only reason the leak has not been seen here is that gpt-oss-120b usually answers first. That is luck, and a fallback chain exists precisely for the times the first link cannot answer. MEASURED BEFORE ADDING IT Ran the detector over every assistant reply Loki has stored: 106 replies, fires on exactly 2 — both the same question, both from before the fallback fix, both genuine leaks. ZERO false positives on the other 104. That was the deciding number rather than the hit rate. A guard that misfires costs a second model call on a rate-limited free tier, which is the resource this whole week of work has been about conserving. THE CURE MUST NOT BE WORSE Four properties pinned, three of them about restraint: - a plan is retried ONCE, with the instruction the first attempt showed it needed — never a loop - a second plan is not an improvement, so it is not retried again - an EMPTY retry never replaces a real reply: a plan at least shows the model read the question - a good answer is never re-asked, so the common path costs nothing The retry carries no tools: the model already gathered what it needed, and the failure was in writing the answer, not in finding it. A failed retry leaves the first reply standing — losing the turn to protect its formatting is the worse trade. The stream is reset so the plan does not sit on screen above the answer. Proved by mutation: disabling the guard fails "the plan must not reach the operator" and nothing else. Verify green, 233 checks. Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>