Repository navigation
/evaluate: grade with main's evaluator and keep submission code away from the write token - #254
Merged
Merged
Conversation
…from the write token The workflow ran automation/process_pr_submission.py from the base branch, but the script then checked out the PR head and ran that branch's validator, evaluator and lockfile. Fixes merged to main didn't apply until a contributor rebased, and code in a submission branch ran in a job whose token could post PR comments and update checks. - The script now creates its worktree from the base branch and copies in only the submission's data files from the PR: its prediction, robustness and config files, prices for models it adds (models already priced keep main's price), and the names it adds to universal_model_names.py, which is parsed, not imported. Other files the PR changes are listed in the log. - The workflow is split into three jobs. Only the evaluate job runs submission code (LiveCodeBench answers are executed), with a read-only token and no stored credentials; it hands metrics.json to the report job, which accepts only numbers from it. - The router name is checked against [A-Za-z0-9._-] and passed through env instead of being expanded into scripts. - The results comment names the evaluator commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/evaluateranautomation/process_pr_submission.pyfrom the base branch, but that script then checked out the PR head and ran the PR branch's validator, evaluator and lockfile. Two consequences:main(for example the LiveCodeBench fixes in Limit memory of LiveCodeBench test processes #239, Fix LiveCodeBench scoring of single-quoted __main__ guards #230 and Fix LiveCodeBench stdin tests for solutions that read sys.stdin.buffer #234) don't apply to a submission until its author rebases. The results posted on Divyam router submission #232, Add BizRouter submission (balanced Smart Routing) #229 and Add nuroutev2-artemis (NuRoute Artemis Task) #224 were graded this way; the re-grade in Re-grade the 25 leaderboard routers with the current evaluator #253 replaced them.pull-requests: writeandchecks: write, and the base checkout stored that token in.git/config. A submission could have changed its own scorer or posted a fake results comment. It could not push code, and no submission so far has modifiedllm_evaluation/.Change
Grade with the base branch's code. The script now creates its worktree from the base branch and copies in only the submission's data, read straight from git objects (symlinks are refused):
model_cost.jsonkeepmain's price, and a PR that edits an existing price gets a warning in the log. Only the PR's own edits count, so a branch made from an oldermaindoesn't undo later price changes.universal_model_names.py, which is parsed, not imported.Other files the PR changes are listed in the log and not used.
Keep submission code away from the write token. The workflow is now three jobs:
startacknowledges the comment and creates the check;evaluateruns the grading withcontents: readandpersist-credentials: false. This is the only job that runs submission code, because LiveCodeBench answers are executed;reportreadsmetrics.jsonfrom an artifact, accepts only numbers from it, posts the comment and completes the check.Safer inputs. The router name must match
[A-Za-z0-9._-]+and is passed to steps throughenvinstead of being expanded into scripts. The entry-count check runs Python with-I, so a module planted in the PR checkout can't be imported.Evaluator in the comment. The results comment names the evaluator commit.
README. The submission section says which files are taken from the branch.
Testing
main, andmain'scheck_config_prediction_files.py --check-generated-resultpassed for each.main's price kept; a pricemainchanged after the PR branched is not flagged; names containing quotes round-trip; a symlinked prediction file and a names list built by code are both refused.issue_commentworkflows always run from the default branch, so the new workflow can only run live after merge. I'll re-run/evaluateon Add Corealis Router submission #235, which was promised there anyway, and check the run log and comment.The re-grade workflow (
regrade-all.yml) only grades merged files onmain, so it is unchanged.🤖 Generated with Claude Code