Skip to content

fix(security): keep red teaming results when the evaluator fails on an item - #2610

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:developfrom
siddhant-rajhans:fix/red-teaming-runner-evaluator-errors
Nov 18, 2026
Merged

rapids-bot[bot] merged 1 commit into
NVIDIA:developfrom
siddhant-rajhans:fix/red-teaming-runner-evaluator-errors

Conversation

@siddhant-rajhans

@siddhant-rajhans siddhant-rajhans commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #2609

When the red teaming evaluator raises on an item (for example, the judge LLM call still fails after its retries), BaseEvaluator.evaluate returns a plain EvalOutputItem with error set in its place. RedTeamingRunner._build_flat_results raised ValueError for any item that is not a RedTeamingEvalOutputItem, so nat red-team stopped after every scenario had run and wrote no summary, results file or report.

_build_flat_results now records such an item as one failed evaluation: its error message, no condition name, and the score the evaluator returned. _compute_result_summary already counts rows with an error_message under evaluation failures and leaves them out of the attack success rate, and the report drops them before plotting, so the other items are reported as before. An item of another type without an error still raises. The scenario's tags and group are now looked up once per scenario, and yapf reflowed the existing record dict after that change.

Tests, in packages/nvidia_nat_security/tests/eval/runners/red_teaming_runner/test_red_teaming_runner.py:

pytest packages/nvidia_nat_security/tests/eval: 39 passed. yapf 0.43.0 and ruff check 0.15.0 are clean on the changed files. The reproducer in #2609 now completes, and the results file, summary and HTML report build from its output.

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Summary by CodeRabbit

  • Bug Fixes
    • Red-teaming evaluation results now include scenario tags and group information for both condition results and error records.
    • When an individual item fails, its error and available evaluation details are recorded, while results from other items remain available.
    • Unexpected evaluation items without an associated error continue to be rejected.

…n item

When the red teaming evaluator raises on an item (for example, the judge
LLM call fails after its retries), the evaluation returns a plain
EvalOutputItem with `error` set in place of a RedTeamingEvalOutputItem.
RedTeamingRunner._build_flat_results raised ValueError on that item, so
`nat red-team` stopped after every scenario had run and wrote no summary,
results file or report.

Record such an item as one failed evaluation, with its error message and
no condition name, so the summary counts it under evaluation failures and
leaves it out of the attack success rate, and the other items are still
reported. An item of another type without an error is still rejected.

Signed-off-by: Siddhant Rajhans <[email protected]>
@siddhant-rajhans
siddhant-rajhans requested a review from a team as a code owner November 14, 2026 18:58
@copy-pr-bot

copy-pr-bot Bot commented Nov 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown

Warning

⚠️ Deprecation Notice: NVIDIA NeMo Agent Toolkit has been deprecated as of October 2026 and will reach end of life (EOL) by end of year 2026. Depending on your needs, migrate to: NeMo Relay for observability, middleware, and governance. NeMo Helix for a unified CLI with evaluation, optimization, and hardening capabilities. NeMo Fabric for a consistent interface to run agent harnesses and custom agents.
We recommend completing your migration before the EOL date.

Pull request policy: Only bug fixes may be opened as pull requests.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The red-teaming runner now records evaluator error items as failed evaluations instead of stopping on those items. It includes scenario tags and group in failed-item and condition-level records. It still raises ValueError for unexpected output items without an error.

Changes

Red-team failure reporting

Layer / File(s) Summary
Build flat results
packages/nvidia_nat_security/src/nat/plugins/security/eval/runners/red_teaming_runner/runner.py
Error items now produce one record with a scenario-and-item UID, error details, score, reasoning, tags, and group. They have no condition name or evaluated output. Condition-level records also include scenario tags and group. Unexpected non-error item types still raise ValueError.
Test failed-item reporting
packages/nvidia_nat_security/tests/eval/runners/red_teaming_runner/test_red_teaming_runner.py
New tests cover a failed evaluator item alongside a successful item, the resulting summary values, and ValueError for an unexpected item without an error.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 10231

Red-team runs now report evaluator failures on individual items as failed evaluations and keep reporting the remaining items instead of stopping. The change is narrow and tested, with no remaining merge-blocking risk identified.

Security architecture risk: Minimal · up to 10231

