Open
Conversation
rlundeen2
approved these changes
Mar 16, 2026
Contributor
rlundeen2
left a comment
There was a problem hiding this comment.
This looks good, but we're deprecating all of this very soon, it probably should already be deprecated. The new frontend is in /frontend.
I don't see a downside to merging this sooner vs later though
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the deprecated pyrit.ui startup path so that non-Windows platforms (Linux/macOS) no longer error out during the “is UI already running?” probe or the __main__ startup guard, while preserving the existing Windows single-instance mutex behavior.
Changes:
- Introduces a reusable module-scope
create_mutex()helper and uses it in__main__. - Makes
create_mutex()a no-op returningTrueon non-Windows platforms. - Makes
is_app_running()returnFalseon non-Windows platforms instead of raising, and adds unit tests for these behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pyrit/ui/app.py |
Moves mutex creation to module scope and makes both mutex creation and “already running” checks non-fatal on non-Windows. |
tests/unit/ui/test_app.py |
Adds unit tests asserting non-Windows behavior for is_app_running() and create_mutex(). |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Summary
This fixes the deprecated Gradio UI startup path on non-Windows platforms.
Problem
pyrit.ui.appcurrently treats the Windows mutex logic as mandatory in two places:is_app_running()raisesNotImplementedErroron non-Windows platforms__main__startup path defines a nestedcreate_mutex()helper that also raisesNotImplementedErroron non-Windows platformsThat creates two failure modes on Linux/macOS:
AppRPCServer.start()callsis_app_running()before launching the UI, so the RPC path fails during the probe step.__main__block before it can start the Gradio app.Fix
create_mutex()to module scope so the startup guard is reusable and testablecreate_mutex()a no-op that returnsTrueon non-Windows platformsis_app_running()returnFalseon non-Windows platforms instead of raisingThis preserves the existing Windows mutex-based single-instance behavior while allowing non-Windows platforms to proceed through the UI startup path.
Tests
Added unit coverage for the non-Windows behavior:
is_app_running()returnsFalsecreate_mutex()returnsTrueValidation command:
Validation result:
The warning is the existing deprecation warning for
pyrit.ui.