Skip to content

MAINT: Refactoring scenario strategy selection#1627

Open
rlundeen2 wants to merge 6 commits intomicrosoft:mainfrom
rlundeen2:users/rlundeen/2026_04_16_strategy_refactor
Open

MAINT: Refactoring scenario strategy selection#1627
rlundeen2 wants to merge 6 commits intomicrosoft:mainfrom
rlundeen2:users/rlundeen/2026_04_16_strategy_refactor

Conversation

@rlundeen2
Copy link
Copy Markdown
Contributor

@rlundeen2 rlundeen2 commented Apr 16, 2026

ScenarioCompositeStrategy was an ad-hoc wrapper that conflated strategy selection with attack+converter composition, adding complexity without clear boundaries. This PR cleans that up.

What changed:

  • Deprecated ScenarioCompositeStrategy (removed_in="0.18.0" — extended window to give external callers time to migrate). The replacement is FoundryComposite, a typed dataclass that explicitly separates attack from converters.
  • Removed dead methods from ScenarioStrategy: prepare_scenario_strategies, supports_composition, and validate_composition were only used by the deprecated composition path and are gone.
  • Isolated composition to Foundry — RedTeamAgent converts any legacy ScenarioCompositeStrategy inputs to FoundryComposite automatically, so existing callers still work with a deprecation warning.
  • Added FoundryComposite.__post_init__ validation — catches misrouted strategies at construction time (e.g. a converter in the attack slot) with a clear error, rather than failing silently later.
  • Updated scenario docs — removed references to deleted methods and updated composite strategy examples to use FoundryComposite.

No behavioral change to existing scenarios. Passing ScenarioCompositeStrategy to RedTeamAgent still works and produces the same result, with a deprecation warning pointing to FoundryComposite.

@rlundeen2 rlundeen2 marked this pull request as ready for review April 17, 2026 00:30
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.

1 participant