Skip to content

Record ordinary judge call provenance - #2136

Open
xeophon wants to merge 14 commits into
mainfrom
agent/judge-call-provenance
Open

Record ordinary judge call provenance#2136
xeophon wants to merge 14 commits into
mainfrom
agent/judge-call-provenance

Conversation

@xeophon

@xeophon xeophon commented Jul 26, 2026

Copy link
Copy Markdown
Member

Overview

Make ordinary LLM judges more robust and observable with compact typed evidence while retaining the existing SDK client behavior.

Details

  • Add Trace.judge_calls; each record carries judge identity, response/refusal/parser evidence, and one existing ModelCall for model, sampling, endpoint, timing, usage, and provider errors.
  • Keep the existing OpenAI SDK client so its finite timeout and default transient retries remain in effect, then map exhausted SDK failures through the existing ProviderError path.
  • Preserve structured-output validation and reject length-truncated verdicts even when the partial JSON is syntactically valid.
  • Keep valid negative verdicts distinct from provider failure, refusal, parser failure, and cancellation; failures abort scoring without creating a zero reward.
  • Carry typed judge evidence through trace serialization, replay re-scoring, dashboard usage totals, and upload conversion.
  • Keep persisted evidence compact by excluding judge prompts and request/config digests; retain full structured-output schemas in ModelCall.sampling for exact replayability and parity with agentic judges.

Note

Record judge call provenance in traces with structured JudgeCall model

  • Introduces JudgeCall in trace.py to record each judge invocation with a nested ModelCall (timing, usage, endpoint, sampling) plus optional text, refusal, and error fields; appended to trace.judge_calls.
  • Refactors Judge.complete in judge.py to build and populate a JudgeCall per invocation, capturing provider errors via Error.from_exception and raising on refusals, content filter terminations, and truncated structured outputs.
  • Removes extra_usage from Trace and bumps TRACE_VERSION to 5; dashboard, replay, and push logic updated to read from judge_calls instead.
  • Exports JudgeCall from the top-level verifiers.v1 package.
  • Behavioral Change: serialized traces now include judge_calls and drop extra_usage; existing trace consumers expecting version 4 schema will need updating.

Macroscope summarized cebafba.


Note

Medium Risk
Breaking trace schema (v5, dropped extra_usage) and changed judge HTTP/structured-output behavior affect scoring, serialization, and any consumer of old judge metadata; core paths are covered by updated unit and e2e tests.

Overview
Judge LLM usage and outcomes move from opaque trace.info["judge"] blobs plus a separate extra_usage list to first-class trace.judge_calls: each entry names the judge class, nests a normal ModelCall (model, sampling, endpoint, timing, usage, provider errors), and carries response text, refusal, and parse/validation errors without storing full prompts on the trace.

Judge.complete now goes through the standard chat completions path (including optional response_format), appends a JudgeCall before the provider call, maps OpenAIError via the existing provider-error path, and treats refusals, content filters, and length-truncated structured output as judge failures recorded on the call. RubricJudge routes structured and plain JSON grading through that single complete + parse flow.

TRACE_VERSION bumps to 5 (extra_usage removed). Replay clears judge_calls when re-scoring, skips any trace with ok false, the eval dashboard sums judge tokens/cost from nested usage, and platform push copies judge calls into sample info. Error.from_exception centralizes error capture for interception ModelCall records and trace capture_error.

Reviewed by Cursor Bugbot for commit cebafba. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread verifiers/v1/trace.py
Comment thread verifiers/v1/judge.py
@macroscopeapp

macroscopeapp Bot commented Jul 26, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

Unable to check for correctness in cebafba. This PR refactors judge call provenance with new typed structures and a schema version bump. An unresolved review comment identifies a bug where structured output calls are recorded without their response_format parameter, affecting the ability to distinguish or reproduce such calls.

You can customize Macroscope's approvability policy. Learn more.

@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: e90dc26940

ℹ️ 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 verifiers/v1/cli/replay.py Outdated

@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: 0fb9a3e337

ℹ️ 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 verifiers/v1/cli/replay.py Outdated
Comment thread verifiers/v1/cli/replay.py Outdated

@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: 0dbd0844d2

ℹ️ 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 verifiers/v1/judge.py Outdated

@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: a8e9cfa58d

ℹ️ 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 verifiers/v1/cli/replay.py Outdated
Comment thread verifiers/v1/cli/replay.py Outdated
Comment thread verifiers/v1/cli/replay.py Outdated

@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: cf9b15b471

ℹ️ 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 verifiers/v1/judge.py Outdated

@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: 4c3400c469

ℹ️ 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 verifiers/v1/trace.py
Comment thread verifiers/v1/judge.py Outdated
Comment thread verifiers/v1/judge.py

@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: f451009546

ℹ️ 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 verifiers/v1/judge.py Outdated
Comment thread verifiers/v1/judge.py Outdated

@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: fb637f402e

ℹ️ 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 verifiers/v1/judge.py
Comment thread verifiers/v1/cli/replay.py

@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: d7ae41181d

ℹ️ 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 verifiers/v1/judge.py Outdated
@xeophon
xeophon force-pushed the agent/judge-call-provenance branch from 9193c6b to 3bc3d2b Compare July 27, 2026 13:27

@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: 1d53c20d9b

ℹ️ 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 verifiers/v1/judge.py

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cebafba. Configure here.

Comment thread verifiers/v1/judge.py
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.

1 participant