Skip to content

FEAT: Group ASSERT results by generated category - #4226

Open
Richard Lundeen (richlundeen) wants to merge 84 commits into
microsoft:mainfrom
richlundeen:richlundeen-assert-category-recovery
Open

Richard Lundeen (richlundeen) wants to merge 84 commits into
microsoft:mainfrom
richlundeen:richlundeen-assert-category-recovery

Conversation

@richlundeen

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

Copy link
Copy Markdown
Contributor

Part -9 of a 10-layer ASSERT series. Design and how to use it: ASSERT in PyRIT.

Layer PR Scope
-1 #4132 Judge dimensions, presets and shared techniques
-2 #4130 Trace evidence (OpenTelemetry)
-3 #4131 Headline metrics
-4 #4133 Staged generation (SDK)
-5 #4134 Generation jobs (backend)
-6 #4135 Generate from the GUI
-7 #4144 In-process agents (docs)
-8 #4180 Scenario-aware dataset compatibility
-9 This PR Category-first result groups
-10 #4228 Nonblocking background dataset loading

Layers -1 to -8 have merged into main, and this PR now merges main, so its Files changed tab shows only this layer's source. Background loading belongs to #4228, not this PR's net source.

Publication clarification: The preserved body below predates publication of #4228; its references to layer -10 as Planned are historical. Layer -10 is now published as #4228 and remains outside this PR's net source.

Description

Organize new ASSERT result groups by generated category, with baseline and selected techniques together, without changing execution identity or judged-category metrics. Preserve recorded grouping when resuming or displaying historical runs.

  • Head each group with its generated category; with several judged policies, prefix the policy's behavior name (and a short policy ID when behavior names match), as the ASSERT metrics panel does; label result rows Baseline or by technique name in the group table, the objective details and the attack details.
  • Present category groups without an ASSERT identity check: only AssertPolicy chooses category display groups, so the shared readers and GUI stay generic. Report baselines as the baseline technique, not as their category.
  • Preserve the grouping recorded in saved plans in hierarchy, flat progress and resume. Do not infer legacy categories from mutable datasets or parse historical strings.
  • Keep server-derived logical totals, producer counts, pagination, seed/result identities and resume behavior; describe the grouping in the ASSERT scenario guide.

Own GUI changes

New ASSERT runs show generated-category groups instead of technique groups. Each group contains baseline and selected-technique rows, and its subtitle lists those techniques. When several judged policies are present, headers read <behavior>: <category>; when behavior names also coincide, they add the short policy ID that the ASSERT metrics panel shows, without exposing system instructions or serialized arrays.

Judged-relevance category rates stay in the ASSERT metrics panel; the groups section adds no explanatory hint. Historical ASSERT runs retain the grouping recorded in their saved plan, including delimiter/quote/suffix-looking labels. A run without a saved plan groups by atomic name, as for every scenario; incomplete historical planned totals remain unavailable rather than being fabricated.

Shared/non-ASSERT impact

The shared hierarchy/progress readers and result table take no ASSERT identity input. Two generic presentation changes reach every scenario: a group's subtitle lists its distinct techniques from the saved plan instead of every atomic attack name, and is omitted when it only repeats the group name; rows and attack details label a baseline Baseline. Baselines also count as the baseline technique in techniques used and technique summaries, so a baseline grouped under another display group (for example a psychosocial harm or a per-dataset pool baseline) no longer appears as its own technique. For saved runs, ScenarioResult.get_techniques_used() (the SDK's Total Techniques) reads the plan's techniques the same way, so scenarios grouped by dataset, template, language, target or harm count techniques rather than display groups. Ordinary scenarios retain their existing grouping and logical-unit/retry accounting.

The ASSERT metrics panel keeps main's run check, and the metrics route keeps its typed non-ASSERT rejection; this PR does not change either.

Unchanged/deferred behavior

Judges, headline/rate formulas, confidence intervals, trace evidence, generation, native prompt/conversation execution, Spanish conversion and dataset compatibility are inherited lower-layer behavior. Category grouping does not turn unscored fixture outcomes into judgments. Dataset auto-loading is Planned layer -10, not included in this layer's net source; manual loading and other scenario behavior are unchanged.

Exact source: layer -9 53f7b3b52fe0f5ff394c48e556cbf31b2810e838 was built on published layer -8 fa20157a6a1fdd484bea1a5dc41d957bfc2cfad3; 67bf04399901d4a52e4d63f1b42eee16ce4e4e3e merges main ec6b64fed8d9e02b62930332ea2ac83a4cb75786, which contains the final layer -8 (#4180). That merge follows main's final layer -8: planless resume is an error, so only plan-based resume preserves recorded groups, and the readable row labels now render through main's AtomicAttackGroupsSection. Review repair commits e5247f862f5c738e96e3277c2d1121711320fa1a and 29a80860f2226cddb4e1d575efef05b6de56fc1d remove the ASSERT identity flag and the no-plan display-map path, label rows and attack details generically and qualify headers by the judged policy. No dependency/lockfile changes were included.

Source-specific synthetic before/after

All images are genuine browser captures of separately built exact sources: before = published layer -8 fa20157a6a1fdd484bea1a5dc41d957bfc2cfad3, after = review repair 29a80860f2226cddb4e1d575efef05b6de56fc1d; the ordinary-scenario before uses this PR's 67bf04399901d4a52e4d63f1b42eee16ce4e4e3e frontend, which matches main for non-ASSERT runs. Each uses an isolated fresh SQLite fixture, the real backend/lifespan/REST readers and bundled SPA, and headless Chromium at 1440x1050. Small ASSERT runs execute the real pipeline against scripted in-process responses (after: the unit-test harness's target, tester and judge, with assert_package and red_teaming); ordinary and paging records are explicitly synthetic. The before and after fixtures differ, so objective text and outcomes differ. No API/DOM substitution, real provider/model calls, user data/configuration or running demo was used.

