Repository navigation
feat(scorers): label delivered pull requests from their check, CI or protected paths before any judge runs - #1665
Conversation
A scorer file may set check: { run, protect }, the shape a benchmark task's
check has (Tencent#1180), so what a delivering step produced can be decided by a
command before any judge (Tencent#1247). The shared shape moves to
benchmark/check.ts; a task's check extends it with add.
Proof: scorers-definition and benchmark unit tests.
…nd every step's outputs A scorer on a deliver: pr step judges what was delivered against what the run was asked: the evidence now holds inputs.json and the outputs every step reported, as the run stored them when each step reported, so a later edit to the issue a step read changes neither. Other steps keep their own outputs only. Proof: workflow-scoring-evidence test with a read-issue step.
…ts evidence A workflow label now carries decidedBy (judge, until the deterministic stages land) and evidenceHash, sha256 of the fenced evidence the judge read. Evidence comes from what the run recorded, so scoring the same pass again after the issue or main moved gives the same hash. Proof: workflow-scoring-evidence test scores a delivered pass twice around a commit on main and compares the hashes.
…fore any judge Passes of deliver: pr steps now go through stages before their judge, in the lease path every driver shares (score --next, the local judge loop, on demand, the drain). The first stage is the delivery's own protected-path refusal (Tencent#1090): it gives the scorer's best label below passingScore, with decidedBy: protected, the lease's judge named without usage, and the reason kept in the local reasoning file. score --next lists such labels under decided. Proof: workflow-scoring-evidence test rewrites the delivering step as refused for .github/workflows/ci.yml; no lease is handed out and the label is partial.
PullRequestLookup gains a read-only checks member: GitHub reads a commit's check runs and combined status, GitLab its newest pipeline. A failed one fails it, a running one leaves it pending, a cancelled or skipped one says nothing. Hosts TeamAI does not read leave it out. The lookup still has no write member, and the pinned key set says so. Proof: workflow-pr-providers tests over fetch and a fake gh.
… any judge Before the protected-path stage, the CI of the pull request a pass delivered is read once from the origin's host at the commit the pass delivered. A failed CI gives the scorer's best label below passing with decidedBy: ci. A pending CI, no CI, or a host whose CI TeamAI does not read hands the pass to the judge; a host that did not answer is warned of and does the same. Proof: workflow-scoring-evidence tests with a fake gh answering a failed and a running check run.
…s judge
A scorer with check: { run, protect } on a deliver: pr step now runs it first,
the way a benchmark trial runs its check: a fresh clone of the delivered
commit, the protected paths put back as the commit the work started from has
them, then the command. A failed check gives the best label below passing
with decidedBy: check; a passing one hands on to CI and the protected stage.
A check that cannot start, is killed or times out settles the entry unscored
as check_could_not_run, with no judge and no label. Such a scorer is leased
alone, since the other stages decide every scorer of a pass alike. A label a
stage decided no longer counts as a judge call that stated no cost.
Proof: workflow-scoring-evidence tests: a failed check with the agent's own
copy of the protected test, a passing check, and a check command that does not
exist.
…er, and refuse when its evidence is gone teamai score --run <id> --scorer <name> no longer needs --step when the run lists the scorer on one step, as Tencent#1247's delivering step usually is; it asks for --step when the run lists it on none or several. Before recording any request, it checks the commits the pass's diff spans and the sessions its passes recorded, and fails with evidence_missing naming each one that is no longer on this machine, writing no label. Proof: workflow-scoring-evidence tests: a samplingRate: 0 run scored with --run and --scorer only, a scorer listed on no step, and a recorded session that is gone. commands.md regenerated.
…l each Pins Tencent#1247's criterion: a loop's two delivering passes, each with its own pull request and a failed CI, give two labels told apart by subject.pass.
…Scorers page A delivered pass is labelled by the first stage that fails it (check, CI, protected paths) before any judge. The Scorers page now groups by that stage, shows how many labels never reached a judge and the judge's pass rate on the rest, and lists each failing label with its stage. Proof: scorers-results and dashboard-ui tests.
…count no judge call for it Workflow Runs listed a stage-decided label as a judge call in the run's scoring total. It now counts only attempts and labels a judge produced, and tags each pass score a stage decided. Proof: workflow-scoring-evidence and workflow-scoring tests.
…eciding when it failed A ship-issue run on a GitHub origin delivers a pull request; teamai score --run --scorer labels it partial from a failed CI with no judge launch, and publishes no prompt, diff or reasoning. With CI passing the judge decides. Proof: npm run build && npm run test:e2e -- score-delivered-run-1247 (2 passed).
teamai score --run answered entry_leased, as if another driver held the lease, when the scorer's check could not run on the delivered commit. It now fails check_could_not_run with the check's own reason and writes no label. score --next lists the same reason on the closed entry. Proof: the new on-demand test went from entry_leased to check_could_not_run.
…e before the judge Bilingual guide sections for a deliver: pr step's scorer: its check, the stage order, decidedBy and evidenceHash on the label, scoring on demand with only --run and --scorer, evidence_missing and check_could_not_run. The dashboard guide shows the new Scorers panel and the stage on a run's pass scores. The maintainer doc and the judging reference say where the stages run. Proof: node scripts/check-docs.mjs passes; outputs copied from a real CLI run.
…surements A measurement fixes the judge's tool and recorded model. A label a check, CI or protected-path stage decided names the lease's judge but no reported model, so it formed a measurement of its own, and the judge's measurement never showed what failed before review. Such a label now counts in every model judge's measurement of its rubric, and stands alone only while no judge labelled that rubric. Proof: scorers-results tests; a CI label requested haiku and judge labels reported by claude and codex now give two measurements, each with the CI row.
…eck runner import step_ambiguous and evidence_missing join the refusals of teamai score --run in the failure-code policy. scoring-stages.ts runs a scorer's check through the runner benchmark trials use, so its import names why it crosses the workflow boundary. The CI readers keep their status lists in sets. Proof: npm run lint exits 0 with no warnings; npx vitest run passes.
… it names A label a check, CI or protected-path stage decided names its scorer's model judge, so it belongs to that judge's measurement. It joined every model judge's measurement of its rubric, so a CI failure named for claude also counted under codex. It now joins only the measurements of the tool it names. Whether a stage decided a label is answered in one place, isStageDecider in label.ts. Proof: scorers-results test with claude and codex judges: claude 9, codex 2.
- --step may be left out only when the workflow lists the scorer on one step, whether or not that step succeeded; a run listing it on two asks for --step. - Stage verdicts are matched with a never check, and an entry settled unscored while a lease is looked for is kind closed, whatever closed it. - Whether a pass delivered is answered once, in scoring-evidence.ts, and decideBeforeJudge says itself that only a delivered pass has stages. - Each row of the stage breakdown carries its group key, so the Scorers page never rebuilds that format. - deliveredCi takes a named object; originOf keeps its own doc comment. - The evidence_missing message is one searchable literal. - The score refusal shows --step as optional. Proof: npm run lint, tsc, and the scoring, scorers, dashboard and provider tests pass; the new on-demand test went from a silent label to step_ambiguous.
…run the full example end to end A pass of a deliver: pr step that changed nothing delivered no commit. Its scorer's check answered check_could_not_run with "Fix the check", which is the wrong advice: the check has nothing of that pass to say, as CI has not. It now hands the pass to the judge, and the check is unrunnable only when the run recorded no starting commit or checkout for a delivered commit. The real-CLI test now runs the guide's example: read-issue returns the issue as a typed output, the scorer has a check, and three runs are decided by the check, by CI and by the judge. Published labels hold none of the issue text, the prompt, the diff or the reasoning. Proof: npm run build && npm run test:e2e -- score-delivered-run-1247 (3 passed); the new unit test went from a closed entry to a lease.
…g without its hash evidenceHash read the fenced evidence and treated every read error as "no evidence". Only an absent file means that; a permissions or I/O error now throws, so a label never silently loses its evidenceHash. Proof: tsc, lint, workflow-scoring-evidence and workflow-scoring tests.
…e workflow's steps - A failed check run beside one still running, or beside a pending commit status, read as failed CI, so unfinished CI decided the label. CI that has not finished now reads as pending and hands the pass to the judge. - --step was inferred from the steps that recorded a pass, so a second step listing the scorer that never ran was missed and the first was picked silently. It is now inferred from every step of the run, whatever its status. Proof: workflow-pr-providers gains both CI cases (red before, green after); the new on-demand test went from a silent label to step_ambiguous.
GitHub's combined commit status reads failure as soon as one context fails, even while another is still pending, so unfinished CI still decided the label. The CI read now looks at each status context, asks for 100 at a time, and reads a commit with more contexts than one page shows as pending. Proof: workflow-pr-providers gains a failed context beside a pending one and an overflowing page (red before, green after); the real-CLI e2e passes.
The PR description documents sufficient testing, including representative built-CLI runs. No additional provider × agent coverage is required. I only read the diff; I did not run, build, or install PR code. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
The stage order works as described. I ran the built CLI against this head and against main (8a84704), with a fake gh standing in for GitHub:
- Protected edit: the agent rewrote a protected
test.jsto accept its wrong answer, and CI was green. The label ispartialwithdecidedBy: check, and no judge launched. CI was not read, so the check really runs first. - Red CI: with CI
failure, the label ispartialwithdecidedBy: ci, and no judge launched. On main the same pass is judgedcomplete. - CI green or still running: the pass goes to the judge, and the evidence includes
inputs.json. - Rescoring: gives the same
evidenceHash. - Missing session:
evidence_missingnames the session and writes no label. - Clean up: the check's clone is removed, and the member's checkout is untouched.
[P1 blocking] One scorer's check that cannot run strands the other scorers
src/workflow/scoring.ts:1458-1467: teamai score --run <id> --scorer plain --scorer delivered, where delivered has a check that cannot run (no-such-command):
exit 1
{"error":{"code":"check_could_not_run","message":"The check of scorer delivered, … could not run … No label was written."}}
attempt plain leased
attempt delivered failed check_could_not_run
$ teamai score --next --json …
{"data":{"idle":{"open":0,"leased":1}}}
The loop returns on taken.closed before it handles taken.lease. So plain is never judged, its attempt stays leased until the lease expires (30 minutes), and any other driver sees it as taken. This happens in either --scorer order. Judge or release taken.lease before returning. Even simpler: keep judging the other scorers and report the failed check at the end. A test with two scorers on one step would cover it.
[P3 nit]
- After
--stepis inferred,step_not_foundsays "no step with a succeeded pass". The code checks step definitions, not passes. - A label decided before any judge runs still records
judge.access: "full". Measurements are unaffected. - The delivering step's evidence includes outputs of steps that ran after it, so the automatic score and a later on-demand score can hash differently. This matches the spec's wording.
Notes
- Not run here: real GitHub and GitLab hosts (GitLab only through the unit tests), a
workflow:step withdeliver: pr, and the dashboard in a browser. - This PR conflicts with #1664 in 12 files. Whichever lands second rebases.
- Follow-up, outside this PR: moving the check runner out of
benchmark/trial.tsinto a shared module would remove the oneworkflow-boundarieslint disable.
A scorer's check reused the benchmark check runner through an import the workflow boundary forbids: the workflow layer never imports src/benchmark/. The check definitions (benchmark/check.ts, plus AddedSchema from benchmark/terms.ts) move to workflow/check.ts, and the runner (tryCheckAt, now runCheckAt, restoreProtected, writeAdded and their helpers) to workflow/check-run.ts. Every dependency of that code already lived in the workflow layer. The boundary disable in scoring-stages.ts is gone; check-run.ts takes trial.ts's place as an importer of place/setup.ts. Verified: tsc, npm run lint, npx vitest run (667 files pass), and the e2e tests score-delivered-run-1247, benchmark-try and benchmark-checks.
With two scorers, a first scorer whose check could not run returned check_could_not_run at once, abandoning the live lease the same call took for the second scorer until it lapsed. scoreOnDemand now records the first closed entry, judges every lease left, and fails with that error plus the labels the other scorers kept, as judge_model_unavailable already did. Verified: the new test failed with only the bare error before the fix; npm run lint and npx vitest run (667 files) pass.
|
Fixed in c4ddea8. It was a real bug: with two scorers, the closed entry of the first returned early and dropped the live lease of the second.
The new test, "still judges a second scorer when the first one's check cannot run, and says which label it kept" in |
…ep inference checks The step_not_found message said "no step with a succeeded pass", but the inference reads step definitions, not passes.
… CLI The issue covers a workflow step with deliver: pr. The new case runs ship-issue with change as a workflow step and checks that the scorer's check decides its label, with no judge, as it does for a prompt step.
|
[P1] Stranded scorers: fixed in c4ddea8, as described in the reply above. [P3] nits:
Notes:
|
|
No new findings in the specified diff.
I only read the diff and trusted base review criteria; I did not run, build, or install PR code. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
The blocking finding is fixed in c4ddea8. When one scorer's check cannot run, the command still judges the other scorers. It then returns the error together with the labels it kept, and leaves no lease open. The two-scorer test asserts leased: 0. The step_not_found wording is fixed in 607a260, and I accept the reasons for keeping the other two nits. ab24de0 adds a real-CLI case for a workflow: step with deliver: pr. CI is green at this head. Approving.
Brings in Tencent#1665, which moved the benchmark check into src/workflow/check.ts and check-run.ts and added scoring stages before the judge. Its new code is written to the anti-slop rules: conditional spreads became assignments, with the key order of every serialized object as main has it. Checked: typecheck, lint, the unit suite (677 files, 21273 tests), and the E2E files of the scorers and the benchmark, including main's new score-delivered-run test (6 files, 58 tests).
Summary
A scorer on a
deliver: prstep had no way to label what the run actually handed over. Every pass went to a model judge, even when the pull request's tests or CI had already shown it was broken. Now three deterministic stages run first, in order. The first one that fails decides the label, and no judge launches. A pass that clears all three still goes to the judge, which now also reads the run's inputs and every step's outputs.check.runruns in a fresh clone of the delivered commit, after itsprotectpaths are restored to the starting commit. An agent that editstest/to get green cannot pass this way. A check that cannot run fails ascheck_could_not_runand writes no label.teamai score --run <id> --scorer <name>infers--stepfrom the run. It refuses withstep_ambiguouswhen more than one step lists the scorer, and withevidence_missingwhen the pass's evidence is gone from the machine. When several scorers are asked for and one of them cannot be scored, the others are still judged. The error then names the labels they kept.decidedBy, plus anevidenceHashover what the judge would read, so a label can be traced to the exact evidence behind it.usage, because no judge ran.Docs, with worked examples:
docs/guide/scorers.md("Score what a run delivered", "On demand"),docs/guide/dashboard.md, their zh-CN pages,docs/dev/workflow-engine.md, andskill-data/workflow/references/judging.md.Screenshots come from a fixture project with labels from all four deciders.
Type of Change
Test Plan
Proof: I ran the built CLI end to end on a real
ship-issueworkflow for three cases. A failing check, failing CI, and passing CI each produced the expected label and decider, and only the passing case launched the judge.npx tsc --noEmitpassesnpm run lintpasses (0 warnings),node scripts/check-docs.mjspassesnpx vitest runpasses (667 files, 20757 tests)check_could_not_run,step_ambiguous,evidence_missing, GitHub check runs and commit statuses (pending wins over failed, and a partial page counts as pending), GitLab pipelines, and the Scorers measurements and decided rows.npm run test:e2e -- src/__tests__/e2e/score-delivered-run-1247.test.tspasses 4/4: CI failure, failing check, the same failing check on aworkflow:step withdeliver: pr, and CI success.benchmark-tryandbenchmark-checks(37 tests) pass after the check runner move.Real-CLI record, after
npm run build. The record comes from the E2E fixture. Aship-issuerun has aread-issuecommand step and achangestep withdeliver: pron a GitHub origin. It is followed byteamai score --run <id> --scorer delivered. Reasoning paths are omitted.The published labels also contain none of the issue text, the prompt, the diff, or the reasoning. The E2E asserts this.
A
workflow:step that delivers is labelled the same way. In the fourth E2E case,changeruns a workflow whosewritestep makes the change, and the scorer's check decidespartialwith no judge.Coverage gaps: the real-CLI run used Claude and a GitHub origin. GitLab CI reading and the Codex, CodeBuddy and OpenCode agents are covered by unit tests only. The rest of the matrix is left to CI.
Related Issues
Closes #1247
Notes for Reviewers
Check runner moved into the workflow layer. A scorer's check reuses the benchmark check runner, so it behaves exactly as a benchmark trial's check does. The workflow layer must never import
src/benchmark/, so the check definitions and the runner now sit below both. No boundary disable remains, and the move is one commit of its own:The code moves unchanged. Only
tryCheckAtis renamed, torunCheckAt, since it now runs scorer checks as well asteamai benchmark try.teamai/workflow-boundariesnow listscheck-run.tsas an importer ofplace.tsandsetup.ts, and dropstrial.tsfromsetup.ts. The benchmark end-to-end tests (benchmark-try,benchmark-checks: 37 tests) pass after the move.Label shape.
judge: {kind: "model", tool}for the lease's judge, withoutmodelorusage, as the issue specifies.decidedByis the field that says no model ran.scoringTotaland the "judge ran" counts skip stage-decided labels.Dashboard scope. The decided panel and column extend the existing Scorers page from [feat] Show scorer results in the dashboard #1182. There is no new view.
CI reading. GitHub's combined status can say
failurewhile another context is still pending, so the code reads each context. A pending context, or more results than one page holds, means not finished, and the judge decides.