Skip to content

FEAT: List the saved registry entries that couldn't be restored (part 5) - #3965

Open
varunj-msft wants to merge 172 commits into
microsoft:mainfrom
varunj-msft:varunj-msft/13178-Retry-Restore
Open

varunj-msft wants to merge 172 commits into
microsoft:mainfrom
varunj-msft:varunj-msft/13178-Retry-Restore

Conversation

@varunj-msft

@varunj-msft varunj-msft commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part 5 of saving Registry entries across restarts. A side branch stacked on part 4 (#3909); part 20 (#4071) builds on it. This PR's own changes: varunj-msft/PyRIT@varunj-msft/13178-Restore-Saved-Entries...varunj-msft/13178-Retry-Restore

Design: 4.6 When a saved entry can't be restored. Where every part fits: PR map.

When a saved entry can't be restored, the backend stays not ready (#3909), but only administrators can see why, through GET /api/config/runtime, and everyone else only sees that PyRIT isn't ready. This shows administrators the failures on the Configuration page and tells everyone what has to happen. Until the earlier PRs merge, the diff here also shows their changes.

  • The Configuration page lists the saved entries that couldn't be restored, from GET /api/config/runtime, which only administrators can read: each entry's kind and name, the full message, and the entry it needed when the message doesn't already name it. A folder that couldn't be read is listed as the saved folder. A long list scrolls on its own, from the keyboard too, and long names wrap inside the column on a narrow screen.
  • GET /api/runtime also returns how many saved entries couldn't be restored (restore_failures). /api/health doesn't change.
  • While restore failed, everyone sees a bar at the top of the layout: some saved entries couldn't be restored, so new runs and sends are unavailable, and an administrator has to view the failures in Configuration, fix or delete the files in registry_recipes_source, then reinitialize PyRIT or restart the backend. Other not-ready states keep the generic bar. The bar renders inside the layout, in the app's theme, and wraps its text, like the Configuration status bar.
  • Live apply clears the restore report once it starts replacing the runtime, so a failure after that point doesn't show the previous runtime's list beside restart-required. An apply that stops before replacing anything keeps it.
  • Before the target create builds a HuggingFaceChatTarget, it imports torch, and checks for CUDA when asked, in a worker thread, so the constructor doesn't hold the event loop. use_cuda is read through its registered parameter first, so a textual "false" doesn't check for CUDA. Restore builds through the same create.
  • The 503 storage handler logs the error behind a storage failure again at debug level, and the scenario suite service includes it in its warning, both through redact_urls, so the cause stays in the log without the SAS query.
  • pyrit_conf.md says that live apply needs one backend worker and one replica, and to restart otherwise.

What stays the same: GET /api/config/runtime (admin only) lists the failures with full messages, plus the ignored files, as in #3909. There's no separate list for everyone.

Screenshots: Configuration at 390px wide before and after (the bar's wording, and the status and list inside the column), and the bar at 1024px.
restore_1_list_390_before
restore_2_list_390_after
restore_3_banner_1024

Next: #4071 (part 20) adds Delete to each entry in this list.

…API input

External construction now rejects a parameter whose type includes Path unless the
calling service passes the name in allowed_path_params after making the value safe.
The converter service allows its upload parameters once they are stored, and the
target service allows the server-set upload folder and the GitHubCopilotTarget
working directory. The scorer-only check is removed, and the "Valid parameters"
list leaves out path parameters callers cannot set.
The target catalog now applies the path rule to required parameters too, so a
target that needs a disallowed path is left out instead of listed without the
field, matching the scorer catalog. allowed_path_params is typed frozenset[str]
so a bare string cannot turn the allow-list into a substring match.
The target catalog still lists a target whose required path parameter is its
server-set upload folder when the server has one, and leaves it out otherwise.
# Conflicts:
#	tests/unit/backend/test_converter_service.py
The runtime status keeps its short summary. The restore log now also lists each field's full location
and message, escaped, without the stored values, and with URL credentials removed. Credentials are
removed before a location is shortened, so the summary can't keep part of one either.
Its text can carry a SAS URL. The 503 handler no longer logs it as a debug traceback, and the scenario
suite service no longer attaches it to its warning; both log the storage message, which has no credentials.
Its constructor imports torch and checks for CUDA, which can hold the loop for seconds the first time.
The target create now does both in a worker thread first, so the constructor, its errors, and the
model-loading task it starts stay on the loop and are quick.
The 503 handler logs it at debug level and the scenario suite service in its warning, as before, but
through redact_urls now, so a connection failure can be told apart from other outages without the SAS
query reaching the log.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the current head, including rendered UI states. Three new P2 findings are below. Three existing P2 concerns also remain open, so this review does not approve the PR.

Comment thread frontend/src/hooks/useRuntime.tsx Resolved
Comment thread frontend/src/hooks/useRuntime.tsx Resolved
Configuration lists the failures but can't fix them here, so the banner says to view them there and fix
or delete the files in registry_recipes_source. It uses the multiline layout, since its longer text
replaces the status after the bar first lays out.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants