Hmbown/CodeWhale · error
Compaction coverage floor
Error message
Compaction coverage floor: {label} was dropped; history was not replaced. What it means
`require_text_survives` is a targeted survival check for a specific labeled text needle (summary snippet, key content). It searches the replacement history for a message whose Text or ToolResult content contains the needle; if nothing keeps it, the rewrite is rejected. Used by `validate_survival_contract` and the duplicate-summary test.
Solutions
- Keep the message containing the labeled text in the replacement history.
- If the label/needle is stale (test drift), update the needle to match the current anchor content.
- Check that rewrite does not drop Text blocks inside ToolResult content.
- Run `second_compact_does_not_duplicate_prior_summaries` / `validate_survival_contract` tests to locate the anchor.
Example fix
// before: replacement drops the anchored message let replacement = summarized_only; // after: retain the anchor message let replacement = [summarized_only, anchor_msgs.as_slice()].concat();
Defensive patterns
Strategy: validation
Validate before calling
fn keeps_needle(replacement: &[Message], needle: &str) -> bool {
replacement.iter().any(|m| m.blocks.iter().any(|b| match b {
ContentBlock::Text { text, .. } => text.contains(needle),
ContentBlock::ToolResult { content, .. } => content.contains(needle),
_ => false,
}))
} Try / catch
match compaction::apply_replacement(&replacement) {
Err(e) if e.to_string().contains("was dropped") => keep_original_history(),
other => other,
} Prevention
- Identify anchor texts (prior receipts, key snippets) and never drop their messages
- Update labeled needles when anchor content legitimately changes
- Search both Text and ToolResult content in checks
- Run validate_survival_contract before swapping history
When it happens
Trigger: `require_text_survives(original, replacement, label, needle)` runs and no block in the replacement (Text content or ToolResult content) contains the needle substring.
Common situations: A rewrite drops the message containing the labeled anchor (e.g. prior compaction receipt text or a required snippet); a test fixture expects an anchor that the new rewrite no longer preserves.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Compaction coverage floor: a last-round user message was…
- Compaction coverage floor: checkpoint receipt was dropped…
- Compaction coverage floor: last-round assistant output was…
- Compaction coverage floor: last-round tool call
- Compaction coverage floor: last-round tool result
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/3f1113ae960381da.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/compaction/last_round.rs:439
pub(crate) fn require_text_survives(
replacement: &[Message],
needle: &str,
label: &str,
) -> Result<()> {
let needle = needle.trim();
if needle.is_empty() {
return Ok(());
}
let kept = replacement.iter().any(|message| {
message.content.iter().any(|block| match block {
ContentBlock::Text { text, .. } => text.contains(needle),
ContentBlock::ToolResult { content, .. } => content.contains(needle),
_ => false,
})
});
if !kept {
anyhow::bail!("Compaction coverage floor: {label} was dropped; history was not replaced.");
}
Ok(())
}
pub(crate) fn validate_survival_contract(
original: &[Message],
replacement: &[Message],
anchors: Option<&str>,
) -> Result<()> {
validate_last_round_coverage(original, replacement)?;
let checkpoints = replacement
.iter()
.filter(|message| is_compaction_checkpoint_message(message))
.count();
if checkpoints == 0 {
anyhow::bail!(
"Compaction coverage floor: checkpoint receipt was dropped; history was not replaced."
);View on GitHub (pinned to 73e0f67d83)