Skip to content

FIX: Restore scanner UI while preserving OPENAI environment var requirement - #4187

Merged
Richard Lundeen (richlundeen) merged 4 commits into
microsoft:mainfrom
richlundeen:richlundeen-restore-scan-ui
Nov 11, 2026
Merged

Richard Lundeen (richlundeen) merged 4 commits into
microsoft:mainfrom
richlundeen:richlundeen-restore-scan-ui

Conversation

@richlundeen

@richlundeen Richard Lundeen (richlundeen) commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Restore the scanner interface and interactions from before #3794 without bringing back the missing-OPENAI_CHAT_MODEL blocker. The unintended UI regression came from Richard Lundeen (@richlundeen)'s changes in #3794 but preserves the fix.

  • Restore the existing scenario and suite launch forms, Registry target setup, component selectors, and run-preview copy.
  • Remove inline target/scorer creation, scoring-target controls, and frontend readiness gating. Keep backend lazy initialization, configured defaults, and launch validation unchanged.
  • Preserve a saved run's explicit scoring target when rerunning, without adding form controls, and align the setup guidance with the restored workflow.

With OPENAI_CHAT_MODEL unset, the original form now opens instead of the blocking warning. Choose registered components, configure the scan, and use the existing run preview; valid configurations launch, while missing helper roles produce the normal launch error.

Scanner screenshots

1. Original missing-environment blocker, before #3794. Original capture from #3794 at 80f28af2731d12523e084c9c7d114fedbf5e9b88, with OPENAI_CHAT_MODEL unset and no configured targets or scorers.

Original pre-3794 scanner blocked by missing OPENAI_CHAT_MODEL

2. Before this rollback: regressed UI after #3794. Production build of merge commit 3cc6f65e616472349a48efdfe321c40bd29afc86; OPENAI_CHAT_MODEL remains unset.

Before rollback: extra inline creation and scoring-target controls after 3794

3. After this rollback: restored UI. Production build of 4cab3976246bb45e720b5a1911078236ace8080b; OPENAI_CHAT_MODEL remains unset.

After rollback: original compact scanner form restored without the environment blocker

The before/after captures use the same technique.execute route, red_teaming selection, objective, explicit offline targets, light theme, and 1440 × 1000 viewport. Both are anchored to show the Objective heading and target/scorer controls below the sticky navigation. The local targets reject sends; no scan or provider request was submitted for these screenshots. No product source was patched for the captures.

For a healthy-original comparison, the pre-#3794 parent 7d6a3da3b479c31b781be5501e787620f6527993 was also built and rendered using that identical offline setup, which supplies the old constructor's required helper targets without model credentials. Its matched viewport and Objective section are pixel-identical to the restored UI: 0 differing pixels. The two review repairs retain metadata-based optional endpoints and close stale suite dialogs after runtime reinitialization without adding controls or readiness UI.

Restore the pre-microsoft#3794 scenario and suite launch controls, Registry setup flow, and previews without reverting credential-free browsing or explicit backend role validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Check form errors separately from the global live region and match the incumbent suite MessageBar. Capture the restored Objective section on desktop and narrow viewports.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Run scanner launch cases with a fresh backend and dedicated CI shard so sibling seeded specs cannot satisfy deliberately missing roles. Capture the normal launch-error banner in the evidence.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 04:59

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Automated review completed. No blocking concerns remain. This review records source coverage; it does not authorize merge.

Copilot AI left a comment

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.

🟡 Changes recommended

Optional endpoints are incorrectly required, blocking valid target creation, and stale suite selections can launch replacement targets after runtime reinitialization.

2 open issues
What changed in this PR

Restores the earlier CoPyRIT scanner workflow while preserving credential-free browsing and backend launch validation from #3794.

Changes:

  • Restores scenario and suite forms, Registry-based target setup, and preview copy; removes inline component creation and frontend role-readiness checks.
  • Preserves saved scoring-target selections when rerunning scans.
  • Updates setup guidance and regression coverage, including an isolated browser-test configuration.
