FIX Scope request converters by prepended message role - #2359
FIX Scope request converters by prepended message role#2359Roman Lutz (romanlutz) wants to merge 12 commits into
Conversation
Default prepended request conversion to user history and restrict Jailbreak composition to explicitly compatible direct techniques. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate the original request converter scoping fix on current main while preserving its history. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply request converters to role-separated prepended history before flattening, while preventing the resulting request from being converted twice. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Explain which factories opt in, what callers append, and why constructor support alone does not guarantee safe converter composition. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Fail clearly when role-scoped converters produce non-text prepended history that string normalization cannot preserve. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Reuse prepared non-chat requests across retries and preserve converter piece indexes when applying role-scoped prepended conversion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Limit inline jailbreak-template conversion to the scenario-owned prompt_sending delivery. Keep native system-prompt delivery separate and remove the now-unnecessary cross-technique composition capability. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Integrate the latest mainline changes while preserving the converter-scoping branch history and behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Restore the exact origin/main blob after the merge's line-ending check normalized this unrelated file. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Document why non-chat history is converted before flattening, why original and wire views stay separate, and how retry and piece-index safeguards work. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Build the reusable Bijection technique foundation on top of PR microsoft#2359's request-converter scoping and non-chat flattening behavior. Remove the parallel convert_new_user_prompts_only flag and express Bijection-style prepended-context preservation through PrependedConversationConfig(apply_converters_to_roles=[]). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6776aa95-0924-4967-a056-e5a228af3faa
Richard Lundeen (rlundeen2)
left a comment
There was a problem hiding this comment.
Overall I think we can make this a lot smaller. The actual bug is narrow: request converters can rewrite simulated assistant history when an attack supplies a prepended conversation. It's easy to hit with context_compliance, where the jailbreak's TextJailbreakConverter ends up rewriting the fake assistant turns. So to me this is about which messages we convert, not new machinery — and I don't think we need to touch ConversationManager or put state on Message.
Here's the direction I'd like instead:
- PrependedConversationConfig stays the sole policy for prepended history. It already picks which roles get converters (
apply_converters_to_roles) and which normalizer flattens history. If we default that to["user"], the assistant-history bug is basically fixed on its own — assistant history is simulated target output, so you have to opt in with["assistant"]to touch it. If we ever need more control over prepended history, we add it here. - StrategyConverterConfig gets a way to scope a converter to the first turn. This decides which messages a converter applies to, exactly like
apply_converters_to_rolesalready does. And because it's declarative it rides in the attack identifier, so resume/eval stay deterministic for free. - Optional implementation detail We can derive "first turn" straight from memory if we want — without threading anything new through the attacks. The normalizer already has the
conversation_idand a memory handle, so it can just ask: has the target actually replied yet? Define first-turn as "no realassistantmessage in this conversation" (prepended turns are stored assimulated_assistant, so they don't count). The nice thing is every case falls out correctly, including the tricky ones — e.g. on aprompt_sendingretry we spin up a fresh conversation, so the jailbreak is correctly re-applied, whereas a naive per-send counter would drop it. Multi-turn continuations (Crescendo, TAP nodes copied from a parent) already have a real assistant reply, so they're correctly not re-wrapped. - Jailbreak scenario: I still like
prompt_sendingandjailbreak_system_promptas the defaults. We could add one or two more to show off the scoping (e.g. role play with the jailbreak on the system prompt, orcontext_compliancewith the jailbreak only on the first live turn). But I don't think we should just include all techniques (like how they were before this PR) — they're all a bit different, and the jailbreak locus isn't the same for each. If we do role play, is the jailbreak on the system prompt, the first turn, or every turn? That should be a deliberate choice per technique, which is exactly why the scope belongs on the config.
Net: ConversationManager keeps applying the converter list it's given (role-filtered), no eager conversion, and no _request_converters_applied marker on Message. For non-chat targets we go back to today's behavior — flatten history, prepend it, let the live send convert the block. Unless I'm missing something, that's the whole change.
|
Richard Lundeen (@rlundeen2) I like The proposal would work if converter scope were applied while the conversation was still structured, before target normalization/flattening. That requires either the bridge in this PR or a larger pipeline change that introduces structured history adaptation and applies origin/role/turn scope before normalization. So I think |
|
Good catch, I think ConversationManager existed before target capabilities and it shouldn't do message normalization anymore. Agreed with the issue with ConversationManager flattening things. But I don't agree with this: "a larger pipeline change that introduces structured history adaptation" because it's already built and wired. I think the following would be tighter/less error-prone and not significantly more complicated than the current approach of adding converters to the conversation manager.
So the shape I'd like to land on:
One wrinkle is multi turn (but not editable) targets like playwright will need to squash but not squash previous turns. But that's the idea that Also worth noting: |
|
But this means normalization happens in the target, and history represents something different, right? History may show 8 turns of prompt/response but it's perhaps a non-editable history target so everything gets squashed into a single prompt. History should reflect that. Unless I'm misunderstanding. |
Description
Request converters could rewrite simulated assistant history when an attack supplied a prepended conversation. This was especially easy to trigger when the AIRT Jailbreak scenario attached its template converter to conversation-based techniques such as
context_compliance.This change makes converter application role-aware and keeps that scoping intact across chat and non-chat targets:
prompt_sendingdelivery. Native system-prompt delivery remains a separate converter-free path.Tests and Documentation
main.