Before: three technique groups, twelve executions.

Before at fa201: synthetic ASSERT results grouped by technique

After: two generated-category groups with baseline and both techniques, twelve executions. Each subtitle lists the group's techniques, and rows read Baseline or the technique name, as the objective and attack details do.

After at 29a8086: ASSERT results grouped by generated category, with technique subtitles and Baseline or technique row labels

After at 29a8086: the objective details dialog labels the same executions Baseline, assert_package and red_teaming

After at 29a8086: a Baseline row's attack details name the technique Baseline, not the generated category

Distinct policy-qualified headers, before and after. After, two selected policies share the behavior name customer_support, so each header adds the short policy ID that the metrics panel's category rates also show.

Before at fa201: separate policy cases still grouped by technique

After at 29a8086: two same-named policies qualified as customer_support (policy ID): public_policy

After at 29a8086: the metrics panel's category rates name the same policies with the same short IDs

Rates remain judged-relevance rates, not generated-group counts. Each fixture has six executions in each generated category, but the judged applicable denominators are three permissible and one impermissible conversation per technique before, and four permissible and no impermissible conversations after.

Before at fa201: real persisted synthetic judged-category rates

After at 29a8086: judged-category rates unchanged by generated-category grouping

Ordinary scenario group subtitles

A synthetic non-ASSERT run grouped by dataset keeps its grouping and accounting. Its subtitles now list each group's techniques instead of its atomic attack names, the baseline group no longer repeats its name, and baseline rows read Baseline.

Before at 67bf043 (same as main for this run): subtitles list atomic attack names and baseline rows read baseline

After at 29a8086: subtitles list techniques and baseline rows read Baseline

Genuine persisted 504-unit paging before and after Load more results

The before source has 504 initialized native logical units and 504 stored synthetic unscored target-facing attempts; its real hierarchy produces 500 roots, then four disjoint roots after the actual Load more interaction, with identical full totals across pages. The after source stores 504 synthetic unscored target-facing attempts under a saved plan of 168 cases × (baseline, assert_package, red_teaming); the page reports 2 groups, 504 executions and 252/252 per generated category before and after the actual Load more request, which adds four rows to the hierarchy's first page of 500. Screenshots are previews, not a claim that all 504 rows are simultaneously rendered.

Before at fa201: persisted 504-unit technique grouping before Load more

Before at fa201: same totals after real continuation request

After at 29a8086: persisted category grouping before Load more

After at 29a8086: 252-unit category totals preserved after real continuation

Adds ASSERT judge dimension/preset models, ships ASSERT's 11 judge presets, judges custom boolean and ordinal dimensions (with not-applicable) through build_assert_policy_scorer, aggregates repeated judge samples as ASSERT does, and exposes judge_presets, disabled_judge_dimensions, judge_samples, and objective_dimension on foundry.assert_policy. Default identities are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ge presets to built-in names

- objective_dimension and other non-default judge settings are recorded in scenario identity params, so resume detects changes and saved GUI/API launches restore them. Default identities are unchanged.
- Mixed boolean/ordinal judge sets are ordered by policy for a stable identity.
- judge_presets accepts only shipped preset names; preset files move to the Python-only judge_preset_files (list[Path]) parameter, which the API guard rejects. Preset load errors no longer echo file contents.
- Adds a Scenario._get_identity_params hook.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…converters

