FIX Stop scenario workers when an atomic attack is cancelled - #2851
Merged
Roman Lutz (romanlutz) merged 10 commits intoOct 6, 2026
Merged
Roman Lutz (romanlutz) merged 10 commits into
Roman Lutz (romanlutz) merged 10 commits into
Conversation
This was referenced Sep 25, 2026
Roman Lutz (romanlutz)
requested changes
Sep 28, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Stop queue admission on new supervisor cancellation requests and drain the original gather together with all workers. Cover completion callbacks, ready siblings, repeated cancellation, and same-task resume. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Roman Lutz (romanlutz)
approved these changes
Oct 6, 2026
Retain caller- and worker-originated cancellation regressions alongside main's async-only test readiness and cleanup handling. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Description
When an atomic attack is cancelled,
Scenario.run_async()can return and persistCANCELLEDwhile sibling workers still execute. A ready sibling can also start a queued attack. The scenario must stop admitting work and finish worker cleanup before exposing its terminal state.For example, with concurrency 2, A and B are running and C is queued. If B cancels while A is awaiting target cleanup, A must finish that cleanup and C must never start.
The supervisor now owns cancellation through one controlled path:
finallyblock.Workers also stop admission immediately when cancellation originates inside an atomic attack. Ordinary failures retain the existing behavior: in-flight work may complete and persist, queued work stops, and multiple failures are reported together. This extends the cancellation lifecycle from #2342 without changing retry or completed-result semantics.
Tests and Documentation
Scenario,AtomicAttack,AttackExecutor,PromptSendingAttack, and conversation lifecycle code, with a mocked target. One worker exits quickly while another is held insidereset_conversation_async().IN_PROGRESSuntil cleanup finishes followed byCANCELLEDwith one attempt.make unit-test(Python 3.11, default dependencies): 20,400 passed, 146 skipped, 1 failed. The sole failure is the pre-existingtest_get_seed_dataset_summaries_follows_a_trailing_blank_insensitive_collationintests/unit/memory/memory_interface/test_interface_seed_prompts.py, previously reproduced on unmodified upstream in the same environment.ty check pyrit.To run the cancellation regressions:
Updated the worker-pool docstring to describe cancellation ownership. Tests use local SQLite and controlled target behavior; no live model endpoint was used.