feat(workflows): tournament soft-scored runner rewrite (V5, #2488) - #2517
Merged
Conversation
This was referenced Aug 18, 2026
flora131
marked this pull request as ready for review
August 19, 2026 16:53
Comment on lines
+50
to
+62
| if ( | ||
| typeof criterionId !== "string" || | ||
| typeof scoreA !== "number" || | ||
| !Number.isInteger(scoreA) || | ||
| scoreA < VERIFICATION_SCALE.min || | ||
| scoreA > VERIFICATION_SCALE.max || | ||
| typeof scoreB !== "number" || | ||
| !Number.isInteger(scoreB) || | ||
| scoreB < VERIFICATION_SCALE.min || | ||
| scoreB > VERIFICATION_SCALE.max || | ||
| !stringArray(evidence) | ||
| ) return undefined; | ||
| return { criterion_id: criterionId, score_a: scoreA, score_b: scoreB, evidence }; |
There was a problem hiding this comment.
Criterion identity is not validated
A schema-valid judge response with a criterion_id different from the scheduled job is accepted as valid. The saved judge artifact retains the returned ID, while comparisons.json records stage.job.criterionId and includes the scores in ranking, producing contradictory audit records without invoking the invalid-report re-ask. Reject reports where report.criterion_id !== stage.job.criterionId through the existing retry path.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/workflows/builtin/tournament-runner.ts
Line: 50-62
Comment:
**Criterion identity is not validated**
A schema-valid judge response with a `criterion_id` different from the scheduled job is accepted as valid. The saved judge artifact retains the returned ID, while `comparisons.json` records `stage.job.criterionId` and includes the scores in ranking, producing contradictory audit records without invoking the invalid-report re-ask. Reject reports where `report.criterion_id !== stage.job.criterionId` through the existing retry path.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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.
Summary
Slice V5 of the LLM-as-a-Verifier adoption program (
specs/2026-08-17-tournament-soft-selection.md§5.2): the tournament builtin rewritten on the soft-scored pivot-pairing schedule.n_evaluations(default 2),pivots(default 1),seed(default 0),criteria(V1 shapes, default 3 judge criteria),models(optional ordered list, round-robin per attempt slot, assignment recorded)plan_comparisons(V4); judge stages score one criterion, both slots (score_a/score_b1–20, evidence), swapped reps presented reversed with scores recorded in candidate order; prompts viabuild_scoring_prompt+warm_first_fan_out(V3){invalid:true}excluded; a fully-invalid pair contributes 0.5/0.5 and is flaggedsoft_win/accumulate→select_pivots→ pivot rounds →rank_candidatescomparisons.jsonreplacesbracket.json(per-job orientation/rep/criterion/scores/validity, totals, ranking, seed, budget); outputs keepresult/winner/winner_artifact_path/result_path/attempt_artifact_paths/artifact_dir, renamebracket_path→comparisons_path, addranking+seedtournamentsynced to the new input set (stale user-facing metadata otherwise)Base:
verifier/selection-math(V4, #2512). Stack: V1 → V3 → V4 → V5 → V6.Size note
828 changed source lines — over the program's 500 cap. The spec pre-authorized exactly this overage as a two-part split (V5a runner core / V5b prompts+ledger+contract), and the commit history is grouped that way (
implement soft tournament runner, thenadd tournament prompts and output contract, then tests/repairs). Kept as one PR to avoid post-hoc history surgery mid-stack; review commit-by-commit if the whole diff is too much at once.Evidence
Produced by an implement→review→repair goal run (2 turns; completion/evidence/risk reviewers all
complete;remaining_work: none):npm run check— green (includes the coding-agent tsgoerasableSyntaxOnlypass)npx vitest --run --project unit -t "tournament"— green: stubbed judges → completecomparisons.json; invalid exclusion with fully-invalid pair flagged 0.5/0.5; ranking recomputable from the ledger alone; fixed seed twice → identical ledgers; retained output names; swapped-job candidate-order recordingpackages/workflows/CHANGELOG.md— ### Breaking Changes (bracket_pathrename, schedule change) + ### AddedSpec contract:
specs/2026-08-17-tournament-soft-selection.md§5.2 (Q1–Q3 resolved; models round-robin ships here).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Greptile Summary
This change expands the tournament workflow with criterion-specific judging, repeated comparisons, ranking output, and persisted comparison records.
A judge response can currently claim a different criterion from the one it was asked to score. Its scores are still accepted into the tournament result, while the judge artifact records the returned criterion and the comparison ledger records the scheduled criterion. This leaves ranking evidence internally inconsistent and skips the existing re-ask behavior.
T-Rex validation blocked
The Greptile artifact-upload tool was unavailable. A focused mocked workflow execution reproduced the inconsistent criterion records and absence of a re-ask, but the executable harness and captured output could not be uploaded as required review evidence.
Confidence Score: 4/5
Not safe to merge until judge reports are required to identify the criterion scheduled for their scoring job.
There is one independent, non-security defect: a mismatched but structurally valid criterion identifier is accepted and creates contradictory persisted scoring records.
Files Needing Attention: packages/workflows/builtin/tournament-runner.ts needs to compare the returned criterion identifier with the scheduled job before treating a judge report as valid.
What T-Rex did
Comments Outside Diff (1)
General comment
judgeReportvalidates only thatcriterion_idis a string, whilerunPhasewritesreportbut independently recordsstage.job.criterionIdwithout requiring equality.report.criterion_id !== stage.job.criterionIdthrough the existing invalid-report re-ask path.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "merge origin/main" | Re-trigger Greptile