Skip to content

FIX Count only rendered goals toward ComicJailbreak max_examples - #3590

Merged
Richard Lundeen (richlundeen) merged 2 commits into
microsoft:mainfrom
ShivamSharma43:fix/comic-jailbreak-max-examples
Oct 29, 2026
Merged

Richard Lundeen (richlundeen) merged 2 commits into
microsoft:mainfrom
ShivamSharma43:fix/comic-jailbreak-max-examples

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Description

Fixes #3589.

_ComicJailbreakDataset counted every goal it looked at toward max_examples, including goals that have no text for any selected template and render nothing. Most goals have no Code text (213 of 300), so templates=["code"], max_examples=10 rendered no goal and failed with SeedDataset cannot be empty, and templates=["instruction"], max_examples=10 rendered 2 goals. The cap was also checked only after a goal was rendered, so max_examples=0 still rendered one goal.

Changes:

  • A goal counts toward max_examples only when it rendered at least one template.
  • __init__ raises ValueError when max_examples is below 1. 0 cannot work, because an empty SeedDataset is invalid. The docstring now states both rules.

Tests and Documentation

  • tests/unit/datasets/test_comic_jailbreak_dataset.py: with templates=["code"], max_examples=2, the goals without Code text are skipped and the next two goals with Code text are rendered; max_examples of 0 and -1 are rejected. These tests fail on main; the existing max_examples test is unchanged.
  • Ran the reproduction from BUG: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 fails #3589 against the real dataset: 10 goals for code and for instruction, and max_examples=0 raises.
  • pytest tests/unit/datasets/test_comic_jailbreak_dataset.py: 38 passed.
  • ruff check, ruff format and ty check pass on the changed files.
  • No documentation changes beyond the docstring.

🤖 Generated with Claude Code

A goal with no text for any selected template rendered nothing but still
counted toward max_examples. Most goals have no Code text, so
templates=["code"] with max_examples=10 rendered no goal at all and
failed with "SeedDataset cannot be empty"; templates=["instruction"]
rendered 2. The cap was also checked only after a goal was rendered, so
max_examples=0 still rendered one goal. Count only goals that rendered
something, and reject max_examples below 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 10:41

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

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.

Only goals that produce seeds now count toward max_examples. The regression case covers empty template text before valid goals, and invalid limits are rejected.

No blocking issues found by code inspection. Tests were not run for this review. AI-assisted review (GitHub Copilot).

@richlundeen
Richard Lundeen (richlundeen) added this pull request to the merge queue Oct 29, 2026
Merged via the queue into microsoft:main with commit 4a1b2b2 Oct 29, 2026
65 checks passed
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: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 fails

3 participants