Skip to content

Commit 5865a4b

Browse files
committed
chore: debug runtime, check for any resumable runtime in the delegates chain
1 parent 3898152 commit 5865a4b

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.8.0"
3+
version = "0.8.1"
44
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/runtime/debug/runtime.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ async def _stream_and_debug(
179179

180180
# Check if this is a suspended execution that needs polling
181181
if (
182-
isinstance(self.delegate, UiPathResumableRuntime)
182+
(resumable_runtime := self.get_resumable_runtime())
183183
and self.trigger_poll_interval > 0
184184
and final_result.status == UiPathRuntimeStatus.SUSPENDED
185185
and final_result.trigger
@@ -204,7 +204,7 @@ async def _stream_and_debug(
204204
else:
205205
trigger_data = await self._poll_trigger(
206206
final_result.trigger,
207-
self.delegate.trigger_manager,
207+
resumable_runtime.trigger_manager,
208208
)
209209
resume_data = {interrupt_id: trigger_data}
210210
except UiPathDebugQuitError:
@@ -233,6 +233,18 @@ async def _stream_and_debug(
233233
elif isinstance(event, UiPathRuntimeStateEvent):
234234
await self.debug_bridge.emit_state_update(event)
235235

236+
def get_resumable_runtime(
237+
self, max_depth: int = 10
238+
) -> UiPathResumableRuntime | None:
239+
"""Get the delegate resumable runtime, if exists."""
240+
current_runtime: UiPathRuntimeProtocol = self
241+
while hasattr(current_runtime, "delegate") and max_depth:
242+
max_depth -= 1
243+
current_runtime = current_runtime.delegate
244+
if isinstance(current_runtime, UiPathResumableRuntime):
245+
return current_runtime
246+
return None
247+
236248
async def get_schema(self) -> UiPathRuntimeSchema:
237249
"""Passthrough schema for the delegate."""
238250
return await self.delegate.get_schema()

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)