Skip to content

fix(judge): prevent expect gate failures from inflating benchmark scores - #309

Merged
JHWang-1997 merged 2 commits into
mainfrom
fix/issue-300-expect-scoring
Oct 13, 2026
Merged

JHWang-1997 merged 2 commits into
mainfrom
fix/issue-300-expect-scoring

Conversation

@zpzjzj

@zpzjzj zpzjzj commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

An expect gate failure previously removed configured judge assertions from the denominator, making an unjudged result look better than a judged failure. The reported 2/3 expect result now scores 2/7 rather than 2/3; compared with 3/3 expect checks plus 1/4 judge criteria, the Anthropic benchmark delta is -0.29 instead of +0.10.

Skipped assertions stay in the configured single-judge denominator with no credit and carry skipped: true through grading and benchmark projections. Rule-based grading includes every configured success/failure rule and retains skipped success rules after a failure guard matches. The existing case verdicts and agent-judge threshold semantics are preserved, and debug judging uses the same expect scoring.

Multi-judge gate failures retain each member as SKIP, project one zero-credit assertion per member, and keep the overall gate verdict FAIL. Aggregation continues to use member verdicts without weighting criteria counts. Documentation distinguishes case pass rates from assertion/member pass rates.

Validation:

  • make fmt and make verify (0 issues).
  • Full make test, including race detection, 22 plugin tests, and 60 skill regression tests. Run through the environment's existing child-subreaper wrapper because its PID 1 does not reap orphaned children; no tests were changed or skipped to address that environment limitation.
  • make e2e passed; 35 environment/credential-gated cases skipped.
  • Regression coverage includes gate short-circuiting, the reported benchmark delta, threshold behavior, configured judge types, skipped metadata propagation, and multi-judge member weighting.

Closes #300.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T08:32:59.343246Z f6c4d5d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6c4d5de6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/judge/judge.go Resolved