Evaluator failures are explicitly counted and excluded from attack-success statistics. Successful results remain available, and the inspected change does not introduce a material security or failure-containment regression.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected change affects post-evaluation reporting within a configured run's output directory. It does not change target execution, endpoint selection, credential handling or tool authority; exception text becomes additional retained result data rather than an executable instruction.

Trust Boundaries and Controls

  • observed — Exception text is serialized as JSON data in the results file. Error-bearing rows are removed before plotting, and the HTML summary consumes counts, scores and scenario identities rather than error or reasoning text. Thus the newly retained exception text does not reach the inspected HTML-rendering path.

Resilience and Maintainability Implications

  • observed — Flattening builds a fresh local list and emits each accepted error item once before continuing. The evaluator's existing exception handling, concurrency limit and progress-resource cleanup are unchanged. Summary, JSONL and report publication remain sequential rather than a transactional operation.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the conventional commit prefix 'fix(security):' and describes the main change: red teaming results are kept when the evaluator fails on one item. This matches the linked issue #2609 and…
Linked Issues check Passed Directly linked issue #2609 requires that a plain EvalOutputItem with an error, returned by the red teaming evaluator, count as one failed evaluation, and that the other items still be reported. The r…
Out of Scope Changes check Passed All changes fall within the scope of #2609. The runner.py change adds the failed-item branch, which is the requested fix. It keeps the ValueError for items of another type without an error. It hoists …
Full details: Title check

Explanation

The title uses the conventional commit prefix 'fix(security):' and describes the main change: red teaming results are kept when the evaluator fails on one item. This matches the linked issue #2609 and the code change in _build_flat_results. The title is 75 characters, which is slightly over the roughly 72-character guideline in the title requirements, and it is written in past-tense-free but not strictly imperative form ('keep' is imperative, so the mood is acceptable). The overrun is minor and the title is otherwise accurate and specific.

Full details: Linked Issues check

Explanation

Directly linked issue #2609 requires that a plain EvalOutputItem with an error, returned by the red teaming evaluator, count as one failed evaluation, and that the other items still be reported. The runner diff (runner.py, RedTeamingRunner._build_flat_results) implements this. For a non-RedTeamingEvalOutputItem with error set, the code appends one record with uid {scenario_id}_{item_id}, condition_name None, the item's score, reasoning, and error as error_message, and then continues. The record carries the scenario tags and scenario_group. Other items are processed as before, so _build_flat_results no longer raises for this case. The issue states that _compute_result_summary already counts rows with error_message as evaluation failures and excludes them from the attack success rate; I did not re-read that function, so this relies on the issue text and the PR description. The PR adds test_judge_failure_on_one_item_counts_as_failed_evaluation, which the PR states fails on develop and checks one failed evaluation, one success, and an attack success rate of 1.0. I read this test only through its summary, not its source. The issue has no other coding acceptance criteria. The reproducer's non-error path is unchanged.

Full details: Out of Scope Changes check

Explanation

All changes fall within the scope of #2609. The runner.py change adds the failed-item branch, which is the requested fix. It keeps the ValueError for items of another type without an error. It hoists the scenario tags and scenario_group lookup out of the item loop. This is a refactor needed to share those values with the new error record, and the condition-level record keeps the same values and uid format. The yapf reflow of the record dict is formatting that comes with this edit. The test file changes add a regression test for the reported failure and a test that unexpected item types without an error still raise. No unrelated files are changed according to the diff and summary. I did not inspect the test file source directly.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9296f53 and 10231e5.

Files selected for processing: 2

  • packages/nvidia_nat_security/src/nat/plugins/security/eval/runners/red_teaming_runner/runner.py
  • packages/nvidia_nat_security/tests/eval/runners/red_teaming_runner/test_red_teaming_runner.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@willkill07 willkill07 added bug Something isn't working non-breaking Non-breaking change labels Nov 16, 2026
@willkill07

Copy link
Copy Markdown
Member

/ok to test 10231e5

@willkill07

Copy link
Copy Markdown
Member

/merge

@rapids-bot
rapids-bot Bot merged commit 2525e27 into NVIDIA:develop Nov 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: nat red-team stops without a summary or report when the red teaming evaluator fails on one item

2 participants