Skip to content

fix: assign fired_triggers var, avoid checking api triggers#84

Merged
radu-mocanu merged 1 commit intomainfrom
feat/resume-runtime-on-fired-triggers
Feb 16, 2026
Merged

fix: assign fired_triggers var, avoid checking api triggers#84
radu-mocanu merged 1 commit intomainfrom
feat/resume-runtime-on-fired-triggers

Conversation

@radu-mocanu
Copy link
Collaborator

@radu-mocanu radu-mocanu commented Feb 16, 2026

  • assign fired_triggers var on resumable runtime stream execution
  • filter out api fired triggers check (api triggers are created upon job suspension)

Copilot AI review requested due to automatic review settings February 16, 2026 06:51
@radu-mocanu radu-mocanu requested a review from a team as a code owner February 16, 2026 06:51
@radu-mocanu radu-mocanu force-pushed the feat/resume-runtime-on-fired-triggers branch 2 times, most recently from 95cefc8 to 4bc5995 Compare February 16, 2026 06:53
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 stream method of UiPathResumableRuntime where accessing fired_triggers would cause an UnboundLocalError when the runtime returns a non-suspended result. The fix initializes fired_triggers to None and moves the resume preparation code outside the conditional block to execute at the end of every while loop iteration, making it consistent with the pattern used in the execute method.

Changes:

  • Initialize fired_triggers = None at the start of the while loop to prevent UnboundLocalError
  • Move resume preparation code (lines 137-144) outside the conditional block to execute at the end of each iteration
  • Bump version from 0.8.3 to 0.8.4 (patch version for bug fix)

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/uipath/runtime/resumable/runtime.py Fixed UnboundLocalError by initializing fired_triggers and repositioning resume preparation code to execute after each iteration
pyproject.toml Version bump to 0.8.4 for bug fix release
uv.lock Updated lock file to reflect new version
Comments suppressed due to low confidence (1)

src/uipath/runtime/resumable/runtime.py:144

  • If the delegate's stream method doesn't yield a UiPathRuntimeResult (violating the protocol contract), final_result remains None and the while loop continues indefinitely with input=None and resume=True. Consider adding an else clause to handle this defensive case by setting execution_completed=True or raising an error to prevent an infinite loop.
            if final_result:
                suspension_result = await self._handle_suspension(final_result)

                if suspension_result.status != UiPathRuntimeStatus.SUSPENDED or not (
                    fired_triggers := await self._restore_resume_input(None)
                ):
                    yield suspension_result
                    execution_completed = True

                # Note: when resuming a job, orchestrator deletes all triggers associated with it,
                # thus we can resume the runtime at this point without worrying a trigger may be fired 'twice'
                input = fired_triggers

                if not options:
                    options = UiPathStreamOptions(resume=True)
                else:
                    options.resume = True

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

@radu-mocanu radu-mocanu force-pushed the feat/resume-runtime-on-fired-triggers branch 2 times, most recently from 2854158 to fecf8bd Compare February 16, 2026 08:47
@radu-mocanu radu-mocanu force-pushed the feat/resume-runtime-on-fired-triggers branch 4 times, most recently from 5f2a4c3 to 526118e Compare February 16, 2026 08:59
@radu-mocanu radu-mocanu force-pushed the feat/resume-runtime-on-fired-triggers branch from 526118e to 65477a9 Compare February 16, 2026 09:00
@radu-mocanu radu-mocanu changed the title fix: assign fired_triggers var fix: assign fired_triggers var, avoid checking api triggers Feb 16, 2026
@radu-mocanu radu-mocanu merged commit f6eb7e7 into main Feb 16, 2026
74 checks passed
@cristipufu cristipufu deleted the feat/resume-runtime-on-fired-triggers branch February 19, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments