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

+2 -3
View File
@@ -12,7 +12,6 @@ from nanobot.bus.events import InboundMessage
from nanobot.bus.queue import MessageBus
from nanobot.providers.base import LLMResponse
from nanobot.session.manager import Session
from nanobot.session.summary import SUMMARY_CONTINUATION_TEXT
def _make_loop(tmp_path: Path, context_window_tokens: int = 200_000) -> AgentLoop:
@@ -113,6 +112,6 @@ async def test_runner_checkpoint_keeps_current_user_as_replay_boundary(tmp_path:
sent_messages = loop.provider.chat_stream_with_retry.await_args.kwargs["messages"]
sent_text = "\n".join(str(message.get("content")) for message in sent_messages)
assert "new question" in sent_text
assert [message["role"] for message in sent_messages] == ["system", "user", "user"]
assert sent_messages[1]["content"] == SUMMARY_CONTINUATION_TEXT
assert [message["role"] for message in sent_messages] == ["system", "user"]
assert sent_messages[1]["content"] == "new question"
assert any(message.get("content") == "long older turn" for message in session.messages)