diff --git a/astrbot/core/astr_main_agent.py b/astrbot/core/astr_main_agent.py index e168bbf400..2e7e628b19 100644 --- a/astrbot/core/astr_main_agent.py +++ b/astrbot/core/astr_main_agent.py @@ -1010,7 +1010,9 @@ def _append_system_reminders( system_content = ( "" + "\n".join(system_parts) + "" ) - req.extra_user_content_parts.append(TextPart(text=system_content)) + req.extra_user_content_parts.append( + TextPart(text=system_content).mark_as_temp() + ) async def _decorate_llm_request( diff --git a/tests/unit/test_astr_main_agent.py b/tests/unit/test_astr_main_agent.py index 3892a17c4b..e3e88beaba 100644 --- a/tests/unit/test_astr_main_agent.py +++ b/tests/unit/test_astr_main_agent.py @@ -142,8 +142,9 @@ def _setup_conversation_for_build(conv_mgr, cid: str = "conv-id") -> MagicMock: return conversation -def test_append_system_reminders_includes_weekday(mock_event): - """Test datetime reminder includes weekday information.""" +@pytest.mark.asyncio +async def test_append_system_reminders_includes_weekday(mock_event): + """Test datetime reminder includes weekday and is not persisted.""" req = ProviderRequest(prompt="Hello") fixed_now = datetime.datetime( 2026, @@ -173,6 +174,14 @@ def now(cls, tz=None): "Current datetime: " "2026-06-08 12:34 (UTC), Weekday: Monday" ] + assert req.extra_user_content_parts[0]._no_save is True + + message = Message.model_validate(await req.assemble_context()) + assert isinstance(message.content, list) + assert message.content[1].text == req.extra_user_content_parts[0].text + assert dump_messages_with_checkpoints([message]) == [ + {"role": "user", "content": [{"type": "text", "text": "Hello"}]} + ] def test_local_mode_prompt_uses_windows_powershell_51():