Skip to content

Commit 05c596c

Browse files
committed
fix: rename to wait for tool confirmation
1 parent 87f95b2 commit 05c596c

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/uipath/runtime/chat/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ async def emit_exchange_error_event(self, error: Exception) -> None:
3939
"""Emit an exchange error event."""
4040
...
4141

42-
async def wait_for_resume(self) -> dict[str, Any]:
42+
async def wait_for_tool_confirmation(self) -> dict[str, Any]:
4343
"""Wait for a confirmToolCall event to be received."""
4444
...

src/uipath/runtime/chat/runtime.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ async def stream(
102102
resume_map: dict[str, Any] = {}
103103

104104
for trigger in api_triggers:
105-
resume_data = (
106-
await self.chat_bridge.wait_for_resume()
107-
)
105+
resume_data = await self.chat_bridge.wait_for_tool_confirmation()
108106

109107
assert trigger.interrupt_id is not None, (
110108
"Trigger interrupt_id cannot be None"

tests/test_chat.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def make_chat_bridge_mock() -> UiPathChatProtocol:
3333
bridge_mock.connect = AsyncMock()
3434
bridge_mock.disconnect = AsyncMock()
3535
bridge_mock.emit_message_event = AsyncMock()
36-
bridge_mock.wait_for_resume = AsyncMock()
36+
bridge_mock.wait_for_tool_confirmation = AsyncMock()
3737

3838
return cast(UiPathChatProtocol, bridge_mock)
3939

@@ -308,7 +308,7 @@ async def test_chat_runtime_handles_api_trigger_suspension():
308308
runtime_impl = SuspendingMockRuntime(suspend_at_message=0)
309309
bridge = make_chat_bridge_mock()
310310

311-
cast(AsyncMock, bridge.wait_for_resume).return_value = {"approved": True}
311+
cast(AsyncMock, bridge.wait_for_tool_confirmation).return_value = {"approved": True}
312312

313313
chat_runtime = UiPathChatRuntime(
314314
delegate=runtime_impl,
@@ -330,7 +330,7 @@ async def test_chat_runtime_handles_api_trigger_suspension():
330330
cast(AsyncMock, bridge.connect).assert_awaited_once()
331331
cast(AsyncMock, bridge.disconnect).assert_awaited_once()
332332

333-
cast(AsyncMock, bridge.wait_for_resume).assert_awaited_once()
333+
cast(AsyncMock, bridge.wait_for_tool_confirmation).assert_awaited_once()
334334

335335
# Message events emitted (one before suspend, one after resume)
336336
assert cast(AsyncMock, bridge.emit_message_event).await_count == 2
@@ -343,8 +343,8 @@ async def test_chat_runtime_yields_events_during_suspension_flow():
343343
runtime_impl = SuspendingMockRuntime(suspend_at_message=0)
344344
bridge = make_chat_bridge_mock()
345345

346-
# wait_for_resume returns approval data
347-
cast(AsyncMock, bridge.wait_for_resume).return_value = {"approved": True}
346+
# wait_for_tool_confirmation returns approval data
347+
cast(AsyncMock, bridge.wait_for_tool_confirmation).return_value = {"approved": True}
348348

349349
chat_runtime = UiPathChatRuntime(
350350
delegate=runtime_impl,
@@ -531,7 +531,7 @@ async def test_chat_runtime_handles_multiple_api_triggers():
531531
bridge = make_chat_bridge_mock()
532532

533533
# Bridge returns approval for each trigger
534-
cast(AsyncMock, bridge.wait_for_resume).side_effect = [
534+
cast(AsyncMock, bridge.wait_for_tool_confirmation).side_effect = [
535535
{"approved": True}, # email-confirm
536536
{"approved": True}, # file-delete
537537
{"approved": True}, # api-call
@@ -561,7 +561,7 @@ async def test_chat_runtime_handles_multiple_api_triggers():
561561
assert resume_input["api-call"] == {"approved": True}
562562

563563
# Bridge should have been called 3 times (once per trigger)
564-
assert cast(AsyncMock, bridge.wait_for_resume).await_count == 3
564+
assert cast(AsyncMock, bridge.wait_for_tool_confirmation).await_count == 3
565565

566566

567567
@pytest.mark.asyncio
@@ -572,7 +572,7 @@ async def test_chat_runtime_filters_non_api_triggers():
572572
bridge = make_chat_bridge_mock()
573573

574574
# Bridge returns approval for API triggers only
575-
cast(AsyncMock, bridge.wait_for_resume).side_effect = [
575+
cast(AsyncMock, bridge.wait_for_tool_confirmation).side_effect = [
576576
{"approved": True}, # email-confirm
577577
{"approved": True}, # file-delete
578578
]
@@ -594,4 +594,4 @@ async def test_chat_runtime_filters_non_api_triggers():
594594
assert result.triggers[0].trigger_type == UiPathResumeTriggerType.QUEUE_ITEM
595595

596596
# Bridge should have been called only 2 times (for 2 API triggers)
597-
assert cast(AsyncMock, bridge.wait_for_resume).await_count == 2
597+
assert cast(AsyncMock, bridge.wait_for_tool_confirmation).await_count == 2

0 commit comments

Comments
 (0)