Repository navigation
fix(runner): an integer past the float range is unscored, not a crash - #1191
Conversation
`_num` in harnesses/runner.py converted with float(), which raises OverflowError for an integer such as 10**400. A reward that large aborted summarize_task_results and the tasks cell state. Three copies of `_num` existed; evidence_check's already refused it, but only by accident of its try/except. The three call sites now use dokimi.measure.as_float, the shared test that the gate, report and manifest already use. It refuses bools, nan, inf and an integer past the float range. commands/tasks.py no longer imports a private name from runner. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 6 selected item(s). CI at Review limit reached. This PR has had 6 reviews, so it will only be reviewed again when you ask. Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1191 +/- ##
==========================================
- Coverage 96.14% 96.13% -0.01%
==========================================
Files 498 498
Lines 65888 65884 -4
Branches 11441 11441
==========================================
- Hits 63349 63340 -9
- Misses 1570 1572 +2
- Partials 969 972 +3
🚀 New features to boost your workflow:
|
…k report Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
… the summary Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · checked 7243901 · nothing required from @napetrov
🔀 Merge: safe now · merges cleanly into current main, 3 commits behind, its tests pass on the merge · after it, #1190 needs a rebase (harnesses/runner.py)
✅ make ci-local --offline: 28,257 passed · ✅ the new tests fail on the base and with the fixes below reverted · ✅ a row with 10**400 in every numeric field goes through summary, report and completion check: shown as unscored, exit 1
dokimi tasks now counts a reward past the float range as unscored instead of crashing.
Fixed in this branch, up to 7243901:
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the small thing I've marked fix before merge (in the line comments) and answer my question below? I'll approve once that's done.
I'll approve once that's done.
My question before I approve:
- A
rewardofnanorinfnow shows asnullin the per-repeat table of the task report, where main showednanorinf, and atruereward shows asnullwhere main showed1. Say the report change in the changelog fragment, or keep showingnanandinfin the report.
Optional, for later (2)
dokimi/dokimi/harnesses/runner.py:162: Two rewards of1e308makeavg_rewardinf, where the mean is1e308:reward_sumoverflows before it is divided byreward_n(main has it too).dokimi/dokimi/harnesses/runner.py:164: Anelapsed_secof"12.5"now adds 0 seconds, where main adds 12.5.
What I checked on 7243901: the 19 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (28,818 tests), apart from failures main has too; it merges cleanly onto main; when I broke the changed code on purpose, the tests caught all 3 breakages.
A row with n_skill_invocations: 0 was not pinned by the overflow tests: changing >= 0 to > 0 in _count kept them green. Add a test asserting skill_invocation_n == 1 for such a row. Also type the overflow test rows and the as_float result so the type check passes. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Changes:
Threads and comments:
What I checked on the new commit: the 1 test of the fix pass; the full test suite passes with main merged in (28,863 tests), apart from 1 failure main has too. What each test shows
|
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABaVwHQA.a Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
The changelog now calls out how the report renders non-finite and boolean rewards. The zero-invocation regression is in @vchamarthi’s |
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the 2 earlier problems I raised, which still happen and fix the small thing I've marked fix before merge (in the line comments)? Then push and I'll take another look.
- The earlier problem still happens: two rows with
reward1e308now giveavg_rewardinf, where the mean is1e308. - The earlier problem still happens:
elapsed_sec"12.5"now gives0.0, where main gives12.5.
What I checked on 137255b: the 20 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (29,335 tests), apart from failures main has too; it merges cleanly onto main; when I broke the changed code on purpose, the tests caught all 3 breakages.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABaZa9LA.a Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABaZa9LA.b Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868Jzeu Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Summary
Three private
_numcopies (runner, evidence_check, commands/tasks) are replaced by the shareddokimi.measure.as_float, which the gate, report and manifest already use.commands/tasks.pystops importing a private name fromrunner.Evidence
summarize_task_results([{..., "reward": 10**400}])raisesOverflowError: int too large to convert to float(new teststest_summarize_task_results_counts_a_reward_beyond_the_float_range_as_unscored,test_tasks_completion_counts_a_reward_beyond_the_float_range_as_unscoredfail: 2 failed).After: both pass; the row counts as unscored (
1 unscored, exit 1);avg_rewardexcludes it.passes: 2), no confirmed blocking; see the change log in the description above.Merge Danger
Door: two-way. Internal helper swap; no persisted format, CLI flag or public name changes.
Behaviour change: a task row whose
rewardis an integer beyond the float range is now unscored instead of crashing.evidence_checknow gets a float instead of an int for small integer inputs; its verdict logic only compares them, so outputs are unchanged (probed on both trees).Blast radius: small. Only task-run summaries and the tasks completion check touch the path.
Not in scope, follow-ups:
dokimi/records.py_numberis a near-copy ofas_floatwith different int handling;eval/panel.py:332has the samefloat(int)shape.Fixes #1231
🤖 Generated with Claude Code