Skip to content

FEAT: Run atomic attacks in parallel (better) within a scenario#1783

Draft
rlundeen2 wants to merge 1 commit into
microsoft:mainfrom
rlundeen2:users/rlundeen/05_22_scenario_parallel
Draft

FEAT: Run atomic attacks in parallel (better) within a scenario#1783
rlundeen2 wants to merge 1 commit into
microsoft:mainfrom
rlundeen2:users/rlundeen/05_22_scenario_parallel

Conversation

@rlundeen2
Copy link
Copy Markdown
Contributor

Previously, scenarios could somewhat run in parallel within an atomic attack.

This allows multiple atomic attacks in a scenario to run concurrently, driven by the existing max_concurrency parameter. All in-flight objectives across all atomic attacks share a single asyncio.Semaphore(max_concurrency), so the global concurrent-objective budget is bounded by max_concurrency regardless of how work is distributed across atomic attacks. A long-running attack can elastically use slots freed by short-running siblings.

@rlundeen2 rlundeen2 force-pushed the users/rlundeen/05_22_scenario_parallel branch from c9926be to 22fb8b5 Compare May 23, 2026 01:34
Allow multiple atomic attacks in a scenario to run concurrently, driven by the
existing max_concurrency parameter. All in-flight objectives across all atomic
attacks share a single asyncio.Semaphore(max_concurrency), so the global
concurrent-objective budget is bounded by max_concurrency regardless of how
work is distributed across atomic attacks. A long-running attack can elastically
use slots freed by short-running siblings.

Changes:
- AttackExecutor now accepts an optional external semaphore kwarg. When
  provided, it gates both seed-group parameter building and per-objective
  execution, letting a parent (e.g. Scenario) share one budget across many
  executors.
- AtomicAttack.run_async forwards the optional semaphore to its executor.
- Scenario._execute_scenario_async: when max_concurrency > 1 and more than one
  atomic attack remains, creates one shared semaphore and launches every
  remaining atomic attack via asyncio.gather, all sharing that semaphore.
  When max_concurrency == 1 (or only one attack remains), keeps the existing
  sequential loop verbatim, preserving abort-on-first-failure semantics.
- Parallel failure mode uses gather(return_exceptions=True) so in-flight
  siblings finish before the first error is re-raised (preserves partial work
  for resume).
- No new user-facing parameters or CLI flags.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rlundeen2 rlundeen2 force-pushed the users/rlundeen/05_22_scenario_parallel branch from 22fb8b5 to b3bd470 Compare May 23, 2026 01:40
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