Skip to content

Judgment replay accepts a changed target schema-normalization template despite its exact-configuration contract #3753

Open

Description

@romanlutz

Describe the bug

A target-backed judgment can be replayed after its target's schema-normalization instructions change, even though the new template changes the judge's effective behavior.

Steps/Code to Reproduce

Use otherwise identical local targets with different JsonSchemaNormalizer templates and SelfAskTrueFalseScorer instances. Score through A, then ask B to replay A's stored observation; compare with fresh B scoring.

Expected Results

Replay should require compatible effective judgment-adaptation configuration and reject a changed schema instruction template, while matching templates can replay without another target call.

Actual Results

Capabilities/policies and target/scorer hashes match; replay contract remains {'version': 1}. B accepts A's observation and returns true without calling B; fresh B emits WRAPPER_B instead of WRAPPER_A and returns false. Schema-template variant was not separately verified after SQLite reopen.

Verified source references: message scorer replay, LLM scoring replay.

Proposed fix/regression: fingerprint effective target-side judgment adaptation in the stored replay contract, with explicit legacy compatibility; reuse a full normalizer projection without adding descriptive capabilities to identity.

Screenshots

Not applicable; deterministic scoring outputs are inline.

Versions

Tested commit d3446e0, PyRIT 1.2.0.dev0, offline real scoring/persistence with deterministic local targets; no external inference. Evidence: files/evidence/round11/normalizer-replay.json; local path is not an attachment.

Activity

  1. romanlutz commented on Nov 18, 2026

    @romanlutz
    ContributorAuthor

    Still valid on current main, with updated pointers since the scoring refactor: the replay contract is built by _replay_contract_fingerprint in pyrit/score/llm_scoring.py and covers the response handler, category, and the scorer's _judgment_replay_identifier — which is still {"version": 1} — while the target identifier (TargetIdentifier.of) still excludes the normalization pipeline. So two targets differing only in their JsonSchemaNormalizer schema_instructions_template hash identically and replay still accepts the stale observation. #3768 added TargetConfiguration.as_identifier_params() serialization of the template, but only RoundRobinTarget validation consumes it; a fix here can reuse that serialization for the replay contract (or target identity), with the legacy-compatibility handling _legacy_replay_contract_fingerprints already models.

  2. daichunghy commented on Nov 18, 2026

    @daichunghy

    I'd like to take this one. I've prepared a fix locally following the smaller approach you suggested in the issue. It reuses the existing as_identifier_params serialization and folds the normalization pipeline into the judgment replay check, touching llm_scoring.py and one line in each of the 12 scorers. It also handles legacy stored judgments explicitly so old observations still replay.

    I reproduced the bug on unmodified main with a new regression test. With the fix, all 3 new regression tests pass, the related test files pass 85 of 85, and a broader sweep of 7,179 tests passes. The 8 failures in that sweep also occur on unmodified main, so they're pre-existing.

    I'll open the PR right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions