fix(compact): reduce to last user question when summary_model not configured but prior compaction block exists

Aligns the summary_model_not_configured path with the under-threshold and
client-compaction-block paths, which both reduce post-compaction messages
to just the latest user question so the downstream provider doesn't get
the summary on system prefix AND the full post-compaction history.

Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-27 17:19:18 +00:00
parent da18d905a3
commit b17a8c2acf
No known key found for this signature in database

View file

@ -511,6 +511,11 @@ async def apply_compact_20260112(
summary_model = _read_summary_model_setting()
if summary_model is None:
applied["error"] = "summary_model_not_configured"
if prior_compaction_block is not None:
# Prior context lives in ``augmented_system`` (compaction summary
# prefix); reduce to the latest user question to avoid re-sending
# stale post-compaction turns the summary already covers.
downstream_messages = _select_last_user_question(effective_messages)
return PolyfillResult(
messages=downstream_messages,
system=augmented_system,