refactor(agent): make memory summaries cumulative (#5610)
* refactor(agent): make memory summaries cumulative Treat the latest session summary as a replacement checkpoint, preserve it through bounded raw fallbacks, and reserve history.jsonl for Dream ingestion. * fix(agent): preserve cumulative checkpoint context * fix(agent): preserve memory archive prompt cache * refactor(agent): state archive prompt positively * refactor(agent): remove checkpoint version migration * refactor(agent): summarize full archive context * test(agent): align cumulative archive prompt assertion * refactor(agent): clarify memory checkpoint contract
This commit is contained in:
1 parent
6cd7063682
commit
bb34b58f47
12 files changed
+476
-514
No files matched your search
@@ -444,7 +444,6 @@ class AgentLoop:
|
||||
workspace_scopes=self.workspace_scopes,
|
||||
unified_session=unified_session,
|
||||
),
|
||||
unified_session=unified_session,
|
||||
)
|
||||
self.auto_compact = AutoCompact(
|
||||
sessions=self.sessions,
|
||||
@@ -1109,9 +1108,6 @@ class AgentLoop:
|
||||
channel=request_ctx.channel,
|
||||
workspace=effective_scope.project_path,
|
||||
include_memory=session.policy.persist if session is not None else True,
|
||||
include_memory_recent_history=not ephemeral,
|
||||
session_key=session.key if session is not None else request_ctx.session_key,
|
||||
unified_session=self._unified_session,
|
||||
)
|
||||
if request_context is None:
|
||||
request_ctx = dataclasses.replace(
|
||||
@@ -1883,6 +1879,13 @@ class AgentLoop:
|
||||
session,
|
||||
runtime=runtime,
|
||||
)
|
||||
# Token consolidation may have committed a replacement checkpoint
|
||||
# after the compact stage captured its summary for this request.
|
||||
ctx.session, ctx.pending_summary = self.auto_compact.prepare_session(
|
||||
session,
|
||||
ctx.session_key,
|
||||
)
|
||||
session = ctx.require_session()
|
||||
is_subagent = ctx.kind is TurnKind.SYSTEM and ctx.msg.sender_id == "subagent"
|
||||
|
||||
_hist_kwargs: dict[str, Any] = {
|
||||
|
||||
Reference in new issue
Block a user