fix: include pending summaries in consolidation estimates

Made-with: Cursor
This commit is contained in:
Xubin Ren authored and Xubin Ren committed 2026-04-19 20:06:11 +08:00
1 parent 54b659929e
commit ccd6c05f71
4 files changed
+56 -11

No files matched your search

+8 -2
View File
@@ -648,7 +648,10 @@ class AgentLoop:
session, pending = self.auto_compact.prepare_session(session, key)
await self.consolidator.maybe_consolidate_by_tokens(session)
await self.consolidator.maybe_consolidate_by_tokens(
session,
session_summary=pending,
)
# Persist subagent follow-ups into durable history BEFORE prompt
# assembly. ContextBuilder merges adjacent same-role messages for
# provider compatibility, which previously caused the follow-up to
@@ -709,7 +712,10 @@ class AgentLoop:
if result := await self.commands.dispatch(ctx):
return result
await self.consolidator.maybe_consolidate_by_tokens(session)
await self.consolidator.maybe_consolidate_by_tokens(
session,
session_summary=pending,
)
self._set_tool_context(msg.channel, msg.chat_id, msg.metadata.get("message_id"))
if message_tool := self.tools.get("message"):