Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

BUG: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 fails

Đang mở Phù hợp với người mới
#3,589 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@ShivamSharma43 đang làm issue này rồi.

Từ ngày 27/10/2026.

  • #3590 của @ShivamSharma43 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Đọc pyrit/datasets/seed_datasets/remote/comic_jailbreak_dataset.py, đặc biệt là _fetch_dataset_async, và theo dõi cách đếm các mục tiêu đối chiếu với max_examples khi thiếu văn bản mẫu đã chọn. Trước tiên, hãy kiểm tra các trường hợp được báo cáo cho code, instruction và giới hạn bằng không. Hoàn tất khi giới hạn đếm các mục tiêu đã render và các giá trị nhỏ hơn 1 gây ra ValueError đã nêu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug

_ComicJailbreakDataset (pyrit/datasets/seed_datasets/remote/comic_jailbreak_dataset.py) documents max_examples as the "maximum number of source goals to render", but _fetch_dataset_async counts every goal it looks at, including goals that have no text for any of the selected templates and so render nothing. In the dataset, 213 of the 300 goals have no Code text, 61 have no Instruction text and 59 have no Speech text, so the cap is used up by goals that produce no seeds:

  • templates=["code"], max_examples=10: none of the first 10 goals has Code text, so nothing is rendered and loading fails with SeedDataset cannot be empty.
  • templates=["instruction"], max_examples=10: only 2 goals are rendered.

The cap is also checked only after a goal has been rendered, so max_examples=0 (or a negative value) still renders one goal.

Steps/Code to Reproduce
import asyncio

from pyrit.datasets.seed_datasets.remote.comic_jailbreak_dataset import _ComicJailbreakDataset
from pyrit.models import SeedObjective
from pyrit.setup.initialization import IN_MEMORY, initialize_pyrit_async


async def main():
    await initialize_pyrit_async(memory_db_type=IN_MEMORY)
    for templates, max_examples in ((["code"], 10), (["instruction"], 10), (["article"], 0)):
        try:
            loader = _ComicJailbreakDataset(templates=templates, max_examples=max_examples)
            dataset = await loader.fetch_dataset_async(cache=False)
        except ValueError as e:
            print(f"templates={templates} max_examples={max_examples}: ValueError: {str(e).splitlines()[0]}")
            continue
        goals = {s.value for s in dataset.seeds if isinstance(s, SeedObjective)}
        print(f"templates={templates} max_examples={max_examples}: {len(goals)} goals")


asyncio.run(main())
Expected Results

max_examples goals are rendered for each template, and a cap below 1 is rejected:

templates=['code'] max_examples=10: 10 goals
templates=['instruction'] max_examples=10: 10 goals
templates=['article'] max_examples=0: ValueError: max_examples must be at least 1 or None, got 0
Actual Results
templates=['code'] max_examples=10: ValueError: 1 validation error for SeedDataset
templates=['instruction'] max_examples=10: 2 goals
templates=['article'] max_examples=0: 1 goals

The first error is SeedDataset cannot be empty.

Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (6224d531) in editable mode
Ngôn ngữ chính
Python
Star
4.7k
Fork
980
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
422

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/PyRIT

Tất cả issue của microsoft/PyRIT

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.