Skip to content

FIX Atomic branch persistence - #2740

Merged
Roman Lutz (romanlutz) merged 4 commits into
microsoft:mainfrom
romanlutz:romanlutz-n-send-phase-1-branching
Sep 23, 2026
Merged

Roman Lutz (romanlutz) merged 4 commits into
microsoft:mainfrom
romanlutz:romanlutz-n-send-phase-1-branching

Conversation

@romanlutz

@romanlutz Roman Lutz (romanlutz) commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

Branch creation previously persisted copied history separately from attack membership. A failure could leave orphaned copies, and concurrent branch additions or promotion could overwrite conversation references. This makes those operations atomic as phase 1 of the n-send split plan.

  • Persist prepared conversation metadata, copied message pieces, converter/target identifier links, and attack membership in one transaction. Failures roll back the complete operation.
  • Serialize reference updates with a no-op parent-row UPDATE before reading membership. This avoids relying on SELECT FOR UPDATE, which does not provide the required protection on SQLite.
  • Integrate the existing create/promote operations with the atomic helpers. Preserve main-plus-PRUNED membership, diagnostic promotion restrictions, multipart ordering, and original_prompt_id lineage.
  • Preserve the known target when branching an unregistered empty history. Compare canonical target identity so version-only differences do not block nested branching after upgrades, while actual target changes remain conflicts.

Scope: two implementation files and two test files. Existing single-send code and fixtures are unchanged. No sending API, scheduler, asynchronous/repeat-send infrastructure, frontend, schema migration, or dependency changes are included.

Tests and Documentation

  • 460 focused tests passed across branching, SQLite, memory insertion/identifiers/attack results, AttackService, and PromptNormalizer, including existing single-send coverage.
  • Real SQLite tests cover rollback of copied pieces, metadata, references, and new identifiers; empty histories; multipart ordering; nested lineage; and source/promotion validation. The ten-thread branch-addition/promotion regression also passed five additional repeated runs after the final fixes.
  • Both target-metadata regression cases failed before their fixes and passed afterward: first sends following empty-history branching, and nested branching across PyRIT versions. Sending uses MockPromptTarget, with no remote model calls.
  • The write guard compiles for SQLite and MSSQL. Live SQL Server execution was not exercised.
  • Ruff, production and changed-test type checks, and all applicable pre-commit hooks passed.
  • Updated the conversation-registration documentation to describe identity-based matching across PyRIT versions.

JupyText: N/A, no notebooks changed.

Persist prepared histories, conversation metadata, identifiers, and attack membership in one transaction. Serialize branching and promotion with a portable parent-row UPDATE guard, and integrate existing create/promote operations without changing the send path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve a missing source conversation's target from its attack before atomically persisting an empty branch. Compare registered target identifiers by canonical identity so version-only differences do not reject nested copies, while real target changes remain conflicts.

Add real-memory regressions for first sends after empty branching and nested branching across PyRIT versions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Looks great!

Preserve the branching regression import alongside main's shared-pagination test imports. Keep both test suites and the existing atomic branching changes intact.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Sep 23, 2026
Merged via the queue into microsoft:main with commit 79d9eb4 Sep 23, 2026
49 checks passed
@romanlutz
Roman Lutz (romanlutz) deleted the romanlutz-n-send-phase-1-branching branch September 23, 2026 17:06
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.

3 participants