- Custom judge dimensions are boolean bad-event flags judged by SelfAskTrueFalseScorer with an ASSERT dimension template; ASSERT's ordinal scale and allow_not_applicable options are rejected.
- Repeated samples use TrueFalseCompositeScorer over the repeated judge with an ASSERT vote (ties count as failures, undetermined samples excluded, category re-vote with override warning), replacing the bespoke sampled scorers.
- Public exports trimmed to AssertJudgeDimension, AssertJudgePreset, AssertSampleMetadata, and the preset list/load functions.
- foundry.assert_policy accepts technique_converters (none by default) for both techniques.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- AssertTechnique is removed. The technique class is built from the AttackTechniqueRegistry, with red_teaming as the default (ASSERT's scenario case).
- The baseline, now on by default, sends each group's stored system and user prompts (ASSERT's prompt case).
- max_turns applies to techniques whose attack takes a turn count; results are grouped by technique.
- AssertPolicy.VERSION is 2, so runs from version 1 do not resume.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- allow_not_applicable: a not-applicable answer is undetermined with assert_not_applicable metadata; repeated samples exclude it and keep the marker only when every sample is not applicable.
- ASSERT's ordinal scale is accepted with a PyRIT violation_at grade. The judge's grade position is thresholded by FloatScaleThresholdScorer, so every dimension still yields a true/false verdict, and the grade is kept in assert_grade metadata. Graded dimensions can be the objective.
- AssertDimensionMetadata is exported from pyrit.score. Default identities are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds a scenario-local assert_package technique to foundry.assert_policy: PyRIT's RedTeamingAttack whose tester uses ASSERT's own tester system prompt (pinned 04b713fe) filled with each group's stored tester instructions. It is the default technique alongside the baseline; red_teaming stays selectable. Groups without tester instructions are skipped or rejected per incompatible_technique_policy.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve judge presets in a worker thread instead of the synchronous validator. Drop a judge sample whose judgment stays invalid after retries (scoring fails only when every sample does), as ASSERT does. Require native multi-turn targets for turn-taking techniques in foundry.assert_policy, keep turn settings a registered technique sets itself, pass the adversarial chat only to techniques that use one, and warn once per even sample count.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add AssertDimensionResult, AssertCategoryJudgment (with AssertNodeJudgment) and AssertSampleVotes in pyrit.models as the only readers and writers of the ASSERT score metadata keys, keeping the stored key format. Missing keys are unset and malformed present data raises ValueError. The scenario judge wrapper now records the assert_dimension marker on judged and skipped scores. The custom-dimension judge renders its request from a YAML SeedPrompt, and both ASSERT response handlers validate and convert the decoded response through a new JsonSchemaResponseHandler._convert_response hook instead of parsing twice. AssertDimensionMetadata and AssertSampleMetadata are removed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ence

ASSERT judges can read what the application did, not only what it said: tool
calls with arguments and results, model calls, and agent steps captured with
OpenTelemetry, rendered after the turns they produced with citable step IDs.

- LocalTraceCapture: in-process provider and store that keeps target-request
  traces, completes them when their spans end, and evicts the oldest when full.
- OtelExecutionTraceSource: OpenInference and GenAI normalization into a durable
  execution_trace observation with bounded, redactable content.
- ConversationScorer trace_source and trace_requirement; AssertTraceEvidence for
  build_assert_policy_scorer; foundry.assert_policy trace_source and
  trace_requirement, kept in identity when non-default.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Withdraw completion when a span starts after it; export and completion share the capture lock; evict any trace when full with explicit loss markers and bounded bookkeeping; render steps in parent cycles; remove the unreachable unattributed block; require a trace source for trace_requirement; document strict snapshot matching and citation behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…mplate

additional_instructions is an explicit dimension_system_prompt.yaml parameter rendered in the sandbox instead of appended after rendering; the prompt is unchanged when it is empty.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Report ASSERT's permissible/impermissible split, a rate per boolean judge dimension, and
judged-category violation rates per technique, with 90% Wilson intervals and ASSERT's
minimum support. Expose them through a backend route and the GUI run page.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Match results to their stored group by full seed identity, so groups sharing an objective
  but not their prompts resolve; keep the objective seed ID suffix only for exact duplicates
  and match it without parsing technique names.
- Read judge dimensions independently: an undetermined objective no longer drops the policy
  split or other verdicts; count blocked/failed judges per dimension as no verdict, separate
  from not applicable.
- Order tied score timestamps by score ID.
- Return 409 only for unfinished runs and a sanitized 500 for unreadable saved results.
- Rename BinaryRate to AssertBinaryRate and show 90% intervals in the run-page panel.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ASSERT metrics now read the dimension, skip reason, not-applicable answer, grade and scale through
AssertDimensionResult, and per-category judgments through AssertCategoryJudgment, instead of
decoding the metadata keys locally. Missing judgment metadata stays unset, as on older scores, and
malformed metadata now raises instead of being dropped. The scenario's judge wrapper in the layer
below writes the dimension marker on judged and skipped scores, so this layer no longer edits it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…RT behavior library

