Skip to content

fix(eval): test current Dokimi guidance - #1194

Open
napetrov wants to merge 22 commits into
intel:mainfrom
napetrov:fix/self-eval-guidance
Open

napetrov wants to merge 22 commits into
intel:mainfrom
napetrov:fix/self-eval-guidance

Conversation

@napetrov

@napetrov napetrov commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

- Compare guidance:none with guidance:raw on historical task bases
+ Keep task bases fixed and compare guidance:none with a pinned guidance revision
- Score mentions anywhere in a free-text review
+ Grade structured findings on seeded and clean diffs
  • Make AGENTS.md the root project guide and have it route PR reviewers to REVIEW.md. Add the exact checks for schema fixtures, docs links and CI exit status.
  • Include the actual reviewer files in the self-eval manifest. Guidance-only edits run the readiness scan. Harness edits trigger the null and oracle smoke checks.
  • Convert review-pr-conventions to seeded review grading and add review-clean-diff with a supported CLI flag as a decoy. Stage the built-in graders next to the exported eval content so the Docker daemon can mount them.

Evidence

  • Before, a prose answer explicitly dismissing all five defects scored 1.0. The regression test now gets 0.0. A valid boundary finding is credited by file and line, and a blocking claim about the supported flag fails the clean control.

  • 133 targeted tests passed. Both review tasks passed the Docker null/oracle check. The clean diff's eval grounding --threshold 0.6 command exited 0 on its historical base.

  • Before the review round, a four-cell Claude Haiku 4.5 smoke run passed the clean diff in both arms. The seeded run scored 1/5 without guidance and 2/5 with the pinned guidance. Each cell ran once.

  • Before the review round, all 11 Docker null/oracle checks passed. make ci-local ran with 0 failures, 38 passes and 15 skips. The full pytest suite passed 28,297 tests, and all 20 randomized repeats of the new tests passed. The local runner used Python 3.13 and the Claude client on PATH.

  • After the review round, 156 focused tests passed. Both review tasks passed their Docker null and oracle checks with the grader staged alongside the exported eval content.

The follow-up confirms the grader mount stays readable through a batch halt and is cleaned up when grading finishes. It also verifies stale grade removal and rejects findings that endorse the seeded threshold comparison. Both hosted review jobs passed with the shared-parent bind mount.

Merge Danger

Door Two-way.

Blast Radius Contributor guidance and Dokimi's repository evals. The task protocol changes for review runs. Keep structured-review results separate from earlier prose scores.

Keep task bases fixed when comparing guidance revisions. Score structured review findings and check false alarms on a clean diff.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@codecov-commenter

codecov-commenter commented Nov 25, 2026 •

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.12%. Comparing base (6d53955) to head (1e878aa).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1194      +/-   ##
==========================================
- Coverage   96.14%   96.12%   -0.02%     
==========================================
  Files         498      498              
  Lines       65888    65897       +9     
  Branches    11441    11442       +1     
==========================================
- Hits        63349    63345       -4     
- Misses       1570     1577       +7     
- Partials      969      975       +6     
Files with missing lines Coverage Δ
dokimi/dokimi/repos/grading.py 96.24% <100.00%> (+0.13%) ⬆️

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

@napetrov
napetrov marked this pull request as ready for review November 25, 2026 08:24
@napetrov
napetrov requested a review from a team as a code owner November 25, 2026 08:24
@exai-bot

exai-bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

CI at 1e878aa: 27 passing, 4 skipped.

Review details
  • Commit reviewed: 1e878aa against merge base 6d53955
  • Coverage: 19 files in 5 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 855k tokens (582k from cache), 1m1s
  • Tool calls: 67 (40 file_read, 15 code_search, 4 file_find, 3 file_read_diff, 2 ci_status, 2 local_check_results, 1 pr_threads)
  • Self-repository evaluation configuration, runner, CI, and tests: 6 files
  • Clean-diff review evaluation task: 3 files
  • Pull-request conventions review evaluation task: 3 files
  • Agent and code-review guidance: 3 files
  • Built-in grader mounting implementation, contract, and tests: 4 files

Comment thread .github/workflows/repo-eval-self.yml Resolved

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

🟡 Changes needed · reviewed 079f731

