test: distinguish public history in compaction commands
This commit is contained in:
1 parent
1d69f630d7
commit
c1fc6171b6
1 file changed
+5
-3
@@ -15,6 +15,7 @@ from nanobot.bus.runtime_events import TurnCompleted
|
||||
from nanobot.command.builtin import cmd_stop
|
||||
from nanobot.command.router import CommandContext
|
||||
from nanobot.providers.base import GenerationSettings, LLMResponse, ProviderConversationState
|
||||
from nanobot.runtime_context import public_history_message
|
||||
from nanobot.session.history_visibility import is_hidden_history_message
|
||||
|
||||
|
||||
@@ -139,11 +140,12 @@ async def test_compacted_session_waits_for_new_input_without_continuation(
|
||||
"content": loop.context.build_system_prompt(channel="cli", session_summary=expected_summary),
|
||||
}
|
||||
assert [message["role"] for message in sent] == ["system", "user"]
|
||||
assert sent[1]["content"] == "hi"
|
||||
assert sent[1]["content"].startswith("hi\n\n")
|
||||
assert "File access: not restricted to this project." in sent[1]["content"]
|
||||
|
||||
loop.sessions.invalidate(key)
|
||||
resumed = loop.sessions.get_or_create(key)
|
||||
assert resumed.get_history() == [
|
||||
assert resumed.get_history(include_runtime_context=False) == [
|
||||
{"role": "user", "content": "hi"},
|
||||
{"role": "assistant", "content": "Hello!"},
|
||||
]
|
||||
@@ -278,7 +280,7 @@ async def test_compact_is_a_fifo_barrier_during_an_active_turn(loop) -> None:
|
||||
task.cancel()
|
||||
await asyncio.gather(task, return_exceptions=True)
|
||||
|
||||
assert [message["content"] for message in compacted_history if message["role"] == "user"] == [
|
||||
assert [public_history_message(message)["content"] for message in compacted_history if message["role"] == "user"] == [
|
||||
"initial question", "before compaction",
|
||||
]
|
||||
assert all("/compact" != message.get("content") for request in requests for message in request)
|
||||
|
||||
Reference in new issue
Block a user