-
Notifications
You must be signed in to change notification settings - Fork 1
fix: handle empty dict resume #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
radu-mocanu
commented
Dec 5, 2025
- handle empty dict resume
There was a problem hiding this 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 bothinput is not Noneandbool(input)to properly handle empty dict scenarios - Added comprehensive test coverage with three new test cases validating the fix for both
execute()andstream()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.
| 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 |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
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.
f18a72c to
d05052d
Compare