Skip to content

FIX: Persist general technique flag on seed entries (#3739) - #3844

Closed
Hrushikesh Ramilla (Hrushikesh-ramilla) wants to merge 1 commit into
microsoft:mainfrom
Hrushikesh-ramilla:fix/seed-general-technique-persistence-3739
Closed

Hrushikesh Ramilla (Hrushikesh-ramilla) wants to merge 1 commit into
microsoft:mainfrom
Hrushikesh-ramilla:fix/seed-general-technique-persistence-3739

Conversation

@Hrushikesh-ramilla

Copy link
Copy Markdown
Contributor

Resolves #3739.

Summary of Changes

  • Adds typed \is_general_technique\ boolean column to \SeedPromptEntries\ with a \server_default=sa.false()\ legacy default.
  • Persists \entry.is_general_technique\ in \SeedEntry.init\ and restores it in \SeedEntry.get_seed()\ for \SeedPrompt\ and \SeedSimulatedConversation.
  • Projects \is_general_technique\ onto \SeedRecord\ in \SeedEntry.get_seed_record().
  • Adds Alembic revision migrating \SeedPromptEntries\ and backfilling existing simulated conversation records.
  • Adds regression unit tests for \SeedEntry, \SeedRecord, and SQLite \AttackTechniqueSeedGroup\ round-trip identity preservation, as well as migration tests.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 21:52

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.

🟡 Changes recommended

Seed deduplication ignores is_general_technique, silently skipping otherwise identical prompts with opposite flags and preventing technique-group rebuilding when a legacy row defaults to False.

1 open issue
What changed in this PR

This PR addresses #3739 by persisting is_general_technique through PyRIT’s seed storage and retrieval, preserving the flag needed to reconstruct attack technique groups.

Changes:

  • Stores and restores the flag, including its projection onto SeedRecord.
  • Adds a migration with a false legacy default and a simulated-conversation backfill.
  • Adds persistence, identity round-trip, and migration regression tests.
File Description
tests/​unit/​memory/​test_seed_general_technique.py Tests flag persistence and technique-group reconstruction.
tests/​unit/​memory/​test_seed_general_technique_migration.py Tests backfill, downgrade, SQL Server SQL generation, and schema alignment.
tests/​unit/​memory/​test_operations_and_findings_migration.py Upgrades to the latest revision before checking schema alignment.
pyrit/​models/​seeds/​seed_record.py Exposes the flag on seed records.
pyrit/​memory/​memory_models.py Persists and restores the flag in seed mappings.
pyrit/​memory/​alembic/​versions/​064a1eff19fc_add_is_general_technique_to_seed_entries.py Adds the column and backfills simulated conversations.

Review effort: Balanced

self.prompt_group_id = entry.prompt_group_id
self.seed_type = seed_type
self.origin = entry.origin.value
self.is_general_technique = bool(getattr(entry, "is_general_technique", False))
Persist is_general_technique on SeedEntry and project it onto SeedRecord,
reconstructing the execution flag on retrieved seeds and preventing
identity drift or reconstruction errors when restoring technique groups.
Also adds Alembic schema migration and unit regression tests.

Signed-off-by: Hrushikesh Ramilla <ramillahrushikesh@gmail.com>
@Hrushikesh-ramilla
Hrushikesh Ramilla (Hrushikesh-ramilla) force-pushed the fix/seed-general-technique-persistence-3739 branch from 942396f to 250e811 Compare November 2, 2026 22:52
@romanlutz

Copy link
Copy Markdown
Contributor

duplicate of #3785

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.

Saving a general technique seed loses the flag required to rebuild its technique

3 participants