Repository navigation
FIX: preserve child-result links when execution fails in SequentialAttack - #3048
Merged
Roman Lutz (romanlutz) merged 3 commits intoOct 9, 2026
Conversation
When a child of SequentialAttack raises, the child error result is persisted, but the orchestration parent's error result did not retain metadata['child_attack_result_ids'], losing references to earlier children that completed before a later child failed. The generic strategy error path now records the persisted error result's id on the exception and merges exception-attached metadata into the error result (consumed so outer orchestrators don't re-merge stale links). SequentialAttack attaches the ids of children that produced stored results -- completed children in dispatch order plus the failed child's persisted error result -- and re-raises unchanged, preserving exception propagation, outcome semantics, and retry/resume behavior. Fixes microsoft#3039
Contributor
Author
|
@microsoft-github-policy-service agree |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Track confirmed result IDs in each attack context and return them with incomplete executor objectives. Keep compound failure metadata local to its execution, verify uncertain writes without retrying, and preserve original exceptions and nested child links. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Roman Lutz (romanlutz)
approved these changes
Oct 9, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 9, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 9, 2026
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.
Fixes #3039.
When a child of
SequentialAttackraises, the child error result is persisted, but the orchestration parent's error result did not retainmetadata["child_attack_result_ids"]— losing references to earlier children that completed before a later child failed, and to the failed child itself.What changed
pyrit/executor/attack/core/attack_strategy.py— the generic strategy error path (_on_error_async) now:attack_result_idon the exception, so a catching orchestrator can link the failed child's stored result;pyrit/executor/core/strategy.py— when the execution wrapper re-raises as_StrategyRuntimeError, it propagates the persisted error-result id so orchestrators don't have to walk the cause chain.pyrit/executor/attack/compound/sequential_attack.py—_perform_asynccatches a child failure, attaches the ids of children that produced stored results (completed children in dispatch order, plus the failed child's persisted error result id), and re-raises unchanged.pyrit/exceptions/exception_context.py— the two exception-attribute constants, following the existing pattern of carrying failure context on the exception.Per the issue's constraints: exception propagation is preserved (the child error still raises, verified by the tests), no thrown exception is turned into a returned error result, dispatch order is preserved, no ids are invented for children that never produced a stored result, and nested compounds link each level hierarchically.
Tests
New
TestChildFailurePreservesLinksintests/unit/executor/attack/compound/test_sequential_attack.pyuses real strategies, the realAttackExecutor, and SQLite memory (no live targets):Verified fail-first (new tests fail on unmodified base), then 55/55 in the compound test file, 275 passed across executor core/compound + exceptions suites, ruff check and format clean. The 2 failed / 13 errored tests in
tests/unit/executor/attack/streamingandmulti_turnare pre-existing on the base (missing optional deps), unrelated to this change.AI disclosure
This contribution was developed with AI assistance (Muse). I reviewed and tested all changes; the fix was verified fail-first with real SQLite-backed execution as described above.