@@ -874,6 +874,44 @@ async def test_on_message_send_limit_history():
874874 assert task is not None
875875 assert task .history is not None and len (task .history ) > 0
876876
877+ @pytest .mark .asyncio
878+ async def test_on_message_send_limit_history_non_as_no_limit ():
879+ task_store = InMemoryTaskStore ()
880+ push_store = InMemoryPushNotificationConfigStore ()
881+
882+ request_handler = DefaultRequestHandler (
883+ agent_executor = HelloAgentExecutor (),
884+ task_store = task_store ,
885+ push_config_store = push_store ,
886+ )
887+ params = MessageSendParams (
888+ message = Message (
889+ role = Role .user ,
890+ message_id = 'msg_push' ,
891+ parts = [Part (root = TextPart (text = 'Hi' ))],
892+ ),
893+ configuration = MessageSendConfiguration (
894+ blocking = True ,
895+ accepted_output_modes = ['text/plain' ],
896+ history_length = None
897+ ),
898+ )
899+
900+ result = await request_handler .on_message_send (
901+ params , create_server_call_context ()
902+ )
903+
904+ # verify that history_length is honored
905+ assert result is not None
906+ assert isinstance (result , Task )
907+ assert result .history is not None and len (result .history ) > 0
908+ assert result .status .state == TaskState .completed
909+
910+ # verify that history is still persisted to the store
911+ task = await task_store .get (result .id )
912+ assert task is not None
913+ assert task .history is not None and len (task .history ) > 0
914+
877915
878916@pytest .mark .asyncio
879917async def test_on_task_get_limit_history ():
0 commit comments