File Description
tests/​unit/​scenario/​core/​test_scenario_readiness.py Adds credential-free catalog and estimate coverage.
tests/​end_to_end/​browser_initializer.py Registers an offline default scorer.
frontend/​src/​utils/​targetIdentity.ts Removes readiness-based role labels.
frontend/​src/​types/​index.ts Removes frontend readiness types.
frontend/​src/​services/​api.ts Removes readiness and scorer-creation client methods.
frontend/​src/​components/​Scorers/​CreateScorerDialog.tsx Deletes inline scorer creation.
frontend/​src/​components/​Scorers/​CreateScorerDialog.test.tsx Removes deleted-dialog tests.
frontend/​src/​components/​ScenarioSuites/​LaunchSuiteDialog.tsx Restores suite controls and launch-time validation.
frontend/​src/​components/​ScenarioSuites/​LaunchSuiteDialog.test.tsx Updates restored suite-control coverage.
frontend/​src/​components/​ScenarioSuites/​LaunchSuiteDialog.styles.ts Removes child flex-shrink overrides.
frontend/​src/​components/​Scenarios/​ScenarioRunPreviewDialog.tsx Removes scoring-target display.
frontend/​src/​components/​Scenarios/​scenarioLaunchRequest.ts Gates adversarial selections on scenario metadata.
frontend/​src/​components/​Scenarios/​scenarioLaunchRequest.test.ts Aligns request tests with restored behavior.
frontend/​src/​components/​Scenarios/​scenarioLaunchForm.ts Restores adversarial-default prefilling.
frontend/​src/​components/​Scenarios/​ScenarioFlow.test.tsx Removes readiness mocking.
frontend/​src/​components/​Scenarios/​ScenarioDetail.tsx Restores launch controls and preserves saved scoring targets.
frontend/​src/​components/​Scenarios/​ScenarioDetail.test.tsx Covers restored controls, Registry navigation, and reruns.
frontend/​src/​components/​helpDefinitions.ts Simplifies adversarial-target help text.
frontend/​src/​components/​Config/​CreateTargetDialog.tsx Simplifies creation callbacks and changes endpoint requirements.
frontend/​src/​components/​Config/​CreateTargetDialog.test.tsx Updates target-creation expectations.
frontend/​src/​components/​Chat/​ChatScorerPicker.tsx Restores fixed scenario-default copy.
frontend/​src/​App.labels.test.tsx Removes readiness mocking.
frontend/​playwright.scan-launch.config.ts Adds isolated scan-launch browser configuration.
frontend/​playwright.config.ts Excludes scan-launch tests from the shared configuration.
frontend/​package.json Adds the scan-launch test command.
frontend/​e2e/​scenario-history.spec.ts Removes readiness routing mocks.
frontend/​e2e/​scenario-datasets.spec.ts Checks missing-target validation on submission.
frontend/​e2e/​scan-launch.seeded.spec.ts Adds restored-workflow browser coverage.
frontend/​e2e/​numeric-controls.spec.ts Removes readiness mock responses.
frontend/​e2e/​explicit-targets.seeded.spec.ts Removes inline-creation browser coverage.
doc/​code/​setup/​0_setup.md Documents Registry setup and configured scorer defaults.
.github/​workflows/​frontend_tests.yml Adds the isolated scan-launch CI job.

Review effort: Balanced

Honor optional endpoint metadata while keeping the unavailable-metadata fallback. Close suite launch dialogs when runtime generation changes and block submissions while the runtime is unavailable, without restoring role-readiness UI.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@richlundeen Richard Lundeen (richlundeen) changed the title FIX: Restore scanner UI while preserving credential-free browsing FIX: Restore scanner UI while preserving OPENAI environment var requirement Nov 11, 2026
@richlundeen
Richard Lundeen (richlundeen) added this pull request to the merge queue Nov 11, 2026
Merged via the queue into microsoft:main with commit c3cff18 Nov 11, 2026
62 checks passed
@richlundeen
Richard Lundeen (richlundeen) deleted the richlundeen-restore-scan-ui branch November 11, 2026 07:43
Richard Lundeen (richlundeen) added a commit to richlundeen/PyRIT that referenced this pull request Nov 11, 2026
Brings in microsoft#4187. No conflicts or integration changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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