@@ -444,6 +444,56 @@ async def test_verify_task_is_complete_without_pr_changes_returns_is_completed_f
444444 assert "No changes were needed" in last_message
445445
446446
447+ @pytest .mark .asyncio
448+ @patch ("services.chat_with_agent.chat_with_model" )
449+ @patch ("services.agents.verify_task_is_complete.get_pull_request_files" )
450+ @patch ("services.chat_with_agent.update_comment" )
451+ async def test_verify_task_is_complete_with_none_args_still_executes (
452+ _mock_update_comment , mock_get_pr_files , mock_chat_with_model , create_test_base_args
453+ ):
454+ """PR 786: Gemma 4 31B called verify_task_is_complete with args=None instead of {}.
455+ isinstance(None, dict) is False, so the tool was silently skipped and returned None.
456+ Gemma then entered a dead loop returning empty responses for 20 iterations."""
457+ mock_get_pr_files .return_value = [{"filename" : "test.py" , "status" : "modified" }]
458+ mock_chat_with_model .return_value = (
459+ {
460+ "role" : "assistant" ,
461+ "content" : [
462+ {
463+ "type" : "tool_use" ,
464+ "id" : "test_id" ,
465+ "name" : "verify_task_is_complete" ,
466+ "input" : {},
467+ }
468+ ],
469+ },
470+ [ToolCall (id = "test_id" , name = "verify_task_is_complete" , args = None )],
471+ 15 ,
472+ 10 ,
473+ )
474+
475+ base_args = create_test_base_args (
476+ model_id = GoogleModelId .GEMMA_4_31B ,
477+ owner = "test-owner" ,
478+ repo = "test-repo" ,
479+ pr_number = 123 ,
480+ token = "test-token" ,
481+ )
482+
483+ result = await chat_with_agent (
484+ messages = [{"role" : "user" , "content" : "test" }],
485+ system_message = "test system message" ,
486+ base_args = base_args ,
487+ tools = [],
488+ usage_id = 123 ,
489+ model_id = GoogleModelId .GEMMA_4_31B ,
490+ )
491+
492+ # verify_task_is_complete was called (not skipped), so is_completed should be True
493+ assert result .is_completed is True
494+ mock_get_pr_files .assert_called_once ()
495+
496+
447497@pytest .mark .asyncio
448498@patch ("services.chat_with_agent.chat_with_model" )
449499async def test_regular_tool_returns_is_completed_false (
0 commit comments