Repository navigation
feat(eval): add character facts template filter - #12005
mavericksea-ai wants to merge 4 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
👍 All Clear
I reviewed the new characterFacts filter, its integration into the Nunjucks engine, and the accompanying documentation and tests that demonstrate usage in LLM rubric prompts. The changes add descriptive metadata about Unicode whitespace/format characters to prompts without altering execution or capabilities. No LLM security vulnerabilities were identified in these changes.
Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12005 +/- ##
=======================================
Coverage 89.73% 89.74%
=======================================
Files 1051 1052 +1
Lines 92781 92817 +36
Branches 32855 32868 +13
=======================================
+ Hits 83261 83296 +35
- Misses 9520 9521 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
👍 All Clear
Reviewed the addition of the characterFacts Nunjucks filter, its registration in the template engine, related documentation, and tests that integrate it into rubric prompts. The filter emits bounded, escaped metadata and tests confirm runtime data is not interpreted as templates. No LLM security vulnerabilities were identified in the modified code paths.
Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more
An
llm-rubricjudge can confuse a literal U+00A0 with U+0020 when the distinction determines correctness, as reproduced in #12004 while maintaining Driftproof.This adds an opt-in
characterFactsNunjucks filter for custom rubric prompts. Authors can retain{{ output }}and append{{ output | characterFacts }}outside the answer. The filter identifies non-ASCII Unicode whitespace and format characters using code points, positions, and ASCII-escaped context. Occurrences and context are bounded, with an omitted-occurrence count. Existing prompts are unchanged; the metadata neither normalizes the answer nor assigns a grade.Documentation covers structured-value serialization, coordinate semantics, limits, and the preference for executable checks where applicable. This is a targeted aid for character-sensitive rubrics, not a general homoglyph detector or a guarantee of correct model judgments.
Validation on Node 24.22.1:
npm test: 37,767 passed, 10 existing skips across 1,075 files. Includes 23 new tests for character identity, code-point positions, bounded output, template-data isolation, and unchanged original evidence.npm run tsc,npm run build,npm run knip,npm run l, andnpm run fpassed.npm run local -- eval -c ... --no-cache -o ...smoke check: the correct and incorrect NBSP fixtures were both graded correctly by Claude Sonnet 5.5 and Haiku 5.5 (4/4). The run used a local OpenAI-compatible bridge to authenticated Claude Code, not the native vendor API route. CLI exit 100 was expected because the two incorrect candidate answers must fail their assertions. This small check does not establish real-world prevalence or universal mitigation.Addresses #12004.
Additional evidence and limits — 28 October 2026
The broader follow-up did not test this filter or Promptfoo’s matcher/provider/parser path. The four live checks above remain the implementation-specific evidence. This optional filter exposes character information; its effect on accuracy and response-format validity needs evaluation in each intended judging setup.