judge_probe.py

scripts/judge_probe.py

Reproduce ONE judge call exactly as the grader makes it, and show the raw failure.

main

int judge_probe.main()

Make one judge call and print the raw result.

scripts/judge_probe.py:29

Source · 31 lines
def main() -> int:
    """@brief Probe one judge call.
    @return Exit code.
    @version 1
    """
    answer_path = ROOT / sys.argv[1]
    rubric = load(ROOT / sys.argv[2])
    qid = answer_path.stem.split("_")[0]
    question = next(q for q in rubric.questions if q.id == qid)
    mark = question.marks[1]

    prompt = judge.verdict_prompt(mark.text, judge.anonymise(answer_path.read_text("utf-8")))
    print(f"prompt bytes: {len(prompt)}")
    argv = [
        "claude",
        "-p",
        prompt,
        "--model",
        rubric.judge_model,
        "--output-format",
        "json",
        "--allowedTools",
        "",
    ]
    done = subprocess.run(argv, capture_output=True, text=True, timeout=300, check=False)
    print(f"rc={done.returncode}")
    print(f"stdout[:600]: {done.stdout[:600]!r}")
    print(f"stderr[:600]: {done.stderr[:600]!r}")
    return 0

Activity · 13 steps
lines 34–34answer_path = ROOT / sys.argv[1]lines 35–35rubric = load(ROOT / sys.argv[2])lines 36–36qid = answer_path.stem.split("_")[0]lines 37–37question = next(q for q in rubric.questions if q.id == qid)lines 38–38mark = question.marks[1]lines 40–40prompt = judge.verdict_prompt(mark.text, judge.anonymise(answer_path.read_text("utf-8")))lines 41–41print(f"prompt bytes: {len(prompt)}")lines 42–52argv = [ "claude", "-p", prompt, "--model", rubric.judge_model, "--output-format", "json", "--allowedTools", "", ]lines 53–53done = subprocess.run(argv, capture_output=True, text=True, timeout=300, check=False)lines 54–54print(f"rc={done.returncode}")lines 55–55print(f"stdout[:600]: {done.stdout[:600]!r}")lines 56–56print(f"stderr[:600]: {done.stderr[:600]!r}")lines 57–57return 0

Flows