pub fn detect_compression_failure(
response: &str,
had_compaction: bool,
) -> Option<String>Expand description
Detect whether response contains signals of context loss after compaction.
Returns Some(reason) only when ALL of:
had_compactionistrue- At least one uncertainty phrase matches
- At least one prior-context reference phrase also matches
This two-signal requirement minimizes false positives. Neither pattern set alone is reliable; together they are highly specific.
ยงReturns
Nonewhenhad_compactionisfalse.Nonewhen the response does not match both signal categories.Some(reason)with a description string when context loss is detected.