BUG: label queries only return the final conversation of an attack

Fechada Para iniciantes
#3,095 4 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 2 dias

@u7k4rs6 já está trabalhando nisso.

Desde 14/10/2026.

  • #3199 de @u7k4rs6 — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
85/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
databases

Direção de pesquisa

O bug está em _get_message_pieces_memory_label_conditions em sqlite_memory.py e azure_sql_memory.py, onde o join só busca as peças da conversa final de um ataque. Ajuste a condição do join para também corresponder a ConversationEntry.attack_result_id == AttackResultEntry.id, de modo a incluir todas as conversas vinculadas ao resultado do ataque, e depois execute a reprodução com o target simulado fornecido para confirmar que as consultas por rótulo retornam todas as peças esperadas para PromptSendingAttack e RedTeamingAttack.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

get_message_pieces_async(labels=...) only returns pieces from an attack result's final conversation_id. Labels now live on AttackResultEntry, and the condition in _get_message_pieces_memory_label_conditions (sqlite_memory.py and azure_sql_memory.py) only joins on AttackResultEntry.conversation_id == PromptMemoryEntry.conversation_id. Its docstring says it also matches labels on the piece itself, but that branch is gone.

So everything else an attack sent drops out of label queries: PromptSendingAttack retry attempts, Crescendo's pruned conversations, the adversarial chat in RedTeaming, Crescendo and TAP, and every TAP branch except the best one. The memory docs still say labels apply "to all prompts sent by any attack".

This is with mock targets:

PromptSendingAttack(max_attempts_on_failure=2): pieces sent in this attack=6, returned by labels query=2
RedTeamingAttack: objective-conv pieces=4, adversarial-conv pieces=5, returned by labels query=4

The Conversation table already has attack_result_id for these conversations, so one option is to also match when ConversationEntry.conversation_id equals PromptMemoryEntry.conversation_id and ConversationEntry.attack_result_id equals AttackResultEntry.id. Whether adversarial-chat prompts should come back is a design call, since they'd also get picked up by label-based batch scoring, so I'm filing this as an issue first. #3063 touches the same functions for dotted keys.

Linguagem predominante
Python
Estrelas
4.7k
Forks
1k
Merge médio
2d 2h
PRs com merge (30d)
487

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

  • Sem Dockerfile nem arquivo Docker Compose
  • Tem um modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de microsoft/PyRIT

Todas as issues de microsoft/PyRIT

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.