Skip to content

Record ordinary judge call provenance#2136

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

Record ordinary judge call provenance#2136
xeophon wants to merge 11 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, request/config digests, and full structured-output schemas.

Note

Record judge call provenance with timing, usage, and errors in traces

  • Introduces JudgeCall in trace.py to capture one judge decision per call, including a nested ModelCall with timing, token usage, finish reason, and any errors.
  • Rewrites Judge.complete in judge.py to append a JudgeCall to trace.judge_calls before the provider call, then populate it with the response or error on completion.
  • Removes Trace.extra_usage and replaces all trace.record_judge/extra_usage recording paths with judge_calls; bumps TRACE_VERSION from 4 to 5.
  • Dashboard usage breakdown and replay rescoring are updated to read from judge_calls instead of extra_usage; exported samples include judge_calls in the info block.
  • Risk: traces are now version 5 — consumers that check TRACE_VERSION or read extra_usage will need to be updated.

Macroscope summarized 9193c6b.


Note

Medium Risk
Schema bump to trace v5 and removal of extra_usage break compatibility with saved v4 traces and any external readers of info["judge"]; judge scoring behavior changes slightly around structured output and error attribution on JudgeCall.

Overview
Judge LLM calls are now first-class trace data instead of opaque blobs in trace.info["judge"] plus a separate extra_usage list. Each invocation appends a JudgeCall (judge class id, response text, refusal, parse/judge-level error) wrapping the same ModelCall shape used for agent turns (model, sampling, endpoint, timing, usage, provider error)—without persisting judge prompts.

Judge.complete was reworked to go through chat.completions.create (still via the OpenAI SDK), pre-append the JudgeCall, map OpenAIError through the existing provider error path, and treat refusals, content filters, and length-truncated structured output as scoring failures recorded on the call. RubricJudge funnels plain-text and structured grading through one complete + parse path.

Downstream consumers were updated: eval dashboard judge token/cost totals read judge_calls, replay clears judge_calls (and skips failed traces via trace.ok), platform push embeds judge calls under info["judge_calls"], and Error.from_exception is shared with interception. TRACE_VERSION is 5 and extra_usage is removed—older v4 traces are incompatible.

Reviewed by Cursor Bugbot for commit 9193c6b. 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

Schema change (TRACE_VERSION 4→5) with new JudgeCall data structure, removal of extra_usage field, and refactored judge provenance recording. These structural changes to core trace infrastructure warrant human review.

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

@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 fb637f4. Configure here.

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
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