@@ -208,6 +208,41 @@ async def test_send_message_non_streaming_agent_capability_false(
208208 response = events [0 ]
209209 assert response .task .id == 'task-789'
210210
211+ @pytest .mark .asyncio
212+ async def test_send_message_does_not_mutate_request (
213+ self ,
214+ base_client : BaseClient ,
215+ mock_transport : MagicMock ,
216+ sample_message : Message ,
217+ ):
218+ base_client ._config .streaming = False
219+ base_client ._config .polling = True
220+ base_client ._config .accepted_output_modes = ['application/json' ]
221+ base_client ._config .push_notification_configs = [
222+ TaskPushNotificationConfig (
223+ task_id = 'task-1' ,
224+ )
225+ ]
226+
227+ task = Task (
228+ id = 'task-no-mutate' ,
229+ context_id = 'ctx-no-mutate' ,
230+ status = TaskStatus (state = TaskState .TASK_STATE_COMPLETED ),
231+ )
232+ response = SendMessageResponse ()
233+ response .task .CopyFrom (task )
234+ mock_transport .send_message .return_value = response
235+
236+ request = SendMessageRequest (message = sample_message )
237+
238+ original = SendMessageRequest ()
239+ original .CopyFrom (request )
240+
241+ events = [event async for event in base_client .send_message (request )]
242+ assert len (events ) == 1
243+
244+ assert request == original
245+
211246 @pytest .mark .asyncio
212247 async def test_send_message_callsite_config_overrides_non_streaming (
213248 self ,
0 commit comments