Support baseline-only execution in Scenario #1321
Open
+326
−39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enables scenarios to be initialized with an empty strategies list when
include_baseline=True. Previously, empty strategies would raise aValueErroreven when baseline was requested.Problem
When using
RedTeamAgent(orFoundryScenario) withinclude_baseline=Trueandscenario_strategies=[], the scenario would fail with:This prevented users from running baseline-only attacks, which is useful for:
Changes
scenario_strategy.py: Addedallow_emptyparameter toprepare_scenario_strategies(). WhenTrueand an empty sequence is explicitly provided, returns an empty list instead of raisingValueError.scenario.py:initialize_async()to passallow_empty=self._include_baselineso baseline-only execution is allowed when baseline is requested_create_standalone_baseline()method that creates a baseline attack directly fromdataset_configwhen no other atomic attacks exist to derive fromTests: Added 4 unit tests covering baseline-only execution scenarios
Usage Example
Test Results
All 29 scenario tests pass, including 4 new tests for baseline-only execution.