fix(session): cap messages at persistence boundary

Bind SessionManager saves to the existing raw archive path so SDK imports and other bypass saves cannot persist more than the file cap without archiving unconsolidated overflow.

Add an SDK regression test that exercises the real ingest path.

Refs #4787
This commit is contained in:
KDB
2026-07-21 13:47:18 +08:00
committed by Xubin Ren
parent fde55d06e2
commit 7cf3c71e3a
3 changed files with 37 additions and 1 deletions
+1
View File
@@ -369,6 +369,7 @@ class AgentLoop:
self.context = ContextBuilder(workspace, timezone=timezone, disabled_skills=disabled_skills)
self.sessions = session_manager or SessionManager(workspace)
self.sessions.set_file_cap_archiver(self.context.memory.raw_archive)
self.tools = ToolRegistry()
# One file-read/write tracker per logical session. The tool registry is
# shared by this loop, so tools resolve the active state via contextvars.