Skip to content

fix(harnesses): docker-* cells score a Harbor verifier's reward.json - #1011

Merged
napetrov merged 47 commits into
intel:mainfrom
vlad-perevezentsev:fix/docker-verifier-reward-json
Nov 26, 2026
Merged

napetrov merged 47 commits into
intel:mainfrom
vlad-perevezentsev:fix/docker-verifier-reward-json

Conversation

@vlad-perevezentsev

@vlad-perevezentsev vlad-perevezentsev commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The docker-* harnesses copied only /logs/verifier/reward.txt out of the task container. A Harbor verifier that writes reward.json alone 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. On onetbb-bounded-image-flow-graph the 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.

  • One reader of the verifier's reward, harnesses/verifier_reward.py. The reward-file helpers move out of command.py (where only docker_solver.py used them) into it, and it follows Harbor 0.24.0's rules:
    • reward.json is read when it exists, else reward.txt (harbor/verifier/verifier.py, Verifier.verify).
    • reward.json is a JSON object whose values are all finite numbers. The reward is its reward key, or its only key (harbor/cli/jobs.py _primary_reward, harbor/metrics/base.py aggregate_reward_dicts). It must be in [0, 1], as for a Harbor trial file.
    • A reward.json that is not such an object, has several keys and no reward, or has a reward outside [0, 1], errors the cell. So does one that is a directory (Harbor's reward_json_path.exists() takes it and then fails reading it). The files are copied with docker 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.0 environments/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. A reward.txt beside it does not stand in, since Harbor raises there too. A docker cp of either file that fails or times out errors the cell, as it did for reward.txt. Either file is decoded as strict UTF-8, as Harbor's read_text() does: a bad byte errors the cell instead of being replaced before parsing. A reward.txt whose labelled number is not between 0 and 1 is no reward: the label pattern read only the number's start, so reward: 1.5 scored 1.5 and reward: 10 or pass rate: 12/20 scored 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=3 is 0.5), which must be a number in full (a sentence's closing period cut) with no thousands comma, percent, / or of <digit> after it (reward: 1e3/20, 1.e3, 1,000, 1 / 20 are 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.5 is no reward; reward: n/a, latency: .5, reward: 1 on three lines is 1.0; Reward: then 0.75 is 0.75), while before it anything on the label's line may stand (| reward | 0.5 |, score, normalized: 0.8 read 0.5 and 0.8); a sign or point starts it only after a gap (.5e-1 is 0.05, v.5, ..5 are no reward, reward...0.5 is 0.5), and the first one between 0 and 1 is the reward (score: 75 then reward: 0.75 is 0.75; reward: 0.8. is 0.8).
    • fix(harness): a verifier that exits 0 without reward.txt errors the cell #695's rule stays: exit 0 with neither file errors the cell, and a non-zero exit with neither scores 0.0.
  • The cell dir keeps the verifier's own copy. Both reward files are removed before the copy-out (and before a docker-claude solve), 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.json keeps the reward's parts ({"reward": 0.5833, "diagnosis": 1.0, ...}).
  • command: harness: a reward.json under its run dir is read by the same rule, not by the first labelled number in its text. It still reads reward.txt first. A directory named reward.txt or reward.json under it is a reward file with no reward (no verdict), where it raised IsADirectoryError (also on main).
  • Harbor-backed cell: a trial result.json with one reward under another name ("rewards": {"accuracy": 0.5}) now scores it, as Harbor's _primary_reward does, instead of erroring.

Changed output

Recorded scores change: results[].reward, passed, pass_rate and the arm comparisons of every docker-* cell whose verifier writes reward.json.

