Repository navigation
FIX: run unstarted attacks before failed ones on resume - #4298
Chen Yufeiyang (feiiiiii5) wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change prioritizing unstarted attacks on retry and resume.
No open issues 🎉
What changed in this PR
This PR addresses #4158 by prioritizing unstarted atomic attacks on retry and resume, preventing a repeatedly failing attack from blocking untouched work.
Changes:
- Track completed objectives and started attacks from the same persisted result snapshot.
- Queue unstarted attacks first while preserving order within each group and leaving stop-on-failure behavior unchanged.
- Add a regression test for retry ordering.
| File | Description |
|---|---|
tests/unit/scenario/core/test_scenario_retry.py |
Tests that unstarted attacks are queued before a previously failed attack. |
pyrit/scenario/core/scenario.py |
Tracks started attacks and reorders remaining work without changing completed-objective filtering. |
Review effort: Balanced
|
The only failing check is |
de03e72 to
609fff4
Compare
|
Good catch — a healthy half-finished attack was being demoted with the failed one. I cherry-picked your commit ( Thanks for including the test with the fix. |
hannahwestra25
left a comment
There was a problem hiding this comment.
Three inline findings from the external-contribution review.
hannahwestra25
left a comment
There was a problem hiding this comment.
Re-checked at 3269678. The compound-child and duplicate-name fixes hold, with tests. Four new notes are inline; the ordering one still lets failed attacks starve each other.
|
Thanks hannahwestra25 — the last gap you confirmed is fixed in
Verification: For the earlier items: the parameter-construction marker and the compound-child exclusion were explicitly scoped out per your "keep this PR scoped" note, and the set was already renamed to |
hannahwestra25
left a comment
There was a problem hiding this comment.
Re-checked at da1ab23. The namesake count fix holds, and the new test fails without it. Failed attacks still starve each other on retry, and the rename, wrapper, and test notes remain open. One small note inline.
da1ab23 to
44dcf4b
Compare
|
Thanks for the follow-ups. At the new head I removed the stale |
…R-then-SUCCESS skip Per maintainer review on microsoft#4298: - test_failed_attacks_rotate_by_latest_pending_failure now appends a second ERROR row for the retried attack instead of editing the first row's timestamp, so max-vs-min in failure-rank is distinguished. - add test_error_then_success_objective_is_not_a_pending_failure covering the skip at line 2603: a later non-error row for the same objective means the objective is no longer pending, so a stale ERROR must not demote the attack while it still has pending work.
|
Addressed the test gap in Also added Pushed |
hannahwestra25
left a comment
There was a problem hiding this comment.
Thanks for contributing!
A legacy name-only failure stays ambiguous when one same-name attack has completed. Count names over all atomic attacks so the surviving namesake is not demoted for a failure that belonged to the finished one.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…R-then-SUCCESS skip Per maintainer review on microsoft#4298: - test_failed_attacks_rotate_by_latest_pending_failure now appends a second ERROR row for the retried attack instead of editing the first row's timestamp, so max-vs-min in failure-rank is distinguished. - add test_error_then_success_objective_is_not_a_pending_failure covering the skip at line 2603: a later non-error row for the same objective means the objective is no longer pending, so a stale ERROR must not demote the attack while it still has pending work.
a934042 to
0e11571
Compare
Description
On retry/resume,
_get_remaining_atomic_attacks_asynckeeps the original planned order. If the first remaining attack has one objective that always raises, it reachesstop_eventevery run before admission moves on, so the attacks behind it never start. With 6 attacks × 4 objectives, the run keeps sending the same 3 healthy objectives and 15 of 18 healthy objectives are never tried._get_attack_progress_asyncnow returns completed hashes plus the latest still-pending failure timestamp for each(parent_collection, parent_eval_hash). OnlyERRORand preparation-failure rows whose objective is still pending count as failures; merely started or interrupted attacks do not get demoted._get_completed_objective_hashes_by_attack_asyncwrapper and let tests unpack_get_attack_progress_async()directly.This makes retries progress: after
t1fails,t2–t6run first; ift2also fails, the next retry starts att3. A fresh failure still stops admission for the rest of that run. Parameter-construction failures that persist no result row remain a separate follow-up, as agreed in review.Validation: the retry-ordering tests cover unstarted-before-failed ordering, interrupted and compound-child rows, duplicate names, legacy name-only rows, preparation failures and failure rotation: 32 passed. Ruff check and format pass.
Fixes #4158.