Skip to content

Conversation

@radu-mocanu
Copy link
Contributor

  • handle empty dict resume

@radu-mocanu radu-mocanu self-assigned this Dec 5, 2025
Copilot AI review requested due to automatic review settings December 5, 2025 11:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the resumable runtime where passing an empty dictionary ({}) for the input parameter during resume was incorrectly treated as valid input instead of triggering data restoration from storage. The fix adds a truthiness check (bool(input)) to distinguish between explicitly provided input and empty dictionaries that should be ignored.

Key Changes:

  • Updated _restore_resume_input() logic to check both input is not None and bool(input) to properly handle empty dict scenarios
  • Added comprehensive test coverage with three new test cases validating the fix for both execute() and stream() methods
  • Version bumped from 0.2.0 to 0.2.1

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/uipath/runtime/resumable/runtime.py Fixed the condition in _restore_resume_input() to treat empty dicts as missing input, triggering fetch from storage
tests/test_resumable_runtime.py Added three test cases with mock implementations to verify empty dict fetches from storage and non-empty dict uses provided input
pyproject.toml Version bump from 0.2.0 to 0.2.1
uv.lock Version bump from 0.2.0 to 0.2.1 in lock file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +113 to +128
async def test_stream_restore_resume_input_with_empty_dict_fetches_from_storage():
"""Test that empty dict input triggers fetching from storage on resume in stream mode."""
delegate = MockDelegateRuntime()
stored_trigger = MagicMock()
storage = MockStorage(trigger=stored_trigger)
resume_data = {"key": "value_from_storage"}
trigger_manager = MockTriggerManager(resume_data=resume_data)

runtime = UiPathResumableRuntime(delegate, storage, trigger_manager)

options = UiPathStreamOptions(resume=True)
async for event in runtime.stream(input={}, options=options):
if isinstance(event, UiPathRuntimeResult):
assert event.status == UiPathRuntimeStatus.SUCCESSFUL

assert delegate.last_input == resume_data
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test case for stream() with non-empty dict input when resuming. While test coverage exists for execute() with non-empty dict (line 94-109), there's no corresponding test for stream() to ensure it behaves consistently. Consider adding a test like test_stream_restore_resume_input_with_non_empty_dict_uses_provided_input() to verify that stream mode also uses the provided input directly instead of fetching from storage when a non-empty dict is provided.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant