Skip to content

fix: dev terminal run history race condition#639

Merged
cristipufu merged 1 commit intomainfrom
fix/dev_list_race_condition
Oct 3, 2025
Merged

fix: dev terminal run history race condition#639
cristipufu merged 1 commit intomainfrom
fix/dev_list_race_condition

Conversation

@cristipufu
Copy link
Copy Markdown
Member

Description

Fix race condition between _refresh_running_items() and refresh_list() when runs complete during parallel execution in run history refresh causing NoMatches exception.

Race condition scenario:

  • _refresh_running_items() starts iterating over run_list.children
  • A run completes, triggering update_run()refresh_list()
  • refresh_list() calls run_list.clear(), removing all items
  • _refresh_running_items() tries to query Static on a now-removed/rebuilt ListItem
  • Exception is raised because the DOM structure changed mid-iteration

@cristipufu cristipufu requested a review from Copilot October 3, 2025 14:20
@cristipufu cristipufu self-assigned this Oct 3, 2025
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Oct 3, 2025
Copy link
Copy Markdown

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 race condition in the dev terminal run history component where concurrent operations between _refresh_running_items() and refresh_list() cause DOM structure exceptions. The fix implements defensive programming with snapshots and exception handling to prevent crashes when the UI list is cleared during iteration.

Key Changes

  • Added snapshot-based iteration to avoid mid-iteration DOM changes
  • Implemented exception handling for query operations and DOM access
  • Added validation checks to ensure items still exist before accessing them

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/uipath/_cli/_dev/_terminal/_components/_history.py
Comment thread src/uipath/_cli/_dev/_terminal/_components/_history.py
@cristipufu cristipufu force-pushed the fix/dev_list_race_condition branch from 9099837 to c594bc2 Compare October 3, 2025 14:22
@cristipufu cristipufu force-pushed the fix/dev_list_race_condition branch from c594bc2 to f1afaf0 Compare October 3, 2025 14:48
@cristipufu cristipufu requested a review from radu-mocanu October 3, 2025 14:54
@cristipufu cristipufu merged commit 2a0af87 into main Oct 3, 2025
58 checks passed
@cristipufu cristipufu deleted the fix/dev_list_race_condition branch October 3, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants