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
After a summary request, the library checks the provider-declared stop reason; a stop reason classified as incomplete (e.g. max tokens, length cutoff) means the summary is a fragment. Since usage is already billed but the summary is truncated, the library fails rather than replace session history with an incomplete summary.
Solutions
- Increase max output tokens on the compaction/summary request so the summary fits.
- Reduce input scope (compact earlier, or summarize in chunks) so the summary needs fewer tokens.
- Check the provider's stop-reason value against `is_incomplete_stop_reason` to confirm what triggered the cutoff.
- Retry with a model/context window that can emit a complete summary.
- The original history is preserved — no data is lost; re-run compaction after fixing the limit.
Example fix
// before: summary truncated at default token cap let resp = model.request(req, /* max_tokens */ 512); // after let resp = model.request(req, /* max_tokens */ 4096);
Defensive patterns
Strategy: validation
Validate before calling
fn incomplete(resp: &Response) -> bool {
codewhale_models::is_incomplete_stop_reason(resp.stop_reason.as_deref())
} Type guard
if incomplete(&response) { /* reject before applying */ } Try / catch
match compaction::summarize(&history) {
Err(e) if e.to_string().contains("incomplete") => {
// raise token budget and retry once
retry_with_larger_max_tokens()
}
other => other,
} Prevention
- Set max_tokens high enough for the worst-case summary size
- Compact before the history grows too large
- Monitor provider stop reasons in logs
- Prefer models with adequate output limits
When it happens
Trigger: A compaction summary request returns with `response.stop_reason` that `codewhale_models::is_incomplete_stop_reason` classifies as incomplete (e.g. length/max-token truncation).
Common situations: Summary output budget (max_tokens) too small for a long conversation; a provider change in stop-reason strings; a slow/local model hitting a token ceiling mid-summary.
Related errors
- translate: provider response incomplete
- Chat Completions stream closed before [DONE] or…
- Compaction coverage floor: a last-round user message was…
- Compaction coverage floor: checkpoint receipt was dropped…
- Compaction coverage floor
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/54d79b1236b231f7.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/compaction.rs:1664
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 codewhale_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.",
codewhale_models::stop_reason_detail(response.stop_reason.as_deref())
);
}
if response
.content
.iter()
.any(|block| matches!(block, ContentBlock::ToolUse { .. }))
{
anyhow::bail!(
"Compaction returned a tool call instead of a completed handoff; original conversation was preserved."
);
}
let summary = response
.content
.iter()
.filter_map(|block| match block {View on GitHub (pinned to 73e0f67d83)