Skip to content

PR Breaking MAINT: Moving Role Play Attack to Technique#2160

Open
rlundeen2 wants to merge 9 commits into
microsoft:mainfrom
rlundeen2:rlundeen2-role-play-simulated-conversation
Open

PR Breaking MAINT: Moving Role Play Attack to Technique#2160
rlundeen2 wants to merge 9 commits into
microsoft:mainfrom
rlundeen2:rlundeen2-role-play-simulated-conversation

Conversation

@rlundeen2

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2155. Migrates the role-play attacks (all 5 personas) from the standalone RolePlayAttack executor to core simulated-conversation techniques, and tunes the final-turn prompt so the attacks actually land against robust targets.

What changed

  • Removed the standalone RolePlayAttack executor (single_turn/role_play.py) and its tests.
  • Migrated the 5 personas (movie script, video game, trivia game, persuasion, persuasion written) to AttackTechniqueFactory.with_simulated_conversation, registered in the core technique catalog.
  • Reorganized the persona YAMLs into datasets/executors/red_teaming/role_play/.
  • Added a role-play-aware next-message prompt (simulated_target/role_play_next_message.yaml). The shared direct_next_message prompt broke the fiction on the final turn (asking for the raw / real-life objective), which targets refused. The new prompt keeps the last message in character and delivers the same objective as the next in-world beat.
  • Wired the 3 inline scenario constructors (scam, jailbreak, psychosocial) to the new persona paths + next-message prompt, and added a non-None objective_target guard in psychosocial to match scam/jailbreak.
  • Updated scenarios, scanner/doc notebooks, and tests accordingly.

Validation

  • pre-commit (ruff, ty, yaml, etc.): all pass.
  • Unit tests for technique initializer, scam, jailbreak, rapid_response, psychosocial, text_adaptive: all pass.
  • Ran the techniques live against a gpt-4o adversarial + gpt-4o target: the simulated conversations elicit the objective, and the new next-message prompt keeps every final message in character (movie_script and persuasion_written succeed; others depend on target robustness).

Note: this PR is intended to be a breaking, standalone change from the squashed #2155.

rlundeen2 and others added 6 commits July 9, 2026 18:10
Remove RolePlayAttack/RolePlayPaths and reimplement all five role-play personas as with_simulated_conversation core techniques (role_play_movie_script, role_play_video_game, role_play_trivia_game, role_play_persuasion, role_play_persuasion_written). Update scenario defaults, inline constructors (jailbreak/scam/psychosocial), CLI help, tests, and docs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Group the five role_play_* adversarial system-prompt YAMLs under a
dedicated red_teaming/role_play/ subdirectory and pass an explicit
adversarial_chat_system_prompt_path everywhere the simulated-conversation
factory is built (core catalog + the jailbreak/scam/psychosocial inline
constructors), since the factory default resolves to red_teaming/{name}.yaml.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…essage prompt

The shared direct_next_message prompt broke the role-play frame on the final turn (asking for the raw objective / real-life instructions), which robust targets refused. Add a role-play-aware next-message system prompt that stays in the established fiction, delivers the same objective as the next in-world beat, and never breaks character. Wire the 5 role_play core factories and the 3 inline scenario constructors (scam, jailbreak, psychosocial) to it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… create

Add the same non-None objective_target guard used by scam and jailbreak so the migrated role-play simulated-conversation .create() call type-checks (ty).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…-migration

Regenerate the 0_attack_techniques catalog table so it lists the 5 role_play_* simulated-conversation techniques (PromptSendingAttack) instead of the removed RolePlayAttack, and correct the scam scenario RolePlay docstring to describe the simulated role-play conversation and current YAML name.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@jbolor21 jbolor21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny comment but otherwise lgtm!

Comment thread doc/code/framework.md Outdated
rlundeen2 and others added 3 commits July 10, 2026 18:51
Reword the parenthetical so it clearly states the anti-pattern: an executor assembling its own prompt scaffolding is attack-technique work bleeding into the executor (per jbolor21 review feedback).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…onversation

# Conflicts:
#	pyrit/executor/attack/single_turn/role_play.py
#	pyrit/scenario/scenarios/airt/jailbreak.py
#	pyrit/scenario/scenarios/airt/psychosocial.py
#	tests/unit/executor/attack/single_turn/test_role_play.py
…onversation

# Conflicts:
#	doc/code/scenarios/0_attack_techniques.ipynb
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.

3 participants