Skip to content

score.py: read trial results in sorted order so ties and the interval reproduce (methodology 1.10.4) - #29

Merged
reason-machines[bot] merged 1 commit into
mainfrom
reason/score-py-read-trial-resu-818fcfc2
Nov 23, 2026
Merged

reason-machines[bot] merged 1 commit into
mainfrom
reason/score-py-read-trial-resu-818fcfc2

Conversation

@reason-machines

Copy link
Copy Markdown
Contributor

On main (1378608), two tests in tests/test_score.py fail depending on the filesystem's directory order. This fails CI on #28 (run):

  • test_strict_requires_one_harness_digest expects | harness digest | 2: sha256:aaa (1), sha256:bbb (1) | but gets sha256:bbb (1), sha256:aaa (1)
  • test_cost_falls_back_to_the_reported_cost_when_usage_is_incomplete expects | token usage | 2: incomplete (1), unknown (1) |

Cause: trials() iterates job.glob("*/result.json") unsorted, so Counter.most_common() breaks ties in filesystem order.

Fix:

-    for path in job.glob("*/result.json"):
+    for path in sorted(job.glob("*/result.json")):

What else glob order changed (and no longer does)

  • 95% interval: ci95() is seeded, but it bootstraps task_means in by_task insertion order, which came from the glob. On a 40-task, 3-attempt synthetic tree, shuffled glob orders gave intervals of (0.417, 0.575), (0.425, 0.575) and (0.417, 0.583). With the fix, all orders give (0.417, 0.575).
  • Order of the paths listed under each --strict flagged check, and the last floating-point digit of the summed means.
  • Unchanged: pass@1, the screened score, slot selection (attempts are already sorted by (job, started_at, trial dir)), and cost.

Methodology: because a pass's interval can now differ from one computed before on another filesystem, this follows the patch-release convention (1.10.1–1.10.3) and adds 1.10.4 with a changelog row saying pass@1, screened and cost are unchanged.

Checks

  • Before (main's score.py, Path.glob forced to reverse order, python3 /tmp/rev_glob_run.py = unittest discover tests): FAILED (failures=2), the same two tests as CI
  • After, same harness: Ran 26 tests ... OK
  • After, python3 -m unittest discover -s tests, 3 runs in a row: OK each time
  • Interval invariance: sorted, reversed and 3 shuffled glob orders give an identical pass@1 and ci95 after the fix

… reproduce (methodology 1.10.4)

Co-authored-by: svemyh <40596752+svemyh@users.noreply.github.com>
@reason-machines
reason-machines Bot merged commit 05feaa5 into main Nov 23, 2026
5 checks passed
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.

0 participants