Hmbown/CodeWhale · error
Compaction summary response incomplete: provider stop reason
Error message
Compaction summary response incomplete: provider stop reason `{}`; the partial summary was not accepted. What it means
The summary request finished with a provider stop reason classified as incomplete (e.g. length/max_tokens or content filter). Usage was already billed and recorded, but the fragment is not accepted as the session checkpoint (crates/tui/src/compaction.rs:1273); the message includes stop_reason_detail to distinguish causes.
Source
Thrown at crates/tui/src/compaction.rs:1273
cost_scope,
config.runtime_cost_owner.as_deref(),
&format!(
"compaction:dispatch:{}:response:{}",
cost_route
.dispatched_at
.timestamp_nanos_opt()
.unwrap_or_default(),
response.id
),
&cost_route,
&response.usage,
);
// Usage above is already billed; a provider-declared incomplete
// summary must still fail rather than replace the session history
// with a fragment.
if crate::models::is_incomplete_stop_reason(response.stop_reason.as_deref()) {
anyhow::bail!(
"Compaction summary response incomplete: provider stop reason `{}`; the partial summary was not accepted.",
crate::models::stop_reason_detail(response.stop_reason.as_deref())
);
}
let summary = response
.content
.iter()
.filter_map(|block| match block {
ContentBlock::Text { text, .. } => Some(text.clone()),
_ => None,
})
.collect::<Vec<_>>()
.join("\n");
if let Err(error) = validate_compaction_summary(&summary) {
if quality_retry_used {
return Err(error.context(View on GitHub (pinned to 8880682c63)
Solutions
- Raise the compaction output-token budget in config
- If the stop reason is content_filter, compact earlier so less sensitive material accumulates, or change models
- Retry once - truncation can be borderline and stochastic on similar lengths
- Compact more frequently so each individual summary is smaller
Defensive patterns
Strategy: try-catch
Validate before calling
// Before compacting, budget output tokens against session size let out_tokens = cfg.compaction_max_output_tokens(); ensure!(out_tokens as u64 >= estimated_summary_tokens(&messages), "output budget too small; will truncate");
Type guard
fn is_incomplete_summary(msg: &str) -> bool {
msg.contains("Compaction summary response incomplete")
} Try / catch
// Read stop_reason_detail from the message: raise budget for `length`, change model for `content_filter`
if is_incomplete_summary(&e.to_string()) {
if e.to_string().contains("length") || e.to_string().contains("max") {
raise_output_budget_and_retry();
} else {
switch_compaction_model();
}
} Prevention
- Set compaction output tokens generously - longer than any expected summary
- Compact more often so individual summaries stay short
- Remember the partial is billed but never applied
When it happens
Trigger: Compaction output-token budget smaller than the summary a long session needs; provider-side length caps; content-filter truncation of the summary itself.
Common situations: Very long sessions compacted in one shot; default max output tokens too low for the summary model; strict providers that truncate aggressively.
Related errors
- Compaction summary response was unusable: no text was return
- Compaction summary response was unusable: only whitespace or
- Model response incomplete: provider stop reason `{}`; the pa
- Model response incomplete: provider stop reason `{}`; the JS
- Codewhale terminal receipt did not use provider openai
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/54d79b1236b231f7.
Report an issue: GitHub.