@JHWang-1997 JHWang-1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@JHWang-1997
JHWang-1997 added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 4d13bf1 Oct 13, 2026
16 checks passed
GBX-Max1220 added a commit to GBX-Max1220/skill-up that referenced this pull request Oct 30, 2026
A below-threshold score must not turn a timeout ERROR into FAIL, because the
case then loses the retryable timeout reason, and a script that exited
nonzero must not be reclassified as a missing-required-score contract error.
Report both metric decisions in the additive metric metadata instead, and stop
injecting a synthetic compatibility assertion: the alibaba#309 assertion and member
denominators stay exactly as the execution layer produced them.
zpzjzj pushed a commit that referenced this pull request Nov 26, 2026
…lice 1) (#347)

* feat(judge): validated named-metric scoring and persistence (#317)

Adds the first bounded slice of the #317 contract: a per-judge metric registry,
four independent state axes (execution stage, completion, termination cause,
slot availability), a derived quality state, whole-payload versus single-slot
validation, and group completion folding that preserves earlier member detail.

Execution metadata and planned metric slots are recorded on the member outcome
and the grouped path even when no judge result exists, so a gate short-circuit
or a cancellation never loses them. An accepted score survives a later
cancellation or timeout, and the timeout, its source and any recovery stay
visible.

Existing PASS/FAIL/SKIP/ERROR verdicts, the #309 assertion and member
denominators, script-timeout verdict mapping and the JSONL event schema are
unchanged.

* style: gofmt the #317 test tables

* feat(judge): real named-metric input channel via the script judge

The previous commit added the state machine but no producer: both grouped call
sites materialized slots from a nil emission list, so no judge could ever report
an AVAILABLE metric and DeriveQuality/FoldGroup had no production caller. This
adds the missing slice-1 path.

- script judge executes, collects its invocation-bound result file, validates it
  and materializes one slot per planned registry entry
- whole-envelope defects (duplicate json keys, unknown top-level field, bad
  schema version, unbound or stale invocation, size limit) poison every slot;
  entry-level defects poison only their own slot and keep valid siblings
- a timeout no longer discards a trustworthy result: collected scores stay
  AVAILABLE while the existing script-timeout verdict mapping is preserved, and
  slots never reached become NOT_PRODUCED rather than an invented zero
- group completion and cause are derived with FoldGroup and persisted into
  evaluation.json beside the unchanged all_required verdict
- integration tests spawn the real script judge through executeCase; the
  process-kill cancellation case is POSIX-only for the same process-group reason
  upstream already documents

Removes the unconsumed definition-compatibility helper and the cancel sources
that slice 1 cannot actually detect; those return with their consumers.

* fix(judge): harden the metrics collection channel and acceptance rule

Found while reviewing the real data flow rather than the helper functions:

- accepted only means the member reached its own final outcome: no stop, or a
  deadline that still left collected scores. A cancellation arriving mid-run is
  never acceptance; previously a killed member kept a COMPLETED-looking verdict
  and its untouched slots read MISSING instead of NOT_PRODUCED
- the collector Lstat-s the assigned path and requires a regular, non-symlink
  file, and checks the size before reading instead of after
- an unassigned channel (non-local runtime) reports metrics_channel_unsupported
  rather than pretending a stale file was found
- the real child-process timeout path is now covered on Windows too: the script
  writes its bound result, outlives the 1s deadline and is killed; long sleeps
  were shortened because 30s orphans destabilised concurrent package builds
- README documents the payload grammar, injected variables, persistence targets
  and an explicit not-implemented list for this slice

* chore: drop a scratch merge-check output committed by mistake

* fix(judge): address named metrics review findings

* fix(judge): keep an expired deadline visible on interrupted members

interruptedExecution recorded termination_cause and deadline_source but never
the timeout metadata, so a grouped member stopped by its own judge deadline
reported the cause without the structured record that README requires. Build
it once in interruptedExecution and drop the duplicate in deriveSingleExecution.

* test(judge): pin metric contract outcomes on the real evaluator path

Add a grouped judge-timeout case with a live but unexpired case deadline, the
shape the review asked about, and assert the stop names judge.timeout_seconds.
Assert the coverage buckets behind each contract verdict, the configured judge
id on grouped members, and the folded group state on every skip short circuit.
Move the two tests that kill a running child onto a scratch workspace, since
Windows harness cleanup of a held working directory fails after all assertions
pass.

* test(runner): persist single-judge metrics through evaluator and runner

Run a real script judge through NewEvaluator/EvaluateAll, write the case
artifacts, then read evaluation.json back from disk and assert the configured
judge id, FINISHED execution and the explicit zero score. Split the case into
helpers so the complexity gate accepts it, and provide the PowerShell fixture
so the path is verified on Windows instead of skipped.

* fix(judge): let execution outcomes outrank metric policy

A below-threshold score must not turn a timeout ERROR into FAIL, because the
case then loses the retryable timeout reason, and a script that exited
nonzero must not be reclassified as a missing-required-score contract error.
Report both metric decisions in the additive metric metadata instead, and stop
injecting a synthetic compatibility assertion: the #309 assertion and member
denominators stay exactly as the execution layer produced them.

* test(judge): cover timeout, exit and denominator interactions on the real path

Each case runs a child script through executeCase and asserts the execution
outcome and the metric state together: a timeout with a below-threshold score
on the single and grouped paths, a nonzero exit after writing a valid result
file, and unchanged compatibility counts when the metric policy decides.

* fix(evaluator): make metric results and verdicts agree end to end

A relative --output-dir used to hand the script judge a relative result path,
which the child resolves against its case workspace while the collector resolves
it against this process, so scores vanished; the channel now binds an absolute
path. The judge phase and the metric finalizer work on a copy of the case record,
so a threshold miss or a contract violation persisted FAIL/ERROR while the
evaluator.case span and skill_up.case.run.count kept reporting the pre-judge PASS
on both the single-shot and the multi-turn route: each now writes the final
verdict back before the deferred telemetry reads it.

Termination causes stay conservative. A skipped judge adopts a context stop only
when that stop is the failure it was handed, so an unrelated engine error that
lands after the case deadline expired still reports execution_error instead of
blaming a knob skill-up never armed, and a judge that fails before producing any
grading result counts as prevented rather than materializing MISSING slots.
A metric payload carrying a number beyond float64 poisons only its own slot,
because the structural scan no longer converts numbers, and a non-finite
min_score is rejected at configuration validation since every comparison against
NaN is false and quality derivation would then report MET for any score.

* fix(judge): make the evidence gate and member deadlines report what happened

An evidence_required slot accepted ["null"] and ["   "] because the gate read the
slice length, so a score with no support at all persisted AVAILABLE / MET and
passed the case. It now requires at least one nonblank element; the payload
decoder still rejects a wrong element type outright.

Grouped members also kept discarding what their own scoring pass had observed.
A script that omits timeout_seconds and outlives ScriptJudge's own default
deadline persisted FAILED / execution_error with no deadline_source and no timeout
object, and a judge that failed before grading anything, such as uploading a
missing script, was rewritten from the STARTED / FAILED the finalizer had derived
into INTERRUPTED, taking the folded group state with it. Both now keep the
observed record: the group reports the deadline it actually hit and the failure it
actually had, while the registry still supplies the NOT_PRODUCED denominator. The
single-judge path is unchanged, and the grouped timeouts that the outer context
does see keep their existing attribution.

* fix(judge): reject a null evidence element as the wrong kind

encoding/json turns a null element of a []string field into "", so a list like
[null, "valid evidence"] decoded cleanly, the opt-in evidence gate saw a nonblank
element and the score was accepted. Every evidence element has to be a string, so
the raw tokens are now checked while the entry is decoded and a null is rejected
as the payload defect a number or an object in the same array already was: the
whole envelope becomes ERROR instead of one slot, which is the boundary the
grammar documents for a wrong kind. A blank string is a different defect and stays
a nonblank-evidence question rather than becoming a type error, and a null
evidence *field* keeps meaning absent, so an independently valid sibling stays
usable. The rejection list in the judge README now names the case.

* fix(judge): keep a null evidence element inside its own slot

Rejecting the whole payload when an evidence array carried a null threw away
sibling scores: a run whose correctness entry held [null, "valid evidence"]
persisted both planned slots as ERROR and lost the 0.9 that completeness had
earned. Per the per-entry isolation contract a null is one entry's defect, so the
collector now marks that metric ERROR/invalid_evidence with no value and leaves an
independently valid sibling AVAILABLE, which is what evaluation.json shows on read
back in the new regression.

A blank string element is not this defect: evidence_required asks for at least one
nonblank string, so ["valid evidence", "   "] still supports the score, and a null
evidence field still means an omitted one. Elements that are neither strings nor
null remain the whole-envelope shape defect they already were, so the payload
boundary stays as documented.

* fix(judge): derive completion from recovered timeout results

* fix(judge): preserve timeout verdicts and validate metrics envelopes

* fix(judge): enforce named metric policy after collection

* fix(judge): preserve metric collection and stop provenance

* fix(judge): address metric validation, timeout reporting, and Windows paths

* fix(evaluator): keep late judge deadlines out of retry errors

* fix(evaluator): snapshot grouped judge context errors

---------

Co-authored-by: Codex <[email protected]>
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.

bug: expect gate failures can inflate benchmark assertion pass rates

2 participants