fix: dev terminal run history race condition#639
Merged
cristipufu merged 1 commit intomainfrom Oct 3, 2025
Merged
Conversation
There was a problem hiding this comment.
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.
9099837 to
c594bc2
Compare
c594bc2 to
f1afaf0
Compare
radu-mocanu
approved these changes
Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix race condition between
_refresh_running_items()andrefresh_list()when runs complete during parallel execution in run history refresh causingNoMatchesexception.Race condition scenario:
_refresh_running_items()starts iterating overrun_list.childrenupdate_run()→refresh_list()refresh_list()callsrun_list.clear(), removing all items_refresh_running_items()tries to query Static on a now-removed/rebuilt ListItem