Repository navigation
FIX: Persist is_general_technique on seeds to preserve technique reconstruction (#3739) - #3785
Open
Yogyabhilash wants to merge 2 commits into
Open
Yogyabhilash wants to merge 2 commits into
Yogyabhilash wants to merge 2 commits into
Conversation
…nstruction (microsoft#3739) When SeedEntry persisted SeedPrompt or SeedSimulatedConversation, it omitted is_general_technique. Consequently, retrieving seeds from memory restored is_general_technique=False by default. This altered seed hashes and caused ValidationError when reconstructing AttackTechniqueSeedGroup from stored seeds. This change: - Adds is_general_technique boolean column to SeedPromptEntries via Alembic migration e7a1b3c5d9f0. - Persists and restores is_general_technique on SeedEntry and SeedRecord. - Adds is_general_technique filtering and group key inclusion in MemoryInterface. - Adds comprehensive unit and migration tests. Closes microsoft#3739
Yogyabhilash
marked this pull request as ready for review
November 1, 2026 15:11
This branch has not been deployed
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
When
SeedPromptorSeedSimulatedConversationare saved into memory viaSeedEntry, theis_general_techniqueattribute was not persisted. As a result, when seeds were retrieved back from memory,is_general_techniquedefaulted toFalse. This altered the seed's hash/content identifier and causedValidationErrorwhen reconstructing anAttackTechniqueSeedGroupfrom stored seeds (which requiresis_general_technique=Trueon all constituent seeds).Problem & Root Cause
SeedPrompthasis_general_technique: bool, which is included inSeedIdentifier.content_hash().SeedEntryinpyrit/memory/memory_models.pyomittedis_general_techniquefrom theSeedPromptEntriestable schema,__init__,get_seed_record(), andget_seed().AttackTechniqueSeedGroupviaget_seed_groups_asyncfailed validation because reconstructed seeds hadis_general_technique=False.Solution
e7a1b3c5d9f0_add_seed_is_general_technique.py(revisingc8d3e5f7a901) addingis_general_techniqueboolean column toSeedPromptEntrieswithserver_default=0.SeedEntrymapped column, constructor, and reconstruction methods (get_seedandget_seed_record).SeedRecordinpyrit/models/seeds/seed_record.pyandfrontend/src/types/index.ts.is_general_techniqueinMemoryInterface._seed_group_member_keyand exposedis_general_techniquefiltering across seed and seed group query and deletion methods.Closes #3739
Tests and Documentation
tests/unit/memory/test_seed_is_general_technique_migration.py:tests/unit/memory/test_seed_general_technique.py:AttackTechniqueSeedGroupfrom SQLite memory.SeedSimulatedConversationwithis_general_technique=True.is_general_techniqueon individual seeds and seed groups.tests/unit/memory/test_memory_models.py:SeedEntryroundtrip preservesis_general_technique.tests/unit/memory/test_operations_and_findings_migration.pyto run migration before schema check.pytest tests/unit/memory/test_seed_general_technique.py tests/unit/memory/test_seed_is_general_technique_migration.py tests/unit/memory/test_operations_and_findings_migration.py tests/unit/memory/test_memory_models.py(96 passed)pytest tests/unit/memory/test_migration.py -k "test_seed_conditions_and_follow_up_template_migrations_merge or test_run_schema_migrations_applies_head_revision"(3 passed)ruff check(0 errors)ruff format --check(clean)ty check pyrit/memory pyrit/models/seeds tests/unit/memory(clean)