Skip to content

Add end-to-end eval system with LLM judge#152

Merged
dcramer merged 6 commits intomainfrom
claude/overhaul-evals-e2e-ZctnL
Feb 17, 2026
Merged

Add end-to-end eval system with LLM judge#152
dcramer merged 6 commits intomainfrom
claude/overhaul-evals-e2e-ZctnL

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Feb 17, 2026

Summary

Introduces a comprehensive end-to-end evaluation system for Warden that uses YAML-defined test scenarios and an LLM judge to verify the pipeline behaves correctly on known code. This replaces the legacy examples infrastructure with a more structured, BDD-style approach.

Key Changes

  • New eval infrastructure (src/evals/):

    • index.ts: Discovers and loads YAML eval files, resolves metadata
    • types.ts: Zod schemas for eval files, scenarios, judge responses, and result formatting
    • judge.ts: LLM judge that evaluates agent findings against BDD assertions (should_find/should_not_find)
    • runner.ts: End-to-end eval execution with real git repo setup, skill loading, and agent invocation
    • evals.integration.test.ts: Integration test suite for all discovered evals
  • Eval definitions (evals/):

    • YAML files for categories: bug-detection.yaml, security-scanning.yaml, precision.yaml
    • Test skills in skills/: bug-detection.md, security-scanning.md, precision.md
    • Fixture code in fixtures/: null-property-access, off-by-one, missing-await, wrong-comparison, stale-closure, sql-injection, xss-reflected, ignores-style-issues
    • Comprehensive README documenting the eval philosophy and YAML schema
  • Backwards compatibility:

    • src/examples/index.ts: Refactored to re-export eval functions for legacy code
    • src/examples/examples.integration.test.ts: Updated to wrap eval runner
    • src/examples/index.test.ts: Marked deprecated with re-export tests
  • Build configuration:

    • vitest.evals.config.ts: Separate test config for eval integration tests
    • package.json: Added test:evals script

Implementation Details

  • Judge prompt: Constructs detailed BDD-style prompts with agent findings, expected assertions, and anti-assertions. Judge returns structured JSON with per-expectation verdicts.
  • Eval execution: Creates real temporary git repos with fixture files and skills, runs the full Warden pipeline (skill resolution, agent invocation, finding extraction), then judges the results.
  • Metadata resolution: Converts relative paths in YAML to absolute paths, applies file-level defaults with scenario-level overrides.
  • Pass/fail logic: Eval passes when all required should_find assertions are met and no should_not_find assertions are violated. Optional assertions don't block passing.
  • Error handling: Judge API failures gracefully mark expectations as failed with error reasoning rather than crashing.

Testing

  • Unit tests for discovery, loading, validation, and result formatting
  • Integration tests that run the full pipeline for each eval scenario
  • Requires ANTHROPIC_API_KEY environment variable for integration tests

https://claude.ai/code/session_012bNS6DN3SVigGHTCh8BaWv

Replace the old examples-based eval system with a proper end-to-end
behavioral evaluation framework:

- Central YAML files per category (bug-detection.yaml, security-scanning.yaml,
  precision.yaml) instead of scattered _eval.json per directory
- BDD-style format: given/should_find/should_not_find
- Fixture files under evals/fixtures/, test skills under evals/skills/
- Harness discovers YAML files, resolves paths, runs full Warden pipeline
- LLM-as-a-judge (Sonnet) evaluates findings against assertions
- Zod validation for YAML schema (EvalFileSchema, EvalScenarioSchema)
- 8 eval scenarios across 3 categories with 1045 passing tests
- Legacy src/examples/ reduced to backwards-compatible re-exports
- Scoped lint-staged to src/**/*.ts to skip eval fixtures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_012bNS6DN3SVigGHTCh8BaWv
The eval runner now creates a temporary git repo for each scenario:
- git init with main branch + empty base commit
- eval branch with fixture files committed
- EventContext built from real git diff (buildLocalEventContext)
- Agent operates in a real git repo with Read/Grep tools
- Temp repo cleaned up after each eval

This makes evals truly end-to-end: the only thing mocked is the GitHub
event payload. Everything else (git state, diff parsing, SDK invocation,
finding extraction) runs for real.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_012bNS6DN3SVigGHTCh8BaWv
- Move skill copy into setupEvalRepo (it's repo setup, not a pipeline step)
- Drop existsSync guard (rmSync with force handles missing paths)
- Remove comments that restate the next line of code
- Derive skill path from known repo layout instead of reconstructing it

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_012bNS6DN3SVigGHTCh8BaWv
Two bugs fixed:

1. If setupEvalRepo partially fails (e.g. git init succeeds but git
   commit throws), the temp directory leaked because the caller never
   got the path back. Now setupEvalRepo catches and cleans up itself.

2. Skills using the directory format (skill-name/SKILL.md) can have
   resource subdirectories (scripts/, references/, assets/) that the
   agent reads during analysis. The old code only copied the single
   .md file. Now it copies the entire skill directory when SKILL.md
   is present, so the agent has access to all resources.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_012bNS6DN3SVigGHTCh8BaWv
- AGENTS.md: add evals/ to architecture tree and a short Evals section
  pointing to evals/README.md
- README.md: add pnpm test:evals to Contributing and link to eval docs
- evals/README.md: update "How It Works" to reflect real git repo setup
  instead of the old "synthetic EventContext" description

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_012bNS6DN3SVigGHTCh8BaWv
@vercel
Copy link

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
warden Ready Ready Preview, Comment Feb 17, 2026 11:21pm

Request Review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Remove broken backwards-compat shim in src/examples/ (Warden F2Q-E7W,
  QXN-PSJ). The re-exports changed return types without maintaining
  compatibility, and nothing outside the module consumed them.
- Move setup.ts to src/evals/ and update vitest configs.
- Mark precision eval's should_find as optional since the eval tests for
  absence of false positives, not presence of findings (Cursor Bugbot).
- Fix off-by-one fixture loop condition: use <= so only the documented
  Math.floor bug remains (Cursor Bugbot).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dcramer dcramer merged commit aba7d34 into main Feb 17, 2026
13 checks passed
@dcramer dcramer deleted the claude/overhaul-evals-e2e-ZctnL branch February 17, 2026 23:43
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.

2 participants