Skip to content

TEST Add Crescendo mixed-failure resilience coverage - #2337

Open
Roman Lutz (romanlutz) wants to merge 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-crescendo-mixed-failure-tests
Open

TEST Add Crescendo mixed-failure resilience coverage#2337
Roman Lutz (romanlutz) wants to merge 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-crescendo-mixed-failure-tests

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

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: CancelledError propagated correctly, but task-local retry collector state remained installed. Strategy execution now clears a started collector in finally, 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 passed
  • uv 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 passed
  • uv run --no-sync ruff check . - passed
  • uv 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 - passed
  • uv 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 - passed

Documentation and JupyText: N/A; this change adds unit coverage and a lifecycle cleanup fix without changing public APIs or documentation behavior.

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
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.

2 participants