Repository navigation
FEAT: Regenerate generated datasets when a scan chooses Regenerate (-11) - #4735
Merged
Richard Lundeen (richlundeen) merged 140 commits intoDec 4, 2026
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Compatible-only pickers hide regeneration controls for eligible datasets, while sequential per-dataset database queries can delay catalog and picker loading for large generated suites.
2 open issues
What changed in this PR
This PR connects scan-time Regenerate to saved dataset-generation settings, building on #4228’s background preparation flow. It reuses PyRIT’s generators and dataset replacement path while preserving cached datasets and planned seeds for resume.
Changes:
- Resolve eligible generated datasets from recorded settings and completed jobs, then regenerate during new-run preparation.
- Expose regeneration availability and show replacement warnings, loading controls, and preparation status in the GUI.
- Extend background-loading coverage and document loading policies, replacement behavior, and deprecations.
| File | Description |
|---|---|
| tests/unit/scenario/scenarios/adaptive/test_text_adaptive.py | Covers selection identity for pending runs. |
| tests/unit/scenario/foundry/test_assert_policy.py | Checks category grouping after deferred preparation. |
| tests/unit/scenario/core/test_scenario_dataset_overrides.py | Tests consistent source resolution across load and launch. |
| tests/unit/scenario/core/test_required_data.py | Covers deprecated fetch settings and warnings. |
| tests/unit/scenario/core/test_dataset_sources.py | Tests writer coordination and stored-copy refresh behavior. |
| tests/unit/scenario/core/test_dataset_configuration.py | Covers fetch-policy deprecation compatibility. |
| tests/unit/scenario/conftest.py | Extends preparation mocks to preflight checks. |
| tests/unit/scenario/benchmark/test_adversarial.py | Makes resume explicit in benchmark test setup. |
| tests/unit/scenario/benchmark/test_adversarial_benchmark_cache_reuse.py | Checks cache reuse for pending runs. |
| tests/unit/scenario/airt/test_multilingual.py | Tests language metadata with deferred preparation. |
| tests/unit/scenario/airt/test_jailbreak.py | Tests template metadata with deferred preparation. |
| tests/unit/models/test_scenario_dataset_preparation.py | Validates preparation metadata serialization and rejection. |
| tests/unit/memory/memory_interface/test_interface_prompt_generations.py | Tests compact completed-generation reads. |
| tests/unit/conftest.py | Adds a fixture for observing dataset writer waits. |
| tests/unit/cli/test_dataset_request.py | Checks visible fetch-policy deprecation warnings. |
| tests/unit/backend/test_scenario_run_service.py | Tests preparation-state handling in run readers. |
| tests/unit/backend/test_scenario_configuration_resolver.py | Preserves legacy request settings without warnings. |
| pyrit/scenario/scenarios/benchmark/adversarial.py | Distinguishes resume from newly persisted pending runs. |
| pyrit/scenario/core/scenario_context.py | Adds an explicit resume flag. |
| pyrit/scenario/core/required_data.py | Adds preparation preflight and legacy-policy handling. |
| pyrit/scenario/core/dataset_overrides.py | Applies legacy request policies without warnings. |
| pyrit/registry/components/scenario_registry.py | Supports creating runs before dataset preparation. |
| pyrit/models/scenario_progress.py | Exposes pending preparation in progress headers. |
| pyrit/models/scenario_dataset.py | Documents loading semantics and deprecated policies. |
| pyrit/models/scenario_dataset_preparation.py | Defines validated preparation-state metadata. |
| pyrit/models/catalog/scenario.py | Adds background preparation and response state fields. |
| pyrit/models/__init__.py | Exports the preparation-state model lazily. |
| pyrit/memory/memory_interface.py | Reads completed generations and persists prepared run plans. |
| pyrit/memory/_scenario_history.py | Projects preparation metadata into history reads. |
| pyrit/cli/pyrit_shell.py | Updates loading-policy help text. |
| pyrit/cli/pyrit_scan.py | Clarifies refresh behavior and deprecation in CLI help. |
| pyrit/cli/_cli_args.py | Warns when callers select the deprecated policy. |
| pyrit/backend/services/scenario_run_service.py | Integrates regeneration with preparation and run status. |
| pyrit/backend/services/prompt_generation_service.py | Reuses shared request and target resolution helpers. |
| pyrit/backend/services/prompt_generation_adapters.py | Shares recorded-settings and target lookup logic. |
| pyrit/backend/services/dataset_service.py | Adds regeneration availability to dataset listings. |
| pyrit/backend/services/dataset_regeneration.py | Resolves saved settings and runs unattended regeneration. |
| pyrit/backend/routes/scenarios.py | Documents deferred preparation on run creation. |
| pyrit/backend/README.md | Explains preparation, regeneration, and coordination behavior. |
| pyrit/backend/models/datasets.py | Adds the regeneration availability response field. |
| frontend/src/types/index.ts | Adds regeneration and preparation API types. |
| frontend/src/hooks/useScenarioDatasets.ts | Tracks concurrent dataset loads and per-dataset errors. |
| frontend/src/hooks/useScenarioDatasets.test.tsx | Tests load tracking and stale-result handling. |
| frontend/src/hooks/useDatasetAutoLoad.ts | Starts missing-dataset loads once per page scope. |
| frontend/src/hooks/useDatasetAutoLoad.test.tsx | Covers automatic loading, retries, and scope changes. |
| frontend/src/components/Scenarios/ScenarioRunProgress.tsx | Shows preparation progress before attacks start. |
| frontend/src/components/Scenarios/ScenarioRunPreviewDialog.tsx | Warns about replacement and generation model calls. |
| frontend/src/components/Scenarios/ScenarioRunPage.test.tsx | Covers pending, failed, and cancelled preparation views. |
| frontend/src/components/Scenarios/ScenarioRunNotices.tsx | Explains failures before execution and rerun recovery. |
| frontend/src/components/Scenarios/ScenarioRunHeader.tsx | Labels preparation and hides unsupported resume actions. |
| frontend/src/components/Scenarios/scenarioLaunchRequest.ts | Requests background preparation for dataset-backed scans. |
| frontend/src/components/Scenarios/scenarioLaunchRequest.test.ts | Tests background preparation request construction. |
| frontend/src/components/Scenarios/scenarioLaunchForm.ts | Normalizes saved dataset loading settings. |
| frontend/src/components/Scenarios/ScenarioFlow.test.tsx | Updates launch-flow expectations for deferred preparation. |
| frontend/src/components/Scenarios/ScenarioDetail.tsx | Connects automatic loading and regeneration previews. |
| frontend/src/components/Scenarios/ScenarioDetail.styles.ts | Prevents long preview warnings from being compressed. |
| frontend/src/components/Scenarios/ScenarioDatasetTable.styles.ts | Styles the two-option loading selector and announcements. |
| frontend/src/components/Scenarios/datasetPresentation.ts | Defines loading choices and refresh capability helpers. |
| frontend/src/components/Scenarios/datasetPresentation.test.ts | Tests loading normalization and regeneration eligibility. |
| frontend/src/components/ScenarioPresets/scenarioPresetForm.ts | Normalizes saved preset loading policies. |
| frontend/src/components/ScenarioPresets/ScenarioPresetEditor.test.tsx | Checks policy saving without dataset loading. |
| frontend/src/components/History/ScenarioHistory.tsx | Shows preparation state and suppresses invalid resume actions. |
| frontend/src/components/History/ScenarioHistory.test.tsx | Tests history behavior for unprepared runs. |
| frontend/e2e/scenario-techniques.spec.ts | Separates transient preparation flags from saved configuration. |
| frontend/e2e/scenario-history.spec.ts | Updates background launch request expectations. |
| frontend/e2e/fixtures/scenario_dataset_backend.py | Adds controllable providers for background-loading journeys. |
| doc/scanner/1_pyrit_scan.py | Updates scanner loading and replacement guidance. |
| doc/scanner/1_pyrit_scan.ipynb | Mirrors scanner guidance in the notebook. |
| doc/code/datasets/6_generated_datasets.py | Updates generated-dataset examples and refresh guidance. |
| doc/code/datasets/6_generated_datasets.ipynb | Mirrors generated-dataset example updates. |
| doc/code/datasets/0_dataset.md | Documents Cached, Regenerate, and background preparation. |
| .github/instructions/scenarios.instructions.md | Updates contributor guidance for loading and refresh policies. |
Review effort: Balanced
Say once that Regenerate replaces the named datasets in full, including manual edits, and add one short line when generated datasets are generated again. Drop the filter, started-run and new-name sentences from both replacement warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Concurrent attacks stamp a result when it finishes, but can save it after a later-stamped result. A progress read during the run then moved its keyset cursor, and the read model's cached cursor, past the result saved next. Both skipped it for good, so a completed run's progress, and the run page watching it, could miss results. With background dataset preparation the run page is already polling when attacks start, so CI hit this (scenario-techniques e2e, offline_rot13 missing). Every result is saved before a run stops. So the first read of a stopped run reloads its cached results from the beginning, and a cursor issued while the run was live is answered from the first result once the run has stopped. The run page already merges results by ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launch page estimates its starting selection 300 ms after it loads. When the test chose a target in that window, the untargeted answer could arrive first; the page drops it, but nextEstimate took it and the test failed on the missing target_name (1 of 60 local repeats). Each wait now names the request fields it expects. Saved presets also outlive a test, so a second --repeat-each run could not create a preset with the same name. Names include the repeat index, as the scenario-datasets and prompt-generation specs do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dataset catalog and the compatible-dataset picker read each generated dataset's newest objective with its own paged query, which also counted examples. A new MemoryInterface.get_newest_objective_examples_async returns the newest example that holds an objective for many datasets at once, without counting or paging, and matches what get_seed_examples_async returns first for each name. Edit & regenerate and the regeneration resolver both read through it, so they read settings the same way, and Edit & regenerate's behavior and errors are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Compatible-only scenarios such as foundry.assert_policy, the Generate then Run flow for ASSERT, hid the Cached / Regenerate choice even when a selected dataset could be generated again. The choice now shows whenever a selected dataset can refresh, with the same row labels; compatible choices still never load automatically. The backend accepts always for these scenarios and checks the regenerated data against their requirements before committing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Both issues are fixed: Regenerate is offered in compatible-only pickers, and generation settings are read in one batched read. Verified on published commit |
Roman Lutz (romanlutz)
approved these changes
Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Regeneration must run the generation that produced the stored seeds, which is the one that completed last: a cancelled generation can be retried after a newer one completed, so ordering by created_at paired its request with another job's targets. A row_number() window per dataset name, ordered by completed_at, now returns one record per requested name, so the read no longer loads every completed generation with its request and progress JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Regeneration lived in backend services as a parallel provider plus a ContextVar hook, so the same DatasetConfiguration.prepare_async(fetch=ALWAYS) call kept a generated dataset's stored copy in the SDK but generated it again inside the backend. AssertProvider and TargetObjectiveProvider now read the request their objectives record and rebuild themselves from it and the recorded targets (from_recorded_generation). get_recorded_generation_providers_async in pyrit.datasets finds each stored dataset's most recently completed generation and newest objective in batched reads, resolves its targets by name in the TargetRegistry (so a private target stays its owner's), and returns the providers plus why each other generated dataset can't be generated again. DatasetConfiguration calls it under ALWAYS for stored datasets with no configured or registered provider, so SDK, CLI, and GUI scans behave the same. Preparation now warns with that reason, at the default WARNING level, when a generated dataset keeps its stored copy; the generic warning says the other datasets have no provider and can't be generated again. Listings log the reasons at INFO. Deleted GeneratedDatasetProvider, DatasetRegenerationResolver, refresh_stored_datasets_with, and the ScenarioRunService and DatasetService injection points. Edit & regenerate reads recorded settings through the same library readers and memory read as scans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed regeneration ended the run with only the generator's message, such as "Strategy execution failed for TargetObjectiveGenerator: Error sending prompt ...", so with several generated datasets the operator couldn't tell which one or which target to fix. Preparation now raises "Generating dataset 'X' again failed: <message> Cause: <type>: <root>", chained to the original error. Cancellation still propagates, the stored dataset stays unchanged, and download providers' errors are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e dataset A generation can use a registered provider's name, so a stored dataset made on Generate datasets could list provider_available and regeneration_available both true while always downloads it from the provider and never generates it. The listing now asks about generation only for stored datasets without a registered provider, and the field description says a provider takes precedence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pyrit_scan, pyrit_shell, and scenario suite submissions never asked for background preparation, so a fresh run under --dataset-fetch always regenerated generated datasets inside POST /api/scenarios/runs while the run service's preparation lock was held: minutes of model calls before the request returned, no run to show or cancel meanwhile, the CLI's 60-second read timeout reporting an unknown start while the scan went on unattended, and every other launch waiting on the lock. All three already poll the stored run, so they now send prepare_in_background like the GUI's dataset scans: the run is stored and admitted first, shows as preparing, and Ctrl+C or a suite cancel stops the generation. Resumed runs ignore the flag, and other REST clients keep the inline default. The --dataset-fetch help in pyrit_scan and pyrit_shell now says always also generates a dataset made by a prompt generation again, with model calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…README The dataset guide's regeneration paragraph explained how settings are read and listed every case that keeps a stored copy, and the backend README repeated the list in one sentence that ended on a separate source line. The guide now says what runs, that it applies to every always preparation including Python's fetch=DatasetFetchPolicy.ALWAYS, its cost, cancellation for scans that prepare in the background (GUI, pyrit_scan, pyrit_shell, suites), the kept review, and that other stored datasets keep their copy with a warning naming why. The README keeps the cases as a short list, uses the most recently completed generation, says a provider takes precedence over regeneration_available, and names the clients that send prepare_in_background. The pyrit_scan and generated-dataset notebooks no longer say every stored dataset without a provider keeps its copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With only a generated dataset selected under Regenerate, the row said "Regenerates with saved settings" and the hint below it said "Generates a fresh copy with saved settings when the scan starts.", the same fact twice, computed through two derived flags and a three-way hint. Regenerate now shows one hint, "Gets a fresh copy when the scan starts.", and the row labels say which datasets are generated again or keep their stored copy. The Jest test renders once, and the mock e2e spec expects the new hint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…object yields make ty checks tests/unit, and patch.object with a side_effect yields MagicMock | AsyncMock, so _answer_with now declares that context manager type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the backend's copy Add a library test with one good generated dataset and two that can't be generated again (an unregistered target and a prompt-only replacement), so each failure leaves out only its own dataset. Keep the reason matrix in the library and cut the backend's copies to the cases a launch adds: a deleted generation record and one kept stored copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The library test owns the root-cause suffix, so the backend test name says it checks the dataset name and the kept copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Richard Lundeen (richlundeen)
deleted the
richlundeen-regenerate-generated-datasets
branch
December 4, 2026 17:21
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.

