mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
v1.4.43 W13 M-3 — `detectRefusal` runs only on the inbound `message` each turn. `priorTurns` are loaded straight from `coach_messages.encryptedContent` and concatenated into the `userPrompt` transcript every reply. An injection that slipped past the regex bank on a previous turn was re-entering the prompt verbatim on every subsequent turn, so the model saw it on every reply — false-negative amplification. Re-run `detectRefusal` against each user-turn re-loaded from DB before building the transcript. On a hit, short-circuit the SSE with a refusal AND emit an `audit.coach.replay-injection` row so operators have a durable signal. The audit row carries the conversation id, turn index, and matched reason — never the message content, so the bypass payload doesn't survive into the audit ledger.