Repository navigation
Add goal-based regression cases evaluated across repeated runs - #3
Merged
Merged
Conversation
Adds a Scorer protocol (sync or async), deterministic built-in scorers (required terms, forbidden terms, required fields), assert_score on a single execution, and assert_pass_rate / assert_score_rate on repeated runs. Score outcomes flow into the existing JSON and HTML report assertion tables. Co-authored-by: Dor Ingber <Doringber@users.noreply.github.com>
Co-authored-by: Dor Ingber <Doringber@users.noreply.github.com>
Regression cases accept optional goal, persona, runs and behavior fields. Built-in behavior checks (required/forbidden terms, required fields) apply in evaluate(); named scores and min_pass_rate apply in evaluate_runs() and run(), which executes a case repeatedly and reports per-run failures. Co-authored-by: Dor Ingber <Doringber@users.noreply.github.com>
Co-authored-by: Dor Ingber <Doringber@users.noreply.github.com>
cursor
Bot
changed the base branch from
cursor/behavior-scorers-083e
to
main
September 24, 2026 18:34
Doringber
marked this pull request as ready for review
September 24, 2026 18:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #2, which adds scorers and pass rates. Merge that one first.
Why
Today a regression case describes one exact path: required tools, order, counts. For AI behavior the useful contract is different. It says what the user must achieve, what must never happen, and how often the agent must get it right. This lets the same YAML files express "expected behavior", not only "expected result".
What
A regression case gains optional fields. Existing cases load and evaluate exactly as before.
goalpersonarunscase.run(); default 1, max 100behavior.min_pass_ratebehavior.required_terms/forbidden_terms/required_fields/case_sensitivebehavior.scoresscorer_name: min_scorefor consumer-provided scorersEvaluation works at three levels:
case.evaluate(result)stays sync and deterministic. It now also applies the built-in behavior checks and returnsscoresper check.await case.evaluate_runs(results, scorers=[...])evaluates each run, applies named scores, and compares the pass rate tomin_pass_rate. It returns aRegressionRunEvaluationwith the goal, persona, pass rate, and each run's failures and scores.await case.run(executor, scorers=[...])runsevaluate_runsoverrun_repeatedlywith one idempotency key,regression:<id>by default. It rejects missing or duplicate scorer names before calling the agent, so a config mistake does not spend agent calls.RegressionRunEvaluation.assert_passed()failures report the pass rate and the failures of each failing run.Also included:
examples/behavior_regression_cases.yaml, which a test loads to keep it valid.RegressionBehaviorandRegressionRunEvaluation.Testing
tests/test_regression_behavior.pyadds 21 tests. They cover schema validation and loader error context, built-in checks, pass-rate boundaries, named scores, missing or duplicate scorers, idempotency key propagation, and default behavior for cases without the new fields.tests/test_regression_cases.pypasses unchanged.regression.pyis 93%.main: the version check (0.1.1 vs 0.1.2) and one malformed-payload case in the cursor client.ruff checkandruff formatare clean.mypy --strictshows only the error inreporting/json_report.py:117that already exists onmain.