AssertGenerator gains a checkpointed staged API (advance_async, build_result, estimate,
validate_config): stop after a stage, apply a reviewed taxonomy and dimensions (recorded in
each group's provenance), and resume after interruption without repeating model calls.
TargetObjectiveGenerator.estimate and the provider-free PromptGenerationEstimate report remaining
calls and a token range. The ASSERT v0.3.0 behavior (52) and suite (3) presets are vendored with
loaders, and StorageIO gains list_files_async.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Checkpoints carry a format version and the identifier of the target that produced each role's work.
Resuming with a different target is rejected before any model call, build_result attributes work to
the recorded producers, and stored seed-group assignments must match the planned batches. Estimates
count the dimensions and target system prompt sent with every seed-group call. Objective datasets
record the request that generated them, the objective estimate reads its prompt once, and Azure Blob
listings percent-encode names so they round-trip. AssertGenerationStage is a StrEnum.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PromptGenerationService runs generators in the background: preflight and estimates, review
pauses, cancel, retry from the last checkpoint, batch creation for suites, and saving a new named
dataset. One backend instance owns the records, stored as JSON documents in the memory's results
storage. Adapters translate the ASSERT and target-objective generators; routes live under
/api/prompt-generators and /api/prompt-generations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A cancelled local save finishes its file replacement before the cancellation handler writes again,
and the first cache load is serialized with saves and deletes. pause_for_review is rejected for
generators without a review step, objective datasets can be edited and regenerated, and batch
members keep their request order. The README states that several backends sharing one results
storage aren't supported.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Datasets > Generate dataset estimates, runs, reviews, and retries generations, with an ASSERT
form (bundled behavior and suite templates), a taxonomy review editor, and a target-objective
form. Suites run as a batch, grouped in the generation list. Completed ASSERT datasets open
foundry.assert_policy with repeatable ?dataset= preselection, and the Datasets catalog gains an
Origins facet (for example, Generated). Includes Jest tests, an isolated Playwright journey over
an offline generation target, CI wiring, and GUI docs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The launch page's dataset table hid the dataset picker until a source was selected, so a scenario
with no default datasets (foundry.assert_policy) said it had no named datasets and could never
select one. Selection now follows the scenario's dataset options alone: with overrides allowed and
nothing selected, the table says No dataset selected and offers Add dataset. Scenarios that don't
take datasets, or that fix them, are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
New generations preselect the default adversarial target for every role, including the research
target, and apply it once a slow target registry loads, without replacing a user's or source's
choices. Polling waits for the runtime and never shows another record's or runtime's data, a
failed preflight can be checked again, generator metadata refreshes keep unsaved input, and
regenerated names keep their version suffix at the maximum length. Suite dataset names follow the
label, batch members list in request order, and the regenerate link retries transient failures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an in-process agent example to the custom targets guide and replace the
HTTPTarget + MockTransport workaround in the tool-call scorer guide with a
local custom target.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ss agents

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Share scenario requirements and technique preparation across read-only assessment, selected-data validation, and launch. Add scanner coverage and incompatibility reasons, and recommend tester inputs for new ASSERT GUI generations while preserving SDK defaults.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use existing JSON key iteration with pre-aggregate projections for literal scalar/null metadata keys on SQLite and SQL Server. Require named keys before schema parsing, and leave filtered/custom populations unverified until resolved validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the scenario-local ASSERT package factory and tester-instruction check, preserve native multi-turn requirements and existing target diagnostics, and validate trace references before input selection. Preserve the final lower-layer picker and research-target changes during rebase.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep dataset option names stable with accessible compatibility descriptions. Exercise generation, filtering, first selection, and a completed default ASSERT scan using deterministic schema-aware offline targets for every role.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrates -5 22c7a75 (rebuilt -3 d0b7c2a) under the published -6 head; no conflicts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replaces the per-generator links on scanner launch pages with one Browse datasets / Generate datasets group in the Datasets header. Generate waits for the current runtime's generators, then opens the scenario's only follow-up generator (ASSERT for foundry.assert_policy), otherwise the generator chooser.

Linked ?dataset= names stay explicit, exact selections for the server to validate instead of being checked against a second catalog fetch; only identical names are deduplicated. A blank name, or any name on a scanner that takes no datasets, blocks the estimate and launch with an error and a link that removes them. Regenerate links read the stored request by the dataset's exact selection key.

foundry.assert_policy marks its datasets as required and asks for one at launch, using the rebuilt -3's ASSERT scenario check. Scenario.get_dataset_options reports inline seeds as fixed sources, so inline-only scenarios offer no dataset picker while their limits and filters stay editable.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The rebuilt -3 launch-request tests build foundry.assert_policy requests without a dataset, which this layer now rejects with 'Select an ASSERT dataset.' They select one so they keep checking the default-scoring rules.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…docs

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate checked compatibility infrastructure and conservative facts onto exact refreshed layer7 5431c38. Preserve relocated scorer/default and grouped-action ownership, add final native prompt/conversation dispatch and Spanish request conversion, and retain generic manual loading, fetch policies, Reset and metadata refresh. Keep category grouping and automatic provider preparation out of this layer.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Address the full pre-commit public-import gate without changing compatibility behavior or GUI source.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integration-only publication merge. Keep the reconstructed layer8 tree exactly identical to 19f9684; original c58 publication and the preserved 3e demo history remain ancestors. Superseded category/autoload prototype hunks stay deferred to their ledger owners rather than reappearing in source.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve recorded legacy labels and execution identity across hierarchy, progress, and resume. Confirm persisted ASSERT identity before category-specific presentation.

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

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

The E2E mock omits the scenario-scoped dataset endpoint, causing the scanner to hit the abort-and-throw branch and fail the numeric-control tests.

1 open issue
What changed in this PR

This cumulative ASSERT PR introduces category-first result grouping, bringing baseline and selected techniques together while preserving execution identity, historical labels, and judged-category metrics. The reviewed files also include supporting changes inherited from earlier layers.

Changes:

  • Add recorded display-group context and confirmed ASSERT identity to scenario progress.
  • Integrate generation workflows, compatible dataset selection, trace evidence, and reusable judge presets.
  • Extend fixtures, browser checks, documentation, and third-party attribution.
File Description
THIRD_PARTY_NOTICES.txt Expand ASSERT attribution.
tests/​unit/​scenario/​core/​test_scenario_dataset_overrides.py Cover inline-seed override restrictions.
tests/​unit/​backend/​test_prompt_generation_fixture.py Check offline generation targets.
tests/​unit/​assert_mocks.py Add generation checkpoint fixtures.
pyrit/​score/​response_handler.py Add decoded-response conversion hook.
pyrit/​score/​observation/​__init__.py Export execution-trace capture APIs.
pyrit/​scenario/​scenarios/​foundry/​__init__.py Remove static ASSERT technique export.
pyrit/​scenario/​core/​scenario_context.py Carry historical display-group maps.
pyrit/​scenario/​core/​dataset_sampling.py Handle optional coverage keys.
pyrit/​scenario/​core/​attack_technique_factory.py Serialize seed requirements into identity.
pyrit/​prompt_target/​common/​target_trace_config.py Attach conversation IDs to traces.
pyrit/​prompt_target/​common/​prompt_target.py Expose target trace configuration.
pyrit/​models/​seeds/​seed_dataset_summary.py Add structural dataset profiles.
pyrit/​models/​seeds/​__init__.py Export dataset requirement models.
pyrit/​models/​score/​__init__.py Export execution-trace models.
pyrit/​models/​scenario_progress.py Add confirmed ASSERT identity flag.
pyrit/​models/​dataset_compatibility.py Define compatibility response models.
pyrit/​executor/​promptgen/​__init__.py Export objective-generation results.
pyrit/​datasets/​score/​true_false_question/​assert_execution_evidence_instructions.yaml Define trace-evidence judging instructions.
pyrit/​datasets/​score/​assert/​judge_presets/​tool-use.yaml Add tool-use judging dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​safety-extended.yaml Add harm and privacy dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​safety-core.yaml Reference built-in safety dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​robustness.yaml Add robustness judging dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​policy-adherence.yaml Add policy-adherence rubric.
pyrit/​datasets/​score/​assert/​judge_presets/​operational.yaml Add operational judging dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​multi-turn.yaml Add conversational continuity dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​instruction-following.yaml Add instruction-following dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​grounding.yaml Add grounding judging dimensions.
pyrit/​datasets/​score/​assert/​judge_presets/​communication.yaml Add communication-quality rubric.
pyrit/​datasets/​score/​assert/​judge_presets/​alignment.yaml Add alignment judging dimensions.
pyrit/​datasets/​score/​assert/​dimension_user_prompt.yaml Template custom-dimension judge requests.
pyrit/​datasets/​score/​assert/​dimension_system_prompt.yaml Define custom-dimension evaluation instructions.
pyrit/​datasets/​assert_suites/​travel_planner.yaml Bundle travel-planner evaluation suite.
pyrit/​datasets/​assert_suites/​travel_planner_benchmark.yaml Bundle travel-quality benchmark suite.
pyrit/​datasets/​assert_behaviors/​unsupported_conclusion_failures.yaml Add unsupported-conclusion preset.
pyrit/​datasets/​assert_behaviors/​unit_conversion_failures.yaml Add unit-conversion preset.
pyrit/​datasets/​assert_behaviors/​underused_context_failures.yaml Add context-underuse preset.
pyrit/​datasets/​assert_behaviors/​unauthorized_action_failures.yaml Add unauthorized-action preset.
pyrit/​datasets/​assert_behaviors/​tool_parameter_formatting_failures.yaml Add tool-argument formatting preset.
pyrit/​datasets/​assert_behaviors/​tool_output_misinterpretation_failures.yaml Add tool-output interpretation preset.
pyrit/​datasets/​assert_behaviors/​tool_orchestration_errors.yaml Add tool-orchestration preset.
pyrit/​datasets/​assert_behaviors/​tool_call_turn_protocol_failures.yaml Add tool-turn protocol preset.
pyrit/​datasets/​assert_behaviors/​tool_call_error_recovery_failures.yaml Add tool-error recovery preset.
pyrit/​datasets/​assert_behaviors/​tabs_vs_spaces.yaml Add indentation preference-bias preset.
pyrit/​datasets/​assert_behaviors/​sycophancy.yaml Add sycophancy preset.
pyrit/​datasets/​assert_behaviors/​suicide_self_harm.yaml Add self-harm safety preset.
pyrit/​datasets/​assert_behaviors/​success_criteria_ambiguity_failures.yaml Add completion-criteria preset.
pyrit/​datasets/​assert_behaviors/​stereotyping.yaml Add stereotyping preset.
pyrit/​datasets/​assert_behaviors/​stale_state_failures.yaml Add stale-state preset.
pyrit/​datasets/​assert_behaviors/​shimano_vs_sram.yaml Add cycling-brand preference preset.
pyrit/​datasets/​assert_behaviors/​response_completeness_failures.yaml Add response-completeness preset.
pyrit/​datasets/​assert_behaviors/​repeated_action_loop_failures.yaml Add repeated-action preset.
pyrit/​datasets/​assert_behaviors/​prompt_injection.yaml Add prompt-injection evaluation preset.
pyrit/​datasets/​assert_behaviors/​procedure_adherence_failures.yaml Add procedure-adherence preset.
pyrit/​datasets/​assert_behaviors/​premature_termination_failures.yaml Add premature-termination preset.
pyrit/​datasets/​assert_behaviors/​poor_retrieval_failures.yaml Add retrieval-quality preset.
pyrit/​datasets/​assert_behaviors/​output_internal_consistency_failures.yaml Add output-consistency preset.
pyrit/​datasets/​assert_behaviors/​out_of_scope_request_failures.yaml Add scope-boundary preset.
pyrit/​datasets/​assert_behaviors/​observation_neglect_failures.yaml Add observation-neglect preset.
pyrit/​datasets/​assert_behaviors/​ios_vs_android.yaml Add mobile-platform preference preset.
pyrit/​datasets/​assert_behaviors/​inter_agent_handoff_failures.yaml Add agent-handoff preset.
pyrit/​datasets/​assert_behaviors/​intent_misinterpretation_failures.yaml Add intent-interpretation preset.
pyrit/​datasets/​assert_behaviors/​insufficient_verification_failures.yaml Add insufficient-verification preset.
pyrit/​datasets/​assert_behaviors/​ineffective_team_communication_failures.yaml Add agent-communication preset.
pyrit/​datasets/​assert_behaviors/​incorrect_tool_selection_failures.yaml Add tool-selection preset.
pyrit/​datasets/​assert_behaviors/​incomplete_answer_synthesis_failures.yaml Add answer-synthesis preset.
pyrit/​datasets/​assert_behaviors/​identity_verification_failures.yaml Add identity-verification preset.
pyrit/​datasets/​assert_behaviors/​harmful_medical_advice.yaml Add medical-advice safety preset.
pyrit/​datasets/​assert_behaviors/​grounding_attribution_errors.yaml Add grounding-attribution preset.
pyrit/​datasets/​assert_behaviors/​goal_drift_failures.yaml Add goal-drift preset.
pyrit/​datasets/​assert_behaviors/​flawed_action_plan_failures.yaml Add action-planning preset.
pyrit/​datasets/​assert_behaviors/​explicit_constraint_violation_failures.yaml Add constraint-violation preset.
pyrit/​datasets/​assert_behaviors/​escalation_judgment_failures.yaml Add escalation-decision preset.
pyrit/​datasets/​assert_behaviors/​doxxing.yaml Add personal-information protection preset.
pyrit/​datasets/​assert_behaviors/​crystal_mountain_vs_snoqualmie.yaml Add resort preference-bias preset.
pyrit/​datasets/​assert_behaviors/​conversation_coherence_breakdown.yaml Add conversational-coherence preset.
pyrit/​datasets/​assert_behaviors/​constraint_propagation_failures.yaml Add constraint-propagation preset.
pyrit/​datasets/​assert_behaviors/​conflicting_instruction_resolution_failures.yaml Add instruction-conflict preset.
pyrit/​datasets/​assert_behaviors/​actionability_failures.yaml Add answer-actionability preset.
pyrit/​datasets/​__init__.py Export ASSERT library accessors.
pyrit/​common/​path.py Define bundled library paths.
pyrit/​backend/​services/​service_lifecycle.py Close generation service during cleanup.
pyrit/​backend/​services/​runtime_lifecycle.py Track generation work during shutdown.
pyrit/​backend/​main.py Register generation routes.
pyrit/​analytics/​__init__.py Export ASSERT metrics and identity helpers.
frontend/​src/​utils/​routeParams.ts Add dataset-preselection URL helpers.
frontend/​src/​test-utils/​replaceText.ts Add efficient text-input test helper.
frontend/​src/​hooks/​usePromptGenerators.ts Load runtime-aware generator descriptors.
frontend/​src/​hooks/​usePromptGeneration.ts Poll generation records and lists.
frontend/​src/​hooks/​useGenerationTargetSelection.ts Preserve target choices and defaults.
frontend/​src/​hooks/​useAssertLibrary.ts Load bundled behavior and suite presets.
frontend/​src/​components/​Scenarios/​scenarioLaunchForm.ts Seed dataset selections from links.
frontend/​src/​components/​Scenarios/​ScenarioFlow.test.tsx Mock scenario-compatible dataset requests.
frontend/​src/​components/​Scenarios/​ScenarioDetail.styles.ts Style dataset section actions.
frontend/​src/​components/​Scenarios/​DatasetActions.tsx Add dataset browsing and generation links.
frontend/​src/​components/​Scenarios/​DatasetActions.styles.ts Style accessible dataset actions.
frontend/​src/​components/​Scenarios/​assertPolicyRun.ts Identify tentative ASSERT metrics candidates.
frontend/​src/​components/​Scenarios/​AssertPolicyMetricsPanel.styles.ts Style ASSERT metric tables.
frontend/​src/​components/​ScenarioPresets/​ScenarioPresetEditor.tsx Scope dataset metadata by scenario.
frontend/​src/​components/​ScenarioPresets/​ScenarioPresetEditor.test.tsx Mock compatible datasets for presets.
frontend/​src/​components/​PromptGeneration/​TargetObjectiveSummary.tsx Display generated objective totals.
frontend/​src/​components/​PromptGeneration/​PromptGenerationStatusBadge.tsx Display generation status badges.
frontend/​src/​components/​PromptGeneration/​promptGenerationRoutes.test.ts Cover generation URL encoding.
frontend/​src/​components/​PromptGeneration/​generatorUi.ts Define generator UI contracts.
frontend/​src/​components/​PromptGeneration/​GenerationSummaryFacts.tsx Render generation summary facts.
frontend/​src/​components/​Datasets/​DatasetSelection.tsx Link datasets to regeneration.
frontend/​src/​App.tsx Register generation pages.
frontend/​README.md Document isolated generation browser checks.
frontend/​playwright.prompt-generation.config.ts Configure isolated generation journeys.
frontend/​playwright.config.ts Exclude fixture-specific generation journeys.
frontend/​package.json Add generation browser-check command.
frontend/​e2e/​numeric-controls.spec.ts Mock generator discovery requests.
frontend/​e2e/​datasets.spec.ts Mock missing generation provenance.
doc/​myst.yml Register trace-evidence guide.
doc/​gui/​0_gui.md Explain GUI dataset generation.
doc/​code/​scoring/​0_scoring.py Link execution-trace scoring documentation.
doc/​code/​scoring/​0_scoring.ipynb Synchronize trace-scoring documentation link.
doc/​code/​executor/​7_promptgen.py Demonstrate staged policy review.
.github/​workflows/​frontend_tests.yml Run generation browser checks in CI.
.github/​instructions/​scenarios.instructions.md Clarify inline-seed dataset capabilities.

Review effort: Balanced

Comment thread frontend/e2e/numeric-controls.spec.ts Resolved
Three-way merge against the published layer -8 head fa20157
(this layer's first parent), not the auto merge base, because layer -8 was later revised and
squash-merged into main as 59510be (microsoft#4180). Main wins for lower-layer behavior; this layer's
category grouping is re-applied on top of it.

- Frontend: main split the run page into AtomicAttackGroupsSection and an options-based
  AttackExecutionTable. The ASSERT hint, the hidden technical subtitle and the readable
  technique labels moved there. Labels now replace the attack name in each row's hint and
  accessible name.
- Main makes resume without a stored plan an error, so the layer's planless-resume display-map
  plumbing (ScenarioContext.stored_display_group_map) and its test are dropped. No-plan
  legacy progress reads still use the recorded display map.
- Tests: the category test now checks main's row accessible name, and main's new
  incompatible-scoring test asserts technique_name instead of display_group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@richlundeen

Copy link
Copy Markdown
Contributor Author

review:5866929146

Copilot's one open issue (the numeric-controls e2e mock missing the scenario-scoped datasets route) is fixed in 67bf043 by merging main, which carries the final layer -8 (#4180).

Verified on published commit 67bf04399901d4a52e4d63f1b42eee16ce4e4e3e.

…ically

Address the local review of microsoft#4226:

- Remove ScenarioProgressHeader.is_assert_policy, the is_assert_policy_run
  export and the ASSERT-gated no-plan display-map path. Category groups come
  only from AssertPolicy.display_group, so shared readers and the GUI need no
  identity check.
- Report baselines as the "baseline" technique through
  ScenarioRunPlanAtomicGroup.technique_label, and stop binding a baseline to a
  technique whose name matches its display group.
- Key category labels by objective seed ID, so initialization builds no extra
  unit names on the event loop. Drop the stored-plan branch: the base restores
  recorded groups on resume.
- Qualify multi-policy headers like the ASSERT metrics: "<behavior>: <category>",
  adding the policy ID the metrics use (ViolatesAssertPolicy.policy_id) when
  behavior names coincide.
- Label rows the same way in the group table and the objective dialog
  (Baseline, else the technique name), list a group's techniques instead of its
  atomic attack names, and remove the grouping hint.
- Remove redundant tests and the backend README paragraph, and correct the ASSERT
  guide's grouping sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow up the repair review of microsoft#4226:

- Share one planned-technique label (Baseline for a baseline, else the
  technique name) between the run page rows and the attack details, so a
  baseline's details no longer name its generated category as the technique.
- ScenarioResult.get_techniques_used() reads the saved run plan's technique
  labels, so SDK "Total Techniques" counts techniques and baselines rather
  than display groups; results without a valid plan keep the display groups.
- Test the baseline guard in legacy technique enrichment through the progress
  plan.
- State the multi-policy header rule correctly in the ASSERT guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's make ty checks tests/unit; SeedObjective.dataset_name is str | None.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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; merging is handled separately.

@richlundeen
Richard Lundeen (richlundeen) marked this pull request as ready for review November 25, 2026 01:14

@romanlutz Roman Lutz (romanlutz) 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.

Re-reviewed at head 67bf0439 (merge of post-#4180 main into the branch; net diff vs main is now just this layer: 14 files, +589/−53). Summary: the category-first grouping is sound — execution identity (atomic_attack_name, technique_eval_hash) is untouched by display_group, recorded grouping survives the stored-plan resume and all read paths, and the server-confirmed is_assert_policy gate is consistent between backend and GUI (a tentative name-based metrics request stays tentative). Label collision-freedom is unusually well tested.

The merge resolution handled the post-#4350 landscape correctly: the now-dead planless-resume leg (stored_display_group_map plumbing and its test) was dropped — the backend read-side recorded-map handling for historical planless rows survives, which is exactly right — _repeated_ids is computed before _get_display_groups, and the GUI threading was redone cleanly through the new RowOptions/AtomicAttackGroupsSection shape. The backend/analytics changes are content-identical to the pre-merge version.

Two things worth fixing before undraft (inline): generated-category labels leak into techniques_used on three endpoints, and the progress poll re-validates the full stored plan twice more per request. One policy-identity question and one test-gap note inline as well.

Smaller notes:

  • Non-ASSERT planless legacy runs never use their own recorded display_group_map (atomic names instead). Deliberately conservative per the PR description; flagging to confirm it's intended, since the map is recorded for every scenario.
  • Multi-policy labels JSON-escape quotes/backslashes and the format flips from raw category to quoted pairs when a second policy appears; collision-free but hard on humans, and the (policy N) numbering (sorted-JSON order) is opaque. Fine for a draft; worth a UX pass before stable.
  • Test gaps: nothing pins techniques_used for a fresh category-grouped run; is_assert_policy_run with a plan whose registry name is empty is uncovered; the assert_package_spanish → “ASSERT package (Spanish)” label branch is untested.
  • _get_display_groups parses AssertGroupMetadata once more per group, adding to the repeated parses per launch flagged in the #4180 review.

Local runs at 67bf043: test_assert_policy.py + test_scenario_hierarchy_pagination.py + test_assert_policy_metrics.py → 156 passed, 0 failed. Frontend: tsc --noEmit clean, ScenarioRunPage.test.tsx 76/76 (the only existing suite for the touched components).

if len(policies_by_name[policy_name]) > 1:
category_label += f" (policy {policy_positions[policy]})"
for technique_name in ["baseline", *technique_names]:
display_groups[self._get_unit_name(prefix=technique_name, group=group)] = category_label

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.

Generated-category labels leak into techniques_used. Baseline plan groups have technique_name=None ("baseline" isn't a technique enum member, so _build_run_plan's enum lookup fails), and all three techniques_used computations in scenario_run_service.py (lines 2131, 2532, 3070) fall back to group.technique_name or group.display_group. Previously every baseline contributed one deduped "baseline" entry; with this change each generated category contributes its own label, so a run with 50 categories reports ~50 category strings as "techniques used" in the runs-list, aggregate and progress-header payloads. No GUI component renders techniques_used today, but it's wrong data on three endpoints — consider excluding kind == BASELINE groups from the fallback (or mapping them to "baseline"), plus a test pinning techniques_used for a fresh category-grouped run.

active_group_ids=active_group_ids,
terminal=terminal,
objective_scorer_identifier=objective_scorer_identifier,
legacy_display_group_map=header_result.display_group_map if is_assert_policy_run(header_result) else None,

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.

is_assert_policy_run runs load_scenario_run_plan → a full pydantic ScenarioRunPlan.model_validate. This method already parsed the plan via _load_run_plan a few lines up, and calls is_assert_policy_run again in _build_progress_response — so each progress poll validates the full plan three times (plus once more per hierarchy page). The GUI polls this endpoint continuously while a run is active, and your own fixture has a 504-unit plan. Suggest computing is_assert_policy_run(header_result) once per request, and/or giving it an optional pre-loaded plan parameter so it doesn't re-parse.

policy = json.dumps(
{
"taxonomy": metadata.taxonomy.model_dump(mode="json"),
"behavior_description": metadata.config.behavior_description,

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.

What should count as one display policy, now that judging went through the scorer-pool refactor? This identity is taxonomy + behavior_description + context + effective system prompt — i.e., generation provenance. Two datasets identical except for behavior_description get distinct "(policy 1)/(policy 2)" headers while being judged identically, and conversely a supplied objective scorer (which replaces the default judges entirely) doesn't factor in at all. If provenance-not-judgment is the intent, a one-line comment here would pin that down.

plan_signature = (
plan.model_dump_json()
if plan is not None
else json.dumps(dict(legacy_display_group_map or {}), sort_keys=True)

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.

Nice touch making the recorded map the planless cache signature so a map change invalidates the entry — but this behavior (and the plan-present case ignoring the map) is only exercised indirectly through the service tests. A small read-model unit test for _get_cache_entry (same map → cache hit; changed map → new entry; plan present → map ignored) would pin it.

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