@@ -623,6 +623,31 @@ async def test_escalation_tool_raises_when_task_is_deleted(
623623 with pytest .raises (AgentRuntimeError ):
624624 await tool .awrapper (tool , call , {}) # type: ignore[attr-defined]
625625
626+ @pytest .mark .asyncio
627+ @patch ("uipath_langchain.agent.tools.escalation_tool.UiPath" )
628+ @patch ("uipath_langchain.agent.tools.durable_interrupt.decorator.interrupt" )
629+ async def test_escalation_tool_dict_result_without_is_deleted_defaults_to_false (
630+ self , mock_interrupt , mock_uipath_class , escalation_resource
631+ ):
632+ """Test that a dict result without is_deleted is accepted and defaults to False."""
633+ mock_client = MagicMock ()
634+ mock_client .tasks .create_async = AsyncMock (return_value = _make_mock_task ())
635+ mock_uipath_class .return_value = mock_client
636+
637+ # Return a plain dict without is_deleted — exercises the TypeAdapter path
638+ mock_interrupt .return_value = {
639+ "action" : "approve" ,
640+ "data" : {"approved" : True , "reason" : "looks good" },
641+ }
642+
643+ tool = create_escalation_tool (escalation_resource )
644+ call = ToolCall (args = {}, id = "test-call" , name = tool .name )
645+
646+ result = await tool .awrapper (tool , call , {}) # type: ignore[attr-defined]
647+
648+ assert result ["outcome" ] == "approve"
649+ assert result ["output" ] == {"approved" : True , "reason" : "looks good" }
650+
626651 @pytest .mark .asyncio
627652 @patch ("uipath_langchain.agent.tools.escalation_tool.UiPath" )
628653 @patch ("uipath_langchain.agent.tools.durable_interrupt.decorator.interrupt" )
0 commit comments