fix(session): keep compaction continuations out of later turns

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-17 22:18:38 +08:00
1 parent 28d9721bfd
commit 5f378c9aff
10 files changed
+84 -55

No files matched your search

+8 -1
View File
@@ -552,11 +552,18 @@ class ContextGovernor:
)
compaction.active_summary = summary
# Fresh user input defines the next task. Only ongoing work without
# new user input needs a temporary instruction to resume after H is replaced.
continuation = (
[]
if any(message.get("role") == "user" for message in delta_messages)
else [{"role": "user", "content": SUMMARY_CONTINUATION_TEXT}]
)
prepared = self.prepare_messages_for_model(
state.config,
[
*self._summary_transcript(compaction, summary),
{"role": "user", "content": SUMMARY_CONTINUATION_TEXT},
*continuation,
*delta_messages,
],
)