Repository navigation
Keep a cached grade only for the same selection - #45
Conversation
Run ids are fixed labels, so a task that is re-run writes its new rollout under the same run id. cli.judge._merge took "same run id" to mean "same rollout" and kept the old graded row when the re-judge of the new rollout failed, reporting a score for a deliverable that no longer exists. Stamp each selection record with selected_at when it is written, carry it on Scored, and keep the old graded row only when both the run id and the stamp match. Rows and summaries without a stamp behave as before. Fixes google-research#44
|
@Bortlesboat DTWD I reviewed this because my #36 makes tasks re-run on resume when their selection or experience prompts change, and each of those re-runs could hit the stale-grade problem this PR fixes. The approach looks right to me:
Agreed on not hashing the run dir, since LAB writes into it while grading. Receipts, offline, calling _merge directly on this PR at 157ba5e: _merge(old graded row, new failed re-judge): tests.test_workflow -k failed_rejudge Ran 1 test ... OK Your test already covers the resume-vs-re-run stamps. The first and last rows above cover upgrading: existing scores survive, and a task re-run after the upgrade correctly drops its stale score. For the maintainers: this conflicts with #32, #36, #37 and #6 only in tests/test_workflow.py, where each PR adds its own tests and both sides can be kept. Whichever merges second needs a quick rebase. EDIT: #32, #36 and #37 now merge cleanly with this PR; their tests moved into separate files. |
Fixes #44.
Run ids are fixed labels, so a task that is re-run (a partial task on resume, for example) writes its new rollout under the same run id.
_mergeincli/judge.pytreated "same run id" as "same rollout", so when the next judge call failed it kept the grade of the rollout that had been replaced, and the report showed a score for a deliverable that no longer exists.This stamps each selection record with
selected_atwhen_run_one_modewrites it, carries the stamp onScored, and makes_mergekeep the old graded row only when the run id and the stamp both match. A transient judge failure on an unchanged task still keeps its score. A re-run task whose new judge call fails is left ungraded. Olderjudged.jsonrows and summaries have no stamp, so they compare equal and behave exactly as before.I went with a stamp on the selection record rather than hashing the run dir at judge time because the LAB adapter writes
scores.jsonandjudge.loginto the run dir when it grades, so a content hash would change after the first successful judge.Tested with the repro script from #44 (judge 2 now prints
None/None graded=False) andpython3 -m unittest tests.test_workflowon Python 3.12, which adds a regression test covering both the transient-failure and re-run cases.