fix(matchers): mark grader failures in factuality checks by Asthenia0412 · Pull Request #10641 · promptfoo/promptfoo · GitHub
Skip to content

fix(matchers): mark grader failures in factuality checks - #10641

Open
Asthenia0412 wants to merge 1 commit into
promptfoo:mainfrom
Asthenia0412:codex/grader-failure-metadata
Open

fix(matchers): mark grader failures in factuality checks#10641
Asthenia0412 wants to merge 1 commit into
promptfoo:mainfrom
Asthenia0412:codex/grader-failure-metadata

Conversation

@Asthenia0412

@Asthenia0412 Asthenia0412 commented Sep 4, 2026

Copy link
Copy Markdown

Fixes #10481

Summary

  • use existing graderFail semantics when factuality and closed-QA grading providers return errors or no output
  • mark malformed factuality / closed-QA grader responses with metadata.graderError=true
  • keep valid semantic failures (D / N) as ordinary assertion failures

Tests

  • RED first: npx vitest run test/matchers/factuality.test.ts test/matchers/closed-qa.test.ts failed on the new metadata.graderError expectations
  • npx vitest run test/matchers/factuality.test.ts test/matchers/closed-qa.test.ts
  • npx vitest run test/matchers/factuality.test.ts test/matchers/closed-qa.test.ts test/matchers/utils.test.ts test/assertions/modelGradedClosedQa.test.ts test/assertions/contextPropagation.test.ts
  • npx @biomejs/biome check src/matchers/llmGrading.ts test/matchers/factuality.test.ts test/matchers/closed-qa.test.ts
  • git diff --check
  • E2E: ran npm run local -- eval ... --no-cache -o /tmp/promptfoo-grader-failure-metadata.json against a temporary local config with a malformed exec grader; exported JSON showed both factuality and model-graded-closedqa component results include metadata.graderError=true

npm run tsc still fails on existing optional @openai/codex-security import/type errors in src/providers/openai/codex-security.ts, unrelated to this matcher diff.

@Asthenia0412
Asthenia0412 requested review from a team and mldangelo-oai as code owners September 4, 2026 16:25
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

@promptfoo-scanner promptfoo-scanner Bot left a comment

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.

👍 All Clear

Reviewed changes to LLM grading matchers focused on error handling and malformed output classification. The PR marks provider/malformed output cases as grader failures and adds corresponding tests. No new LLM calls, capabilities, or output execution paths were introduced, and overall the change reduces risk.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

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.

Do not collapse factuality/closed-QA grader failures into assertion failures

1 participant