Skip to content

fix(eval): check final response in failure attribution - #3506

Merged
vvlrff merged 2 commits into
ag2ai:mainfrom
Jacqueline122:fix/failure-attribution-final-response
Oct 26, 2026
Merged

vvlrff merged 2 commits into
ag2ai:mainfrom
Jacqueline122:fix/failure-attribution-final-response

Conversation

@Jacqueline122

@Jacqueline122 Jacqueline122 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

failure_attribution() currently treats text in any model response as an answer. An agent can say "I will look that up.", encounter a tool failure, and finish with no answer, yet receive value="none" and failed=False.

Check the final ModelResponse instead, matching the evaluator's output projection. Interim text no longer hides tool_failure or no_answer; a run with a nonempty final response retains its existing mechanical-failure classification. The helper docstring now describes this behavior.

Validation:

  • Added six regression cases covering successful/failed tools and final responses containing None, empty text, or a nonempty answer. These check the failure mode, failed flag, and decisive step.
  • Relevant attribution and runtime smoke tests: 14 passed. I personally reran them locally.
  • Before the fix, the attribution module with the added regression cases reported 4 failed, 8 passed.
  • Re-ran an offline reproduction through the real Agent, tool execution, OTEL capture/reconstruction, and eval runner, using the public TestConfig for model responses.
  • Ruff 0.16.10 lint/format and git diff --check passed.
  • Additional targeted mypy 2.4.0 checking reports the same five existing generic/type errors before and after the fix, with no new diagnostics. This is not a clean mypy result.
  • The full test suite and GitHub CI have not been verified yet.

Related issue number

Fixes #3505

Checks

AI assistance

OpenAI Codex assisted with investigation, reproduction, the implementation in ag2/eval/scorers/attribution.py, regression tests in test/eval/scorers/test_attribution.py, and drafting the issue and PR description.

  • I understand the changes in this PR and can explain them in my own words.
  • I have verified that the PR description accurately reflects the actual diff.
  • If AI assistance was used, I reviewed, tested, and validated the generated code/text before submitting.

@CLAassistant

CLAassistant commented Oct 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the area:eval Offline evaluation framework (ag2/eval) label Oct 25, 2026
@vvlrff
vvlrff enabled auto-merge October 26, 2026 17:31
@vvlrff
vvlrff added this pull request to the merge queue Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
ag2/eval/scorers/attribution.py 83.14% <100.00%> (+0.19%) ⬆️

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Merged via the queue into ag2ai:main with commit 1084d29 Oct 26, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:eval Offline evaluation framework (ag2/eval)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: failure_attribution counts interim text as a final answer

3 participants