mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-01 16:51:53 +03:00
fix(session): preserve complete transcripts
This commit is contained in:
@@ -35,7 +35,6 @@ from nanobot.runtime_context import (
|
||||
RuntimeContextBlock,
|
||||
append_runtime_context,
|
||||
)
|
||||
from nanobot.session.manager import FILE_MAX_MESSAGES
|
||||
from nanobot.utils.llm_runtime import runtime_from_provider_snapshot
|
||||
|
||||
|
||||
@@ -1451,7 +1450,7 @@ async def test_sessions_ingest_imports_transcript_without_running_model(tmp_path
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sessions_ingest_archives_overflow_at_persistence_boundary(tmp_path):
|
||||
async def test_sessions_ingest_preserves_full_transcript(tmp_path):
|
||||
config_path = _write_config(tmp_path)
|
||||
bot = Nanobot.from_config(config_path, workspace=tmp_path)
|
||||
|
||||
@@ -1459,16 +1458,14 @@ async def test_sessions_ingest_archives_overflow_at_persistence_boundary(tmp_pat
|
||||
"sdk:overflow",
|
||||
[
|
||||
{"role": "user", "content": f"message-{index}"}
|
||||
for index in range(FILE_MAX_MESSAGES + 1)
|
||||
for index in range(2_001)
|
||||
],
|
||||
)
|
||||
|
||||
assert len(snapshot.messages) == FILE_MAX_MESSAGES
|
||||
assert snapshot.messages[0]["content"] == "message-1"
|
||||
history = bot.memory.read_history(session_key="sdk:overflow")
|
||||
assert len(history) == 1
|
||||
assert "[RAW] 1 messages" in history[0]["content"]
|
||||
assert "message-0" in history[0]["content"]
|
||||
assert len(snapshot.messages) == 2_001
|
||||
assert snapshot.messages[0]["content"] == "message-0"
|
||||
assert snapshot.messages[-1]["content"] == "message-2000"
|
||||
assert bot.memory.read_history(session_key="sdk:overflow") == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user