Repository navigation
fix(harnesses): docker-* cells score a Harbor verifier's reward.json - #1011
Conversation
The docker-* harnesses copied only /logs/verifier/reward.txt out of the task container. A Harbor verifier that writes reward.json alone, as the uxlfoundation/skills answer-quality tasks do, was graded by its exit code instead: exit 0 errored the cell since intel#695 (1.0 before it), and the verifier's partial reward was never read. The verifier's reward is now read in one module, verifier_reward.py, moved out of command.py, by Harbor 0.24.0's rules: reward.json is read when it exists, else reward.txt; it is a JSON object of finite numbers whose reward is its "reward" key, or its only key. One that is not, or whose reward is outside [0, 1], errors the cell, also beside a reward.txt, as does a failed docker cp of either file. A copy left in the cell dir by an earlier run is removed before the copy-out. A command: harness reads a reward.json by the same rule, instead of the first labelled number in its text. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…copy-out pull_reward removed each stale copy only when it reached that file, so a reward.txt from an earlier run stayed in the cell dir beside this run's reward.json. Remove every reward file first. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The fragment said a command: harness reads reward.json by the same rule; it keeps reading reward.txt first, and a reward.json with no reward by that rule errors the cell rather than being skipped. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
_harbor_reward read only verifier_result.rewards.reward, so a trial
whose verifier wrote one reward under another name ({"accuracy": 1})
errored the cell, while Harbor 0.24.0's _primary_reward (cli/jobs.py)
takes the only key. Pick it with the helper reward.json uses.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 15 selected item(s). CI at Test notes (2)
Review details
|
| if not isinstance(value, (int, float)) or (isinstance(value, float) and not math.isfinite(value)): | ||
| raise ValueError(f"has a reward {key!r} that is not a finite number: {value!r}") |
There was a problem hiding this comment.
Must-fix: reject booleans in every reward field.
Trigger: {"reward": 1.0, "correctness": true}.
Evidence: bool subclasses int, so this loop accepts true; the later boolean check validates only the primary reward.
Impact: Docker and command harnesses score this malformed object as a pass instead of rejecting it under the documented all-numeric-values contract.
Workaround: emit numeric component values. Reject isinstance(value, bool) in this loop and add an auxiliary-boolean regression case.
Severity justification: medium because this is a bounded but material verdict-validation failure.
There was a problem hiding this comment.
Not a defect, I think: the all-numeric check mirrors Harbor 0.24.0's _parse_reward_json, which accepts any isinstance(value, (int, float)), so a true beside the reward passes there, and VerifierResult(rewards={"reward": 1.0, "correctness": True}) validates (to 1.0). Rejecting it would error a cell Harbor scores. Only the reward itself must be a non-bool number in [0, 1], as _harbor_reward already requires for a trial file; the component values are not part of the verdict.
There was a problem hiding this comment.
Checked against Harbor 0.24.0's own code (Verifier._parse_reward_json run unchanged, then VerifierResult): {"reward": 1.0, "correctness": true} parses and validates to {'reward': 1.0, 'correctness': 1.0}, so Harbor scores that trial 1.0. Keeping the part as accepted matches it; the reward itself stays refused when it is a bool.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1011 +/- ##
==========================================
- Coverage 96.07% 96.06% -0.02%
==========================================
Files 496 497 +1
Lines 65209 65293 +84
Branches 11317 11337 +20
==========================================
+ Hits 62652 62724 +72
- Misses 1583 1588 +5
- Partials 974 981 +7
🚀 New features to boost your workflow:
|
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…cell docker cp copies a directory at /logs/verifier/reward.json, and pull_reward then moved on to reward.txt as if there were no reward.json. Harbor 0.24.0 takes any path there (reward_json_path.exists()) and fails reading it, so the cell is errored here too. A copied directory left in the cell dir is removed by the next run. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
e05eb5d left the directory docker cp copied at the cell's reward.json, and said the next run removes it. Only pull_reward could: a docker-claude rerun clears the reward files in _solve_claude first, with unlink, and failed there with IsADirectoryError on every rerun. The directory is now removed before the cell errors, and both sites clear the reward files through one helper that also removes a directory. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A command: harness read every rglob match of the two names, so a directory of that name under the run dir raised IsADirectoryError out of _find_reward (also on main). It is now a reward file with no reward in it: the cell has no verdict, and a reward file beside it still counts. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The docstring listed only the two returns; it also raises for a reward file that is not a file or holds no reward. The fragment is rewrapped at ~100 columns and names the command: harness's directory case (ff0b733). Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
a17bb99 cleared the reward files through one helper, one line less. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
… is removed clear_reward_files removed a copied directory with rmtree and retry_writable, which ignores a retry that fails: a 0555 subdirectory (docker cp keeps the verifier's modes) left the tree in the cell dir, and the next copy of a good reward.json landed inside it. Each directory is made writable first, top-down, and a tree still there errors the cell. The test now uses a 0555 subdirectory, which fails without it. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…is scored The directory case was tested on the oracle's _verify only. A docker-claude cell clears the reward files in _solve_claude before any verify: run it twice into one cell dir, the first verifier copying a directory, and the second run scores its reward. It fails on e05eb5d with IsADirectoryError. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…s the cell d18b28e's check after rmtree had no test: with rmtree a no-op, the directory stays and clear_reward_files raises 'could not remove ...'. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…the cell docker cp keeps a symbolic link at /logs/verifier/reward.json, and dest.is_file() follows it on the host: a link to a path the host lacks read as no reward.json, so reward.txt was scored, and a link to a host file read that file. A copied link is now not a file, like a directory: the cell errors and the link is removed. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
I reviewed this at 746e0c4 and found nothing in the change itself, but I am not approving while GitHub CI is red: 6 of the test jobs fail (Tests py3.11 and py3.14, Test Linux Python 3.11 and 3.14, Test Linux Wheels Python 3.11 and 3.14). Every one of them fails |
jharlow-intel
left a comment
There was a problem hiding this comment.
Thanks, looks good, the tests cover the odd cases well. The red Tests jobs are main's growth ratchet on commands/repo.py, which #1024 has since split, so merging main should clear them.
Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
json.loads raises RecursionError, not ValueError, on a reward.json nested past the interpreter's depth limit, so it escaped _json_reward. It is now caught with the other malformed inputs; a test pins it through a docker cell. Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
|
🟡 Waiting on @vlad-perevezentsev · 3 commits on Next: @vlad-perevezentsev: answer the 1 question below. Changes
Needs @vlad-perevezentsev
Threads and comments
Not this PR's
Verified on the new head: ✅ 1/1 tests fail before the fix, pass after · ✅ full suite with main merged in: 24261 passed · ✅ second reader: nothing raised · What each test shows
|
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
746e0c4 errored a cell whose verifier's reward.json is a symbolic link, since docker cp keeps the link and the host looked its target up. Harbor reads such a link (its docker /logs/verifier is a bind mount), so the reward files are now copied with docker cp -L: a link to a file in the container is read as that file, a dangling one is no reward file there, and a link to a directory errors the cell as a directory does. Tests that read a docker cp's paths by position now take them from the end of its argv. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Pins both ends of the [0, 1] range in a reward file beyond the exact 0/1 spellings (exai-bot's test note on intel#1011). Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
ebfe6bc's follow-check used \s, which crosses a line break: a reward line followed by a path line ('reward: 0.5\n/logs/verifier/test.log') or 'of 3 runs' on the next line was taken for a fraction or a count, and errored a cell main scored. It now looks at spaces and tabs only, and 'reward: 0.5 %' is a percent like 'reward: 0.5%'. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
antonwolfy
left a comment
There was a problem hiding this comment.
Review at 4b385be. The single reader of the verifier's reward holds up, and I found no bug or risk of my own. The merge waits on one of exai-bot's points that I could not check here, and there is one nit inline.
What I ran, on a Linux review host at 4b385be:
make ci-localwith Docker: 43 passed, 0 failed, 14 skipped (the skips are jobs that need another matrix leg, a service or a tool this run does not have).- A reproduction of the exponent case below against
reward_in_file, and the suggested pattern on seven inputs. - All 25 non-merge commits carry a
Signed-off-by.
Bot points I could not check:
- I could not check exai-bot's point on booleans in the other reward fields: Harbor 0.24.0 is not installed here, so the author's claim that its
_parse_reward_jsonacceptstruebesiderewardwas not run. At this head{"reward": 1.0, "ok": true}scores 1.0.
Checked, no issues
- Precedence and copy-out:
reward.jsonis tried beforereward.txt, a failed or timed-outdocker cpstops the search, and a copied directory errors the cell (verifier_reward.py:78). - Decoding: both files are decoded as strict UTF-8 (
verifier_reward.py:39), so a replaced byte cannot repair a verdict.
@vchamarthi Follow-up to my reply above: fa52f13 covered only reward: 1.5. Since 5216b07, 4b385be and b97ff68 a reward file's labelled number is read whole (sign, fraction, exponent; never a prefix of it), and the first one between 0 and 1 is the reward: reward: 10, pass rate: 12/20, reward: 1e3/20 are no reward, while reward: 0.8. and score: 75 then reward: 0.75 still read 0.8 and 0.75. |
antonwolfy
left a comment
There was a problem hiding this comment.
Review at df755b5. The merge waits on one of exai-bot's points that I could not check here. I found no bug or risk of my own, and my earlier thread on exponent fractions is fixed.
What I ran, on a Linux review host at df755b5:
make ci-localwith Docker: 43 passed, 0 failed, 14 skipped (the skips are jobs that need another matrix leg, a service or a tool this run does not have).reward_in_file("reward.txt", ...)on 15 labelled-number inputs:reward: 1e3/20,reward: 1e3%,reward: 1E3/20,reward: 1e-1/2andreward: 1e3all give no reward.reward: 0.5,reward: 0.8.,reward: 1,reward: 5e-1andscore: 75thenreward: 0.75still read 0.5, 0.8, 1.0, 0.5 and 0.75.- All 29 non-merge commits carry a
Signed-off-by.
Bot points I could not check:
- I could not check exai-bot's point on booleans in the other reward fields: Harbor 0.24.0 is not installed here, so the author's claim that its
_parse_reward_jsonacceptstruebesiderewardwas not run. At this head{"reward": 1.0, "ok": true}scores 1.0, and{"reward": true}is refused.
Checked, no issues
- Labelled numbers: a token is read whole and checked against a full number pattern, so no prefix of an exponent form can score (
verifier_reward.py:190). - Precedence and copy-out:
reward.jsonis tried beforereward.txt, a failed or timed-outdocker cpstops the search, and a copied directory errors the cell (verifier_reward.py:94). - Decoding: both files are decoded as strict UTF-8 (
verifier_reward.py:41).
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
@vchamarthi One more correction: "never a prefix of it" held only from 8fe6d79, ebfe6bc and df755b5 on (1.e3, 1,000, 1 / 20 slipped through b97ff68). The rule now: a label takes its token up to a separator, a number in full, with no thousands comma, percent, / or of after it on its line; reward=0.5;steps=3 and reward: 0.8. still read 0.5 and 0.8. |
@antonwolfy Thanks. On the boolean point, run against Harbor 0.24.0's own code (the sdist's harbor/verifier/verifier.py Verifier._parse_reward_json, taken out with ast and run unchanged, then models/verifier/result.py's VerifierResult): {"reward": 1.0, "ok": true} -> rewards={'reward': 1.0, 'ok': 1.0}, and {"reward": true} -> rewards={'reward': 1.0}. So Harbor scores both; this branch scores the first and refuses the second, as _harbor_reward already refuses a bool reward in a trial file. The script is a dozen lines; I can paste it if useful. |
vchamarthi
left a comment
There was a problem hiding this comment.
🟡 Not approved yet · re-reviewed 5229ace
Next: @vlad-perevezentsev: answer 1 open thread from exai-bot (below).
Blocking
- Still holds on this head: thread by exai-bot –
reward: -.5e-1andreward: .5e-1give 0.5 on the head, and main gives no reward for either, where the values are -0.05 and 0.05.
Verified on 5229ace: ✅ changed tests: 479 passed, fail on main · ✅ full suite with main merged in: 36648 passed · ✅ merges onto main ·
17 checks behind it, each with its evidence
| Area | What holds | How |
|---|---|---|
| Reward.json rules | A reward.json scores by its reward key or its only key, and an object with several keys and no reward errors the cell. Changed tests pass on the head: test_a_reward_json_with_one_key_of_another_name_is_that_reward, test_reward_json_comes_before_reward_txt_as_in_harbor, test_a_malformed_reward_json_errors_the_cell_even_beside_a_reward_txt |
tests on the head |
| Docker cp failures | A failed docker cp of either reward file, or a directory at its path, errors the cell and a reward.txt does not stand in. Pinned by test_a_failed_copy_of_reward_json_errors_the_cell_and_reward_txt_does_not_stand_in and test_a_reward_json_that_is_a_directory_errors_the_cell_and_reward_txt_does_not_stand_in, which pass on the head |
tests on the head |
| Links | A linked reward.json is read as its target through docker cp -L, and a dangling link is no reward file. Pinned by test_a_reward_json_that_links_to_a_file_in_the_container_is_read_as_that_file and test_a_dangling_reward_json_link_is_no_reward_json, which pass on the head |
tests on the head |
| Command: harness | A command harness reads reward.json by the same rule, and a reward file that is not UTF-8 gives no reward and no output fallback. Pinned by test_a_command_harness_reads_reward_json_by_the_same_rule and test_a_command_harness_reward_json_that_is_not_utf8_has_no_reward |
tests on the head |
| Reward.txt labels | The labelled-number cases of test_reward_file_accepts_partial_credit pin the separator, count, fraction and percent rules, for example reward: 0.5 %, reward: 1e3/20, pass rate: 1 of 20 and score: 75 then reward: 0.75 |
tests on the head |
| Merge | The PR merges onto main with no conflict | merge onto main |
ci-local run |
make ci-local --offline on the PR merged with main exits 0 |
full suite, main merged in |
| Labelled-number guard | Changing and not to or not on the label check at dokimi/dokimi/harnesses/verifier_reward.py:194 fails 8 cases in tests/test_task_formats.py, so the thousands, fraction and count guard is pinned |
broke the code, tests caught it |
| Equivalent mutant | The raise that the mutant adds after continue at dokimi/dokimi/harnesses/command.py:438 never runs, so that survivor is equivalent: a non-UTF-8 reward.txt gives None with no output fallback |
ran it |
| Text edges | An empty, whitespace-only, CRLF, non-ASCII-label or 100000-digit reward.txt gives the rule's result, and a non-UTF-8 one errors as not UTF-8 | ran it, edge input (text) |
| Number edges | nan, inf, reward: 1e400 and reward: 1.0000000001 give no reward; reward: 0 and {"reward": 0} give 0.0; a non-finite JSON value errors |
ran it, edge input (numbers) |
| Path edges | A missing output dir falls through to the printed output; a spaced, non-ASCII dir reads its reward.txt; no dir reads the printed output | ran it, edge input (paths) |
| Collection edges | An empty dir gives no reward, and a reward.txt (0.5) is read before a reward.json (0.9) | ran it, edge input (collections) |
| Exit and copy edges | Exit 0 with no reward file errors, exit 1 scores 0.0, a missing-file copy error is no failure and a daemon error is one | ran it, edge input (cli) |
| None edges | No output dir reads the printed output; primary_reward({}) is None; a single key is the reward |
ran it, edge input (none) |
| Structure edges | {}, [], a null or string reward, a truncated object, a boolean reward and two keys with no reward all error the reward.json |
ran it, edge input (structured) |
| Boundary edges | 0 and 1 are read as rewards in both files, and 1.0000001 is refused in a reward.json | ran it, edge input (boundary) |
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…ding point The pattern let the gap after a label take a leading '-.' or '.', so 'reward: .5e-1' read 5e-1 = 0.5 and 'reward: -.5e-1' read 0.5, where the numbers are 0.05 and -0.05 (exai-bot on intel#1011). The token may now start with a sign and a point, the gap being lazy takes the earliest start, and the number pattern accepts '.5': .5e-1 is 0.05, -.5e-1 none. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…ter a gap 75409d6 let the token start at any point before a digit, so 'reward: ..5', 'reward: -..5' and 'score v.5' read 0.5, and 'reward.1: 0.3' read 0.1, while 'reward...0.5' read nothing. A sign or point now starts the token only where no letter, digit, point or sign is before it, and a digit after an ellipsis of three or more points starts one, so 'reward...0.5' reads 0.5 again and '..1' is no reward, not 1.0. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
@vchamarthi The blocking thread (exai-bot, .5e-1 and -.5e-1) is fixed in 75409d6: the token keeps its sign and leading point, .5e-1 reads 0.05 and -.5e-1 is no reward. |
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 27880cb)
- Contract: changed. errors dokimi/dokimi/harnesses/docker_solver.py:656; errors dokimi/dokimi/harnesses/verifier_reward.py:46
- Responsibility: none
- Dependency: candidate (count signal only, no file:line)
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The previous signed-fraction finding is fixed. A reward label can still take a numeric value from a different line, changing the score of a passing cell. I compared the parser on this commit, the previous reviewed commit and the merge base. The focused harness suites passed (491 passed, one skipped).
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The gap after a label crossed lines and other fields: with 'reward: n/a', 'latency: .5' and 'reward: 1' on three lines the first label took .5 and the cell scored 0.5 (napetrov on intel#1011; 1.0 on main). The gap now stays in the label's field, not past a newline, ',', ';' or '|', so a label without a number gives way to the next one; a label alone on its line still takes the number at the start of the next ('Reward:\n0.75'). Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
ebfdd1a ended a label's field at a newline, ',', ';' or '|'. That let 'reward: n/a latency: 0.5', 'reward=nan steps=0.5' and a tab-separated form take the next field's number, and refused shapes main scored: '| reward | 0.5 |', 'reward, 0.5', 'score, normalized: 0.8', 'Final reward is:\n0.75'. Now anything on the label's line may come before its ':' or '=', and after it only spaces and punctuation, line breaks included, before the number: a word there (n/a, nan, a key) ends the label, which gives way to the next one. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The fragment said the number is never on another line, while a label that ends its line takes the next one; it now states the ':' rule of 8aab93c with an example each way. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head c1ecb43)
- Contract: changed. errors dokimi/dokimi/harnesses/docker_solver.py:656; errors dokimi/dokimi/harnesses/verifier_reward.py:47
- Responsibility: none
- Dependency: candidate (count signal only, no file:line)
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The previous missing-value case now scores 1.0 correctly. One compatibility regression remains in the text reader. With the new parser a verifier that writes a label on one line and its numeric reward on the next can turn a passing cell into an error. I checked the Docker reward-file verdict on this commit, the prior reviewed commit and the merge base. The six focused harness suites passed (508 passed, one skipped). GitHub also reports conflicts in docker_solver.py and growth_baseline.json.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…t line's number 8aab93c let a number on a later line count only after the label's ':' or '=', so 'Reward' then '1', or 'Final score' then '0.75', errored a cell main scored (napetrov on intel#1011). A label followed on its line by nothing but spaces or punctuation now takes the number that starts the next non-blank line; a word after it ('reward pending') still ends it. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…ation b6e61e1 let a label at the end of its line take the next line's number only when that line starts with it, so a table row '| reward |' then '| 0.5 |' errored a cell main scored. Punctuation may now come first on the next line, as after a ':'. 'reward (final)' then '0.7' stays no reward: a word after the label ends it. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…next one The comment and the fragment said 'alone on its line', while words may stand before the label; only what follows it on its line matters. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
@napetrov The conflicts with main (#848 in docker_solver.py and growth_baseline.json) are resolved in the merge c0edd77: _verify keeps #848's verifier flag and sets reward_file for a reward.json as well as a reward.txt. |
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 449a700)
- Contract: changed. errors dokimi/dokimi/harnesses/docker_solver.py:662; errors dokimi/dokimi/harnesses/verifier_reward.py:48
- Responsibility: none
- Dependency: candidate (count signal only, no file:line)
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
I rechecked the Docker reward-file reader against the previous commit and the merge base. The two-line Reward and Final score files again return 1.0 and 0.75, respectively. A missing reward followed by a latency field is also handled correctly. The earlier findings are addressed. Six harness suites passed locally (514 passed, one skipped), and CI is green. The Docker copy path was covered by the harness tests. I did not run a live container.
Summary
The
docker-*harnesses copied only/logs/verifier/reward.txtout of the task container. A Harbor verifier that writesreward.jsonalone is graded by its exit code: exit 0 errors the cell (since #695; before it, 1.0) and a non-zero exit scores 0.0. Every uxlfoundation/skills answer-quality task writes it that way (evaluation/harbor/shared/structured_answer.py), so those tasks never had their rubric score read. Ononetbb-bounded-image-flow-graphthe true rewards were 0.58–0.89 while dokimi recorded 1.0 for all 19 cells (before #695), and the arm delta read 0 instead of +0.17.harnesses/verifier_reward.py. The reward-file helpers move out ofcommand.py(where onlydocker_solver.pyused them) into it, and it follows Harbor 0.24.0's rules:reward.jsonis read when it exists, elsereward.txt(harbor/verifier/verifier.py,Verifier.verify).reward.jsonis a JSON object whose values are all finite numbers. The reward is itsrewardkey, or its only key (harbor/cli/jobs.py_primary_reward,harbor/metrics/base.pyaggregate_reward_dicts). It must be in [0, 1], as for a Harbor trial file.reward.jsonthat is not such an object, has several keys and noreward, or has a reward outside [0, 1], errors the cell. So does one that is a directory (Harbor'sreward_json_path.exists()takes it and then fails reading it). The files are copied withdocker cp -L: a link is followed in the container, where the verifier wrote it, and a dangling link is no file there. Harbor follows a link on the host through its bind-mounted/logs/verifier(harbor 0.24.0environments/docker/docker.py), which reads the same file only for a link inside that directory; for an absolute link dokimi reads the container's target where Harbor would miss it. Areward.txtbeside it does not stand in, since Harbor raises there too. Adocker cpof either file that fails or times out errors the cell, as it did forreward.txt. Either file is decoded as strict UTF-8, as Harbor'sread_text()does: a bad byte errors the cell instead of being replaced before parsing. Areward.txtwhose labelled number is not between 0 and 1 is no reward: the label pattern read only the number's start, soreward: 1.5scored 1.5 andreward: 10orpass rate: 12/20scored 1.0, a pass (also on main); a label in a reward file now takes its token up to a separator (reward=0.5;steps=3is 0.5), which must be a number in full (a sentence's closing period cut) with no thousands comma, percent,/orof <digit>after it (reward: 1e3/20,1.e3,1,000,1 / 20are no reward); after the label's:or=only spaces and punctuation may come before the number, on that line or the next ones, so a word there ends the label (reward: n/a latency: 0.5is no reward;reward: n/a,latency: .5,reward: 1on three lines is 1.0;Reward:then0.75is 0.75), while before it anything on the label's line may stand (| reward | 0.5 |,score, normalized: 0.8read 0.5 and 0.8); a sign or point starts it only after a gap (.5e-1is 0.05,v.5,..5are no reward,reward...0.5is 0.5), and the first one between 0 and 1 is the reward (score: 75thenreward: 0.75is 0.75;reward: 0.8.is 0.8).docker-claudesolve), a copied directory with read-only parts too, so a file from an earlier run of the cell is not left beside this run's verdict; a directory that errored the cell is removed before the error.reward.jsonkeeps the reward's parts ({"reward": 0.5833, "diagnosis": 1.0, ...}).command:harness: areward.jsonunder its run dir is read by the same rule, not by the first labelled number in its text. It still readsreward.txtfirst. A directory namedreward.txtorreward.jsonunder it is a reward file with no reward (no verdict), where it raisedIsADirectoryError(also on main).result.jsonwith one reward under another name ("rewards": {"accuracy": 0.5}) now scores it, as Harbor's_primary_rewarddoes, instead of erroring.Changed output
Recorded scores change:
results[].reward,passed,pass_rateand the arm comparisons of everydocker-*cell whose verifier writesreward.json.reward.json{"reward": 0.7778, ...}, exit 0verifier exited 0 but wrote no /logs/verifier/reward.txtreward0.7778, failreward.json{"reward": 1.0, ...}, exit 0reward1.0, passreward.json+reward.txt1reward.txt: 1.0reward.json's rewardreward.json{"score": 0.3, "recall": 0.6}+reward.txt1/logs/verifier/reward.json has no 'reward' key among 2 rewards... wrote no /logs/verifier/reward.txt; see run.log... wrote no /logs/verifier/reward.txt or reward.json; see run.logreward.jsonis a directory,reward.txt1/logs/verifier/reward.json is not a file but a directoryreward.jsonis a link to{"reward": 0.25}in the container,reward.txt1reward.json{"reward": 1, "gr\xffoup": 1}(a bad UTF-8 byte)reward.txt) / ignored/logs/verifier/reward.json is not UTF-8 (...)reward.txtreward: 1.5/reward: 10/pass rate: 12/20/logs/verifier/reward.txt has no reward between 0 and 1 in itreward.txtonlyFor a
command:harness'sreward.json:{"group_score": 0.2, "reward": 0.9}was 0.2 and is 0.9. A bare0.5, or several keys withoutreward, used to score 0.5 or the first labelled number; it now errors the cell (no verdict: exit N, reward file has no reward). Write{"reward": x}.Evidence
tests/test_docker_verify_reward_json.py(38 tests):reward.jsonalone, with the uxl payload, gives 0.5833 and the cell dir keeps it;reward.jsonwins andreward.txtis never copied;reward.txtalone reads as before;reward.jsoncases (empty, not JSON, bare number, array,{}, several keys withoutreward, a string,NaN, a non-number part, 1.5, -0.1,true) error the cell, also beside areward.txt;reward.jsonerrors the cell, andreward.txtdoes not stand in;reward.jsonorreward.txtfrom an earlier run is removed;reward.jsoncopied as a directory errors the cell, and the copy is removed; one that links to a file in the container is read as that file, and a dangling link is noreward.json;docker-claudecell run twice into one cell dir, the first verifier copying a directory, scores the second run;reward.jsonorreward.txtthat is not UTF-8 errors the cell (also for acommand:harness'sreward.json: no reward);docker-oraclerun()records 0.5833 as a fail;command:harness cases, two of them a directory named like a reward file.Against main's code, 24 of the 25 tests then in the file fail. The one that passes is the
reward.txt-only case, which pins today's behaviour. The cases added in review (stalereward.txt, directory, read-only subdirectory,docker-claudererun,command:directory, links, bad UTF-8, labelled numbers outside [0, 1]) each fail on the commit before their fix.docker cp -Lchecked on real Docker (python:3.12-slim): an absolute and a relative link copy their targets, a dangling one exits 1 withCould not find the file ..., a link to a directory copies the directory.tests/test_harbor_results.py: a trial's only reward is its reward (fails on main), therewardkey wins over another key, and several rewards withoutrewardstill error the cell.Live, Docker,
docker-oracleon a copy of uxl-skillsonetbb-bounded-image-flow-graph(6feb3f3; prebuiltpython:3.12-slim, possible since fix(harnesses): run a Harbor task's prebuilt docker_image in docker-* harnesses #873), plus a copy whoseanswer.mdkeeps its first 5 lines:verifier exited 0 but wrote no /logs/verifier/reward.txt. The verifier's log shows it wrote"reward": 1.0and"reward": 0.7778.docker-oracle: 1/2 pass; the oracle scores 1.0 (pass) and the short answer 0.7778 (fail). The cell dirs holdreward.json.reward.txt1andreward.json{"score": 0.3, "recall": 0.6}errors the cell:RuntimeError: /logs/verifier/reward.json has no 'reward' key among 2 rewards; see run.log.Mutations by hand, each caught:
reward.txtread first (15 tests fail), no stale-file removal, no only-key rule, a failed copy ignored, no value-type check.make ci-local's mutation step: 38 of 40 killed; the 2 survivors turnchmod(0o700)into0o701, which leaves the directory writable all the same (equivalent).make ci-local --offlinewith main merged (refactor(repo): move the repo reach group out of commands/repo.py #1024 splitcommands/repo.py): pytest 26038 passed, 81 skipped, 0 failed; no row FAIL. Changed-line coverage 100%.docker_solver.pydrops from 889 to 886 lines (baseline lowered).Independent reviews before and after the first round found: a stale
reward.txtleft beside a newreward.json; the fragment overstating thecommand:rule; the Harbor trial's only-key rule; adocker-claudererun failing on a copied directory; a read-only subdirectory left in place; thecommand:directory case; the feat(tasks): docker-null checks the untouched start fails its tests #848 note below. Each is fixed in its own commit. A deeply nestedreward.jsonraisingRecursionErrorwas fixed by @vchamarthi (910e79e, 2eadead). @napetrov found the replaced UTF-8 byte (0ad9db8), @vchamarthi thereward: 1.5file, @napetrov a label reading another line's number (fa52f13; numbers likereward: 10in 5216b07, 4b385be; exai-bot'sreward: 1e3/20in b97ff68; the whole-token rule in 8fe6d79, ebfe6bc and df755b5, 75409d6, 27880cb, ebfdd1a and 8aab93c; a fuzz over 579194 short texts found no prefix read).Not in this PR
command:harness's printedscore: 15,pass rate: 12/20,reward: 1e3,reward: -1orreward: .1on stdout/stderr still scores 1.0 from a digit inside the number (_REWARD_RE, as on main;reward: -0.5prints as 0.5); reward files get the whole-token rule here, the printed output is left for a follow-up.command:harness still readsreward.txtbeforereward.jsonunder its run dir, unlike Harbor. Its run dir is free-form, not Harbor's, so the order is left as it was (documented incoding-harnesses.md).reward.json's other keys) inresults[].metrics: they stay in the cell's copy of the file.Notes
git merge-treereports conflicts indocker_solver.py_verifyandscripts/growth_baseline.json. feat(tasks): docker-null checks the untouched start fails its tests #848 setsverifier["reward_file"] = Truewherereward.txtwas pulled. That block is nowpull_reward(...), so whichever PR lands second setsverifier["reward_file"] = reward is not Noneright afterreward, copy_error = pull_reward(...). Then areward.jsoncounts fornull_status'sexplicit_rewardtoo.Checklist
pytestpasses:test_docker_verify_reward_json.py,test_harbor_results.py; 26038 passedruff,mypy, and schema checks pass:make ci-local --offline, no row FAIL; no schema changecoding-harnesses.md(Output Artifact, Harbor grading table,command:rule, cell files),contributing-terminal-bench-task.md(verifier contract)AGENTS.md: mutations, the same bug class (the Harbor trial path, fixed here), bad input run liveraise/exit and test names the doc, contract or issue it traces to: the malformed-reward.jsonerrors follow Harbor 0.24.0verifier.py(cited inverifier_reward.py); the tests citecoding-harnesses.md"Output Artifact" and Harbor's_primary_rewardverifier_reward.py, the test file, the fragment