Add scenario=redteam to RAIServiceScorer eval_input#46701
Open
slister1001 wants to merge 4 commits intoAzure:mainfrom
Open
Add scenario=redteam to RAIServiceScorer eval_input#46701slister1001 wants to merge 4 commits intoAzure:mainfrom
slister1001 wants to merge 4 commits intoAzure:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Foundry red team scoring requests by adding scenario="redteam" to the eval_input payload built in RAIServiceScorer._score_piece_async(), aligning it with the existing red team evaluation processor behavior so server-side context-dependent score mapping routes correctly.
Changes:
- Add
"scenario": "redteam"to the RAI service evaluation payload in the Foundry scorer. - Align Foundry red team scoring payload shape with the existing
_evaluation_processor.pypattern to ensure correct server-side mapping behavior.
BryceByDesign
approved these changes
May 4, 2026
a5e1db6 to
a26f3aa
Compare
The RAIServiceScorer in _rai_scorer.py builds eval_input without scenario=redteam, so the server-side ContextDependent score mapping never triggers Direct for the red team scorer path. This causes task_adherence to use Inverted mapping (flagged=true -> 0.0) instead of Direct (flagged=true -> 1.0), breaking is_attack_successful() which expects higher scores for detected defects (score > threshold). Adding scenario=redteam aligns _rai_scorer.py with the existing pattern in _evaluation_processor.py:127 and ensures ContextDependent correctly routes to Direct mapping for red team evaluations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds test_score_async_sends_redteam_scenario to verify the eval_input payload includes scenario=redteam, preventing future regressions where the server-side ContextDependent mapping would silently fall through to the wrong scoring path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Re-recorded E2E tests after adding scenario=redteam to RAIServiceScorer eval_input. All 16 tests pass live and in playback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a26f3aa to
7121a6d
Compare
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
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.
Fix red team scoring for task_adherence via ContextDependent mapping
Problem
The RAIServiceScorer in _rai_scorer.py builds eval_input without scenario=redteam, so the server-side ContextDependent score mapping never triggers the Direct path for the red team scorer. This causes task_adherence to use Inverted mapping (flagged=true to 0.0) instead of Direct (flagged=true to 1.0), breaking is_attack_successful() which expects higher scores for detected defects (score > threshold).
Fix
Add scenario=redteam to the eval_input payload, aligning _rai_scorer.py with the existing pattern in _evaluation_processor.py:127. This ensures the server-side ContextDependent mapping correctly routes to Direct mapping for red team evaluations.
Changes
Testing