FIX Correlate multi-turn attack error results - #2322
Open
romanlutz wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0d1f97bd-49a5-4a6d-b814-fecef1e2a8cb
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
PR #1720 added generic persistence for uncaught attack exceptions. That handler looked for
context.conversation_id, which is correct forSingleTurnAttackContext, but multi-turn attacks store the active ID atcontext.session.conversation_id. For every terminal multi-turn exception, the lookup therefore failed and the handler generated a new UUID.If turns had already been stored under conversation A, the resulting
AttackOutcome.ERRORrow was persisted under unrelated conversation B:AttackResultwas valid but incorrectly referenced B.conversation_idis a string rather than a foreign key, and a legitimate attack may fail before writing any messages.This is logical record corruption rather than malformed rows or lost message data. It affects only uncaught terminal exceptions in multi-turn attacks since #1720; successful attacks, ordinary non-exception outcomes, and single-turn errors are unaffected. Existing affected rows cannot be repaired safely in a general migration because a generated ID from this bug is indistinguishable from a legitimate pre-first-message failure without attribution, logs, or other execution evidence identifying the original conversation.
This change resolves the conversation ID from the direct context field first, then from the multi-turn conversation session, retaining UUID generation only for contexts that expose neither layout.
Tests and Documentation
MultiTurnAttackContextandConversationSessionto verify timeout error results retain the active conversation ID.ty, repository commit hooks, andgit diff --checkpassed.