Part -11 of an 11-layer ASSERT series. Design and how to use it: ASSERT in PyRIT.
Each PR targets
main; this is not a native stack. Layers -1 to -10 are merged, andmainis merged into this branch, so this PR's diff tomainis this layer alone.Description
When a scan chooses Regenerate (
always), a dataset made on the Generate datasets page is generated again with the settings it was made with, instead of keeping its stored copy. Cached never regenerates: it uses the stored copy.AssertProviderandTargetObjectiveProviderread the request their objectives record (read_recorded_request, the reader Edit & regenerate also uses) and rebuild themselves from it and the recorded targets (from_recorded_generation).get_recorded_generation_providers_asyncinpyrit.datasetstakes each name's most recently completed generation (one SQL window query), reads the newest objectives in one batch, looks up the targets by name inTargetRegistry(a private target only for its owner), and returns the providers plus why each other generated dataset can't regenerate. Building them makes no model calls.DatasetConfigurationuses it underalwaysfor stored datasets with no configured or registered provider, so the SDK, CLI, and GUI behave the same. SDK behavior change:fetch=DatasetFetchPolicy.ALWAYSnow also generates such a dataset again, with model calls, when its recorded targets are registered in that session; before, it kept the stored copy. Regeneration reuses layer -10's refresh path: writers of one dataset take turns, the full replacement is validated before it's committed, a cancelled run leaves the dataset unchanged, and a resumed run uses the seeds it planned.pyrit_scan,pyrit_shell, and scenario suites now sendprepare_in_backgroundfor every new run, like the GUI's dataset scans, so a start returns at once and the run can be cancelled while it generates, instead of holding the preparation lock through minutes of model calls. Dataset preparation errors, such as a failed download, validation, or regeneration, now arrive by polling as a FAILED run that can't be resumed, instead of from the start request; sources that can never load are still rejected before the run is saved.DatasetInfo.regeneration_available(response-only) tells the GUI which stored datasetsalwayswould generate again; a registered provider takes precedence. The GUI labels those rows Regenerates with saved settings, and Run preview's replacement warning adds one line: "Generating X again makes model calls and can take minutes."Own GUI changes
foundry.assert_policyshow it too, for any selected dataset that can be regenerated or downloaded again; a regenerated dataset must still pass the scenario's requirements before it replaces the stored copy.Trade-offs
Unchanged
Stored-copy behavior for uploads and datasets generated in Python without a generation job, the Generate page, and layer -10's loading rules are unchanged. No endpoint, request field, or migration is added;
prepare_in_backgroundalready existed.Demonstration
Mock e2e (
numeric-controls.spec.ts): Run preview's replacement warning is one sentence, plus one line for generated datasets: