Skip to content

FIX: Forward the previous image to single-turn targets in TAP - #4225

Open
ni (nniiovoo) wants to merge 1 commit into
microsoft:mainfrom
nniiovoo:fix/tap-single-turn-media
Open

ni (nniiovoo) wants to merge 1 commit into
microsoft:mainfrom
nniiovoo:fix/tap-single-turn-media

Conversation

@nniiovoo

Copy link
Copy Markdown
Contributor

Description

TAP never attached the previous image for targets without multi-turn support, because each send moved to a fresh, empty conversation before checking whether it was the first turn. This checks the turn first, so TAP forwards the image the way RedTeamingAttack already does for the same targets.

Fixes #4224

  • Read the turn index before _rotate_unseeded_single_turn_conversation() switches the node to a fresh conversation.
  • Run the existing "forwards previous image" node test for a single-turn target as well.

With a single-turn image target and tree_depth=2, the requests were [['text'], ['text']] before and are [['text'], ['text', 'image_path']] after.

For a target without multi-turn support, a TAP node moves to a fresh
conversation before each send and only then checks whether this is the
first turn. The new conversation is always empty, so every send counts
as turn 0 and TAP drops the previous image from later prompts, even
when the stateless target accepts image input. A target that requires
an image fails at depth 2 with "Objective target does not accept
text-only input on turn 0". RedTeamingAttack forwards the image to the
same targets.

Check the turn before moving to the fresh conversation.

Signed-off-by: NNIIOVO <haimingni44@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 23:28

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

🟢 Approval recommended

No active review issues were identified for the TAP image-forwarding change.

No open issues 🎉

What changed in this PR

Fixes #4224 by allowing TAP to forward the previous image to single-turn targets, aligning its modality feedback behavior with RedTeamingAttack.

Changes:

  • Determine the turn index before rotating to a fresh conversation.
  • Extend the existing image-forwarding regression test to cover both single-turn and multi-turn targets.
File Description
tests/​unit/​executor/​attack/​multi_turn/​test_tree_of_attacks.py Parameterizes image-forwarding coverage by target multi-turn support.
pyrit/​executor/​attack/​multi_turn/​tree_of_attacks.py Checks the turn before conversation rotation so subsequent requests retain image feedback.

Review effort: Balanced

This branch has not been deployed

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

BUG: TAP never sends the previous image back to single-turn targets

2 participants