To fix: both review-task checks are red, and the guidance:rev: arm measures guidance that does not fit the pinned task base. The keyword and prompt points in the line comments are smaller.

✅ make ci-local --offline: tests, mypy, mutation, docs pass · ⚠️ schema_compat fails from main (opportunities.v1.json from #1082), not from this PR · ❌ GitHub self / repo tasks check for both review tasks · ✅ both oracles pass grade_seeds · ✅ grade_seeds on hand-made findings: one false credit, two misses (line comments)

Moving the review tasks to structured findings, with a clean-diff control, is the right direction.

Agreed with @exai-bot on the grader mount that Docker cannot see: replied in its thread with the cause and a fix.

Comment thread .agent-eval/README.md Resolved
Comment thread .agent-eval/run.py Resolved
Comment thread .github/workflows/repo-eval-self.yml Resolved

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

@napetrov, could you fix the problem I found (in the line comments), fix what the bot's thread on .agent-eval/tasks/review-clean-diff/task.json:6, the bot's thread on .agent-eval/tasks/review-pr-conventions/task.json:6, the bot's thread on .github/workflows/repo-eval-self.yml:49, the bot's thread on .agent-eval/tasks/review-clean-diff/task.json:6, the bot's thread on .agent-eval/tasks/review-pr-conventions/task.json:6, vlad-perevezentsev's thread on .agent-eval/README.md:68, vlad-perevezentsev's thread on .agent-eval/tasks/review-pr-conventions/manifest.json:30, vlad-perevezentsev's thread on .agent-eval/tasks/review-pr-conventions/manifest.json:11, vlad-perevezentsev's thread on .agent-eval/tasks/review-pr-conventions/task.json:5, vlad-perevezentsev's thread on .agent-eval/run.py:12 and vlad-perevezentsev's thread on .github/workflows/repo-eval-self.yml:52 still point out and answer my question below? Then push and I'll take another look.

My question before I approve:

  • A seeded review whose answer has no findings array gets pass: false from grade_seeds, and the new test checks that. Either make the contract say false for an answer with no findings array, or return pass: null there and change the assertion in test_seeded_review_rejects_a_prose_checklist_that_dismisses_the_defects.
Optional, for later (1)
  • dokimi/dokimi/repos/graders/review.py:225: A severity other than blocker, major or minor counts as not severe, so a clean-diff review that reports a blocking problem as critical passes (main has it too).

What I checked on 079f731: the 3 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (28,482 tests), apart from failures main has too; it merges cleanly onto main.

Comment thread dokimi/tests/test_self_repo_evals.py Resolved
- key_rename now needs the rename wording, not just both key names
- logic_off_by_one accepts ">=", "inclusive", "boundary"
- schema_in_place accepts "answers.v2", "new version", "in place"
- drop "Inspect the full diff" from both review prompts
- a minor-only clean review is asserted to pass
- README: review tasks have no process metrics; task base lacks files
  AGENTS.md names

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

vchamarthi commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

@napetrov, could you answer the question below? I'll ask for a re-review after that.
I've pushed 1 commit on fix/self-eval-guidance (079f731..67af9b7) so far.

Changes:

  • A clean-diff review whose only finding is minor is now asserted to pass.
  • key_rename keyword requires rename wording next to with_docs/without_docs.
  • logic_off_by_one and schema_in_place keywords accept the common wordings.
  • A nullable-score complaint using the word narrow is flagged as the decoy, not credited to schema_in_place.

Needs @napetrov:

  1. How should the grader mount be made visible to the Docker daemon? (dokimi/dokimi/repos/grading.py:209)
    _builtin_entry mounts GRADERS_HOST from site-packages (grading.py:209), which the runner's daemon cannot see.
    • A: Copy the graders next to the exported eval dir and mount that copy (changes grading.py)
    • B: Keep a repo-local grader for these two tasks

Threads and comments:

  • I answered each one in its thread: 6 fixed.

Left open:

  • .github/workflows/repo-eval-self.yml:52 (vlad-perevezentsev's thread): Kept as is: test_every_path_that_triggers_the_self_check_runs_the_smoke_set requires every paths: trigger ….
  • .agent-eval/tasks/review-pr-conventions/task.json:6 (exai-bot's thread): Same cause as the thread on review-clean-diff: the mount in grading.py:209; asked there.
  • .github/workflows/repo-eval-self.yml:49 (exai-bot's thread): Same cause: the mount in grading.py:209; asked on the review-clean-diff thread.
  • .agent-eval/tasks/review-clean-diff/task.json:6 (exai-bot's thread): Same cause: the mount in grading.py:209; asked on the other review-clean-diff thread.
  • .agent-eval/tasks/review-pr-conventions/task.json:6 (exai-bot's thread): Same cause: the mount in grading.py:209; asked on the review-clean-diff thread.

Not caused by this PR:

  • Outside the PR: dokimi/dokimi/repos/grading.py:209; _builtin_entry bind-mounts the installed package's graders directory, which a daemon on a different filesystem view cannot see (bind source path does not exist), so any dokimi: built-in grader fails eval check on that runner.

What I checked on the new commit:

  • 2 of 3 new tests fail before the fix and pass after it; the other passes before the fix too, so it guards the change rather than reproduce a bug.
  • 2 threads I marked fixed have no test of their own; the replies there say what changed.
  • The full test suite passes with main merged in (28,569 tests), apart from 1 failure main has too.
What each test shows
  • Minor-only clean review passes: passes.
  • key_rename needs the rename: fails before, passes after.
  • Seed keywords accept common wordings: fails before, passes after.
  • A nullable complaint saying narrow is the decoy: passes before the fix too.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g867zAjl
Thread: PRRT_kwDOVBg7g867zAjr
Thread: PRRT_kwDOVBg7g867zAjx
Thread: PRRT_kwDOVBg7g867zY0P
Thread: PRRT_kwDOVBg7g867zY0a
Thread: IC_kwDOVBg7g88AAAABq3to1Q
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674RrQ
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674Rq5
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674Rqw
Thread: PRR_kwDOVBg7g88AAAABaQi99Q
Thread: PRR_kwDOVBg7g88AAAABaV0UHA.a
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>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674Rq5
Thread: PRRT_kwDOVBg7g8674RrA
Test-narrowed: Guidance edits still trigger repo scan. The replacement workflow test checks every original path and expects Docker smoke tasks only where they can exercise a change.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674Rq5
Thread: PRRT_kwDOVBg7g8674RrA
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674Rq5
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g8674RrQ
Test-narrowed: Guidance edits still trigger repo scan. The replacement workflow test checks every original path and expects Docker smoke tasks only where they can exercise a change.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by vlad-perevezentsev

Both review-task checks are red, and the guidance arm measures guidance that does not fit the pinned task base.
Grader staging is in ef5700d. The historical fallback is in d0d36e2.

@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by vchamarthi

Either make the contract say false for an answer with no findings array, or return pass: null there.
Documented false in d0d36e2. #1230.

@napetrov

Copy link
Copy Markdown
Contributor Author

Re: comment by vchamarthi

How should the grader mount be made visible to the Docker daemon?
Option A in ef5700d.

@napetrov

Copy link
Copy Markdown
Contributor Author

Both review tasks now stage the built-in graders beside the exported eval content (ef5700d). The task documentation explains the historical base and system Python fallback (d0d36e2).

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

@napetrov, could you fix the 2 new problems I found and the 2 small things I've marked fix before merge (in the line comments) and answer my question below? Then push and I'll take another look.

My question before I approve:

  • Whether the daemon on the runner can see the parent of the eval directory, where the copy of the graders is now made (dokimi/dokimi/repos/grading.py:215). Confirm that the parent is visible to the daemon on the runner, or state in the docs that it must be.

What I checked on ee86250:

  • When I broke the changed code on purpose, the tests missed 6 of 12 breakages.
  • The 114 changed tests pass, and fail on main as expected.
  • The full test suite passes with main merged in (31,213 tests), apart from failures main has too.
  • It merges cleanly onto main.

f"{CONTENT_DIR}/{rel.as_posix()}", RUN_DIR]
return argv, [Mount(GRADERS_HOST, GRADERS_DIR, read_only=True)]
# The Docker daemon may see the exported content's parent but not the client's site-packages.
staging = Path(stack.enter_context(tempfile.TemporaryDirectory(prefix="graders-", dir=ctx.content_dir.resolve().parent)))

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.

Must fix: An interrupted grade run loses its grader copy: the copy is deleted when run_entry unwinds, though the grade run may still be going.
Input: a grade run, which is started with survives_halt=True (line 178), interrupted while the runner is still working.
Got: On the latest commit the copy under graders-…/graders is gone once run_entry unwinds, so the mount points at nothing while the grade run may still be going.

Suggestion: Keep the copy until the grade run has finished, for example by not removing it when the runner raises for a surviving grade run, or by staging it outside the with block and deleting it only after the run returns.

I tested this patch: it fixes the problem, and the tests still pass.

Patch
--- a/dokimi/dokimi/repos/grading.py
+++ b/dokimi/dokimi/repos/grading.py
@@ -44,6 +44,7 @@
     RUN_DIR,
     SOURCE_DIR,
     WORKSPACE,
+    BatchInterrupted,
     ContainerError,
     ContainerResult,
     ContainerRunner,
@@ -176,8 +177,13 @@
             _run_hidden_tests(ctx, task, run_dir, network, mounts, name)
         spec = ContainerSpec(image=ctx.image, argv=argv, workdir=WORKSPACE, mounts=mounts + extra + ctx.cache_mounts(),
                              env=ctx.grade_env(task), network=network, name=name, survives_halt=kind == "grade")
-        result = ctx.runner.run(spec, stdout=run_dir / f"{kind}.log", stderr=run_dir / f"{kind}.err",
-                                timeout_s=ctx.entry_timeout_s)
+        try:
+            result = ctx.runner.run(spec, stdout=run_dir / f"{kind}.log", stderr=run_dir / f"{kind}.err",
+                                    timeout_s=ctx.entry_timeout_s)
+        except BatchInterrupted:
+            if kind == "grade":  # the grade run may outlive the halt and still mount the copy
+                stack.pop_all()
+            raise
     if builtin is not None and result.returncode == _NOT_FOUND_EXIT and _python3_not_found_in_stderr(run_dir, kind):
         raise ContainerError(f"{task.raw['grader']} runs on the image's python3, and the image has none on PATH "
                              f"(`{kind}` exited {_NOT_FOUND_EXIT}; see {run_dir / f'{kind}.err'})")
@@ -212,7 +218,8 @@
     argv = ["python3", "-I", "-B", f"{GRADERS_DIR}/{BUILTIN_ENTRY}", kind, builtin,
             f"{CONTENT_DIR}/{rel.as_posix()}", RUN_DIR]
     # The Docker daemon may see the exported content's parent but not the client's site-packages.
-    staging = Path(stack.enter_context(tempfile.TemporaryDirectory(prefix="graders-", dir=ctx.content_dir.resolve().parent)))
+    staging = Path(tempfile.mkdtemp(prefix="graders-", dir=ctx.content_dir.resolve().parent))
+    stack.callback(shutil.rmtree, staging, ignore_errors=True)
     graders = shutil.copytree(GRADERS_HOST, staging / "graders", ignore=shutil.ignore_patterns("__pycache__"))
     # The package may have been installed with permissions that other UIDs cannot read.
     graders.chmod(0o755)
Details

I'd expect the copy to stay until the grade run ends, as on main, where the mount is the installed package. The cause is the ExitStack in run_entry, which removes the copy on any exit. I think a grader that imports a module after that point would fail; the test shows only that the copy is gone.

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.

I ran the actual halt logic with a stubbed Docker command. survives_halt=True keeps the runner waiting and the mount readable. Cleanup runs after grading returns. This is now tested, along with the oracle path where the halt kills the container.

Comment thread dokimi/dokimi/repos/grading.py Resolved
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868J1-q
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868J1-1
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868J1--
Thread: PRR_kwDOVBg7g88AAAABaZcM_g
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868J1-q
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g868J1-q
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by vchamarthi

Confirm that the parent is visible to the daemon on the runner, or state in the docs that it must be.
dfaacf7 documents the requirement. Hosted checks passed.

@napetrov

Copy link
Copy Markdown
Contributor Author

Both hosted review jobs passed on ee86250a1, confirming the staged mount is visible there. The current update documents the shared parent requirement, tests the mount across a batch halt and rejects findings that endorse the seeded threshold.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

# Conflicts:
#	.agent-eval/README.md
#	dokimi/docs/reviewing.md

This branch has not been deployed

No deployments
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.

5 participants