TEST Add Crescendo mixed-failure resilience coverage - #2337
Open
Roman Lutz (romanlutz) wants to merge 1 commit into
Open
TEST Add Crescendo mixed-failure resilience coverage#2337Roman Lutz (romanlutz) wants to merge 1 commit into
Roman Lutz (romanlutz) wants to merge 1 commit into
Conversation
Exercise a deterministic ten-turn workflow plus terminal retry, scorer, and cancellation boundaries. Clear retry collector state when strategy execution is cancelled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f742b92-0427-45a9-924f-3fedeb8b915a
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
Crescendo had strong branch-level tests but lacked a realistic long-running test proving that state remains correct when multiple recoverable failures and refusals occur across one conversation.
This adds a deterministic 10-executed-turn workflow covering malformed adversarial JSON retry, target rate limiting, refusal backtracking and recovery, reconnect behavior, retry-budget exhaustion behavior, scorer inputs, conversation branching, memory persistence, duplicate prevention, and final result correctness. Incompatible terminal cases are kept separate for scorer failure, malformed JSON exhaustion, target retry exhaustion, and cancellation.
The cancellation test exposed a generic lifecycle bug:
CancelledErrorpropagated correctly, but task-local retry collector state remained installed. Strategy execution now clears a started collector infinally, preserving cancellation propagation and teardown behavior. This does not change Scenario ownership, conversation-ID behavior, or target retry policy.Tests and Documentation
uv run --no-sync pytest -q tests\unit\executor\attack\multi_turn\test_crescendo_resilience.py tests\unit\executor\attack\core\test_attack_strategy.py- 51 passeduv run --no-sync pytest -q tests\unit\executor\attack\multi_turn\test_crescendo.py tests\unit\prompt_normalizer\test_json_retry.py tests\unit\scenario\core\test_scenario_retry.py tests\unit\exceptions\test_retry_collector.py tests\unit\exceptions\test_exceptions.py- 136 passeduv run --no-sync ruff check .- passeduv run --no-sync ruff format --check pyrit\executor\core\strategy.py tests\unit\executor\attack\core\test_attack_strategy.py tests\unit\executor\attack\multi_turn\test_crescendo_resilience.py- passeduv run --no-sync ty check pyrit\executor\core\strategy.py tests\unit\executor\attack\core\test_attack_strategy.py tests\unit\executor\attack\multi_turn\test_crescendo_resilience.py- passedDocumentation and JupyText: N/A; this change adds unit coverage and a lifecycle cleanup fix without changing public APIs or documentation behavior.