verifier writes before after
reward.json {"reward": 0.7778, ...}, exit 0 errored: verifier exited 0 but wrote no /logs/verifier/reward.txt reward 0.7778, fail
reward.json {"reward": 1.0, ...}, exit 0 errored (same) reward 1.0, pass
reward.json + reward.txt 1 reward.txt: 1.0 reward.json's reward
reward.json {"score": 0.3, "recall": 0.6} + reward.txt 1 1.0 errored: /logs/verifier/reward.json has no 'reward' key among 2 rewards
neither, exit 0 errored: ... wrote no /logs/verifier/reward.txt; see run.log errored: ... wrote no /logs/verifier/reward.txt or reward.json; see run.log
reward.json is a directory, reward.txt 1 1.0 errored: /logs/verifier/reward.json is not a file but a directory
reward.json is a link to {"reward": 0.25} in the container, reward.txt 1 1.0 (the link's target looked up on the host, or none) 0.25
reward.json {"reward": 1, "gr\xffoup": 1} (a bad UTF-8 byte) errored (no reward.txt) / ignored errored: /logs/verifier/reward.json is not UTF-8 (...)
reward.txt reward: 1.5 / reward: 10 / pass rate: 12/20 1.5 / 1.0 / 1.0, pass errored: /logs/verifier/reward.txt has no reward between 0 and 1 in it
reward.txt only its value unchanged

For a command: harness's reward.json: {"group_score": 0.2, "reward": 0.9} was 0.2 and is 0.9. A bare 0.5, or several keys without reward, 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.json alone, with the uxl payload, gives 0.5833 and the cell dir keeps it;
    • it counts with a non-zero exit too;
    • with both files, reward.json wins and reward.txt is never copied;
    • an only key of another name is the reward, and reward.txt alone reads as before;
    • 12 malformed reward.json cases (empty, not JSON, bare number, array, {}, several keys without reward, a string, NaN, a non-number part, 1.5, -0.1, true) error the cell, also beside a reward.txt;
    • a failed copy of reward.json errors the cell, and reward.txt does not stand in;
    • exit 0 with neither file still errors the cell;
    • a stale reward.json or reward.txt from an earlier run is removed;
    • a reward.json copied 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 no reward.json;
    • a docker-claude cell run twice into one cell dir, the first verifier copying a directory, scores the second run;
    • a directory with a 0555 subdirectory is removed, and one that cannot be removed errors the cell;
    • a reward.json or reward.txt that is not UTF-8 errors the cell (also for a command: harness's reward.json: no reward);
    • a whole docker-oracle run() records 0.5833 as a fail;
    • six 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 (stale reward.txt, directory, read-only subdirectory, docker-claude rerun, command: directory, links, bad UTF-8, labelled numbers outside [0, 1]) each fail on the commit before their fix. docker cp -L checked on real Docker (python:3.12-slim): an absolute and a relative link copy their targets, a dangling one exits 1 with Could 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), the reward key wins over another key, and several rewards without reward still error the cell.

  • Live, Docker, docker-oracle on a copy of uxl-skills onetbb-bounded-image-flow-graph (6feb3f3; prebuilt python:3.12-slim, possible since fix(harnesses): run a Harbor task's prebuilt docker_image in docker-* harnesses #873), plus a copy whose answer.md keeps its first 5 lines:

    • main 6dfa30e: both cells errored, verifier exited 0 but wrote no /logs/verifier/reward.txt. The verifier's log shows it wrote "reward": 1.0 and "reward": 0.7778.
    • this branch: docker-oracle: 1/2 pass; the oracle scores 1.0 (pass) and the short answer 0.7778 (fail). The cell dirs hold reward.json.
    • bad input, this branch: a verifier writing reward.txt 1 and reward.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.txt read 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 turn chmod(0o700) into 0o701, which leaves the directory writable all the same (equivalent).

  • make ci-local --offline with main merged (refactor(repo): move the repo reach group out of commands/repo.py #1024 split commands/repo.py): pytest 26038 passed, 81 skipped, 0 failed; no row FAIL. Changed-line coverage 100%. docker_solver.py drops from 889 to 886 lines (baseline lowered).

  • Independent reviews before and after the first round found: a stale reward.txt left beside a new reward.json; the fragment overstating the command: rule; the Harbor trial's only-key rule; a docker-claude rerun failing on a copied directory; a read-only subdirectory left in place; the command: 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 nested reward.json raising RecursionError was fixed by @vchamarthi (910e79e, 2eadead). @napetrov found the replaced UTF-8 byte (0ad9db8), @vchamarthi the reward: 1.5 file, @napetrov a label reading another line's number (fa52f13; numbers like reward: 10 in 5216b07, 4b385be; exai-bot's reward: 1e3/20 in 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

  • A command: harness's printed score: 15, pass rate: 12/20, reward: 1e3, reward: -1 or reward: .1 on stdout/stderr still scores 1.0 from a digit inside the number (_REWARD_RE, as on main; reward: -0.5 prints as 0.5); reward files get the whole-token rule here, the printed output is left for a follow-up.
  • A command: harness still reads reward.txt before reward.json under its run dir, unlike Harbor. Its run dir is free-form, not Harbor's, so the order is left as it was (documented in coding-harnesses.md).
  • Recording the reward's parts (reward.json's other keys) in results[].metrics: they stay in the cell's copy of the file.

Notes

Checklist

  • Tests added/updated and pytest passes: test_docker_verify_reward_json.py, test_harbor_results.py; 26038 passed
  • ruff, mypy, and schema checks pass: make ci-local --offline, no row FAIL; no schema change
  • Docs updated (or N/A): coding-harnesses.md (Output Artifact, Harbor grading table, command: rule, cell files), contributing-terminal-bench-task.md (verifier contract)
  • Self-reviewed per "Before opening a PR" in AGENTS.md: mutations, the same bug class (the Harbor trial path, fixed here), bad input run live
  • Each new raise/exit and test names the doc, contract or issue it traces to: the malformed-reward.json errors follow Harbor 0.24.0 verifier.py (cited in verifier_reward.py); the tests cite coding-harnesses.md "Output Artifact" and Harbor's _primary_reward
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header: verifier_reward.py, the test file, the fragment

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>
@vlad-perevezentsev
vlad-perevezentsev requested a review from a team as a code owner November 19, 2026 15:05
@vlad-perevezentsev vlad-perevezentsev self-assigned this Nov 19, 2026
@exai-bot

exai-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 15 selected item(s).

CI at 449a700: 21 passing, 4 skipped.

Test notes (2)
  • dokimi/dokimi/harnesses/verifier_reward.py:186: With if value is not None and 0.0 <= value <= 1.0: changed to if value is not None and 0.0 < value <= 1.0:, the tests still pass: dokimi/tests/test_container_agent.py, dokimi/tests/test_docker_null_check.py, dokimi/tests/test_docker_task_md.py, dokimi/tests/test_docker_verify_reward.py, dokimi/tests/test_docker_verify_reward_json.py, dokimi/tests/test_harbor_results.py. A value exactly at the boundary gives the same result either way here, so no test says which one is meant.
  • dokimi/dokimi/harnesses/verifier_reward.py:189: With return next((v for v in _labelled_numbers(text) if 0.0 <= v <= 1.0), None) changed to return next((v for v in _labelled_numbers(text) if 0.0 < v <= 1.0), None), the tests still pass: dokimi/tests/test_container_agent.py, dokimi/tests/test_docker_null_check.py, dokimi/tests/test_docker_task_md.py, dokimi/tests/test_docker_verify_reward.py, dokimi/tests/test_docker_verify_reward_json.py, dokimi/tests/test_harbor_results.py. A value exactly at the boundary gives the same result either way here, so no test says which one is meant.
Review details
  • Commit reviewed: 449a700 against merge base 602de14
  • Coverage: 15 files in 3 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 303k tokens (169k from cache), 1m31s
  • Tool calls: 36 (20 file_read, 5 code_search, 5 pr_threads, 4 file_read_diff, 1 ci_status, 1 local_check_results)
  • Docker verifier reward parsing and focused tests: 7 files
  • Reward format compatibility updates and regression expectations: 5 files
  • Reward JSON documentation and changelog: 3 files

Comment on lines +57 to +58
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}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 99.21875% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.06%. Comparing base (602de14) to head (449a700).

Files with missing lines Patch % Lines
dokimi/dokimi/harnesses/verifier_reward.py 99.10% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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     
Files with missing lines Coverage Δ
dokimi/dokimi/harnesses/command.py 96.94% <100.00%> (-0.34%) ⬇️
dokimi/dokimi/harnesses/docker_solver.py 97.82% <100.00%> (ø)
dokimi/dokimi/harnesses/verifier_reward.py 99.10% <99.10%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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>
@antonwolfy

Copy link
Copy Markdown
Contributor

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 tests/test_growth_ratchet.py::test_no_file_or_function_grew_past_its_baseline: dokimi/commands/repo.py: 803 lines is over the 800 cap and has no baseline entry. The review will be posted once those checks are green.

@jharlow-intel jharlow-intel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@vchamarthi

Copy link
Copy Markdown
Contributor

🟡 Waiting on @vlad-perevezentsev · 3 commits on fix/docker-verifier-reward-json (746e0c4..2eadead)

Next: @vlad-perevezentsev: answer the 1 question below.

Changes

  • verifier_reward.py:54: RecursionError from json.loads is caught with ValueError.

Needs @vlad-perevezentsev

  1. Should docker cp get -L, so a reward.json that is a link inside the container is read as Harbor reads it, instead of erroring the cell? (dokimi/dokimi/harnesses/verifier_reward.py:81)
    Today a copied link errors the cell (/logs/verifier/reward.json is not a file but a symbolic link), as the PR text documents; -L would score the link target instead, changing that behaviour.
    • A: Add -L to the reward copies and score a linked reward file; drop the link-error branch and its tests
    • B: Keep erroring on a copied link

Threads and comments

  • Fixed (comment by @antonwolfy): Six test jobs fail the growth ratchet on commands/repo.py – Merged main; tests/test_growth_ratchet.py passes on the merge (46 passed), with the growth_baseline.json conflict resolved to the actual line counts.

Not this PR's

  • Fails on main too: Test Linux Python 3.11 – growth ratchet: dokimi/commands/repo.py 803 lines over the 800 cap, no baseline entry.
  • Fails on main too: Test Linux Wheels Python 3.11 – growth ratchet: dokimi/commands/repo.py over the 800 cap.
  • Fails on main too: Tests – growth ratchet: dokimi/commands/repo.py over the 800 cap.

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 · ⚠️ 2 tests removed or renamed

What each test shows
  • A deeply nested reward.json errors the cell with the not-JSON message: fails before, passes after.
  • Removed or renamed tests: test_a_line_that_breaks_the_version_1_shape_is_refused, test_first_useful_rate_keeps_a_cell_with_steps_past_the_bound_as_a_non_hit.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

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 antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-local with 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_json accepts true beside reward was not run. At this head {"reward": 1.0, "ok": true} scores 1.0.

Checked, no issues

  • Precedence and copy-out: reward.json is tried before reward.txt, a failed or timed-out docker cp stops 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.

@vlad-perevezentsev

Copy link
Copy Markdown
Contributor Author

@vlad-perevezentsev: fix what napetrov's thread on dokimi/dokimi/harnesses/verifier_reward.py:84 still finds. Approval waits on th…

@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 antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-local with 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/2 and reward: 1e3 all give no reward. reward: 0.5, reward: 0.8., reward: 1, reward: 5e-1 and score: 75 then reward: 0.75 still 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_json accepts true beside reward was 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.json is tried before reward.txt, a failed or timed-out docker cp stops 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>
@vlad-perevezentsev

Copy link
Copy Markdown
Contributor Author

@vlad-perevezentsev: fix what napetrov's thread on dokimi/dokimi/harnesses/verifier_reward.py:84 still finds. Approval waits on th…

@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.

@vlad-perevezentsev

Copy link
Copy Markdown
Contributor Author

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…

@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 vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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-1 and reward: .5e-1 give 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 · ⚠️ 12 broken variants of the changed code: 11 caught by the tests, 1 not · 1 mutation tried · 8 edge inputs tried

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>
@vlad-perevezentsev

Copy link
Copy Markdown
Contributor Author

🟡 Not approved yet · re-reviewed 5229ace Next: @vlad-perevezentsev: answer 1 open thread from ex…

@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 napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@vlad-perevezentsev

Copy link
Copy Markdown
Contributor Author

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 - Depe…

@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 napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@napetrov
napetrov merged commit 1248cab into intel:main Nov 26, 2026
25 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.

7 participants