Skip to content

fix(repo): a budget stop that kept its results exits 3 in repo run and repo hits judge - #1463

Merged
xaleryb merged 4 commits into
intel:mainfrom
antonwolfy:fix/budget-stop-exit-3
Dec 1, 2026
Merged

xaleryb merged 4 commits into
intel:mainfrom
antonwolfy:fix/budget-stop-exit-3

Conversation

@antonwolfy

Copy link
Copy Markdown
Contributor

Summary

The exit-code table in docs/quickstart.md gives exit 3 to a run that stopped short because a budget ran out and kept its partial output. repo run --max-usd and repo hits judge --max-usd did that and exited 1.

Command Input on main Exit on main Exit now
repo run --reps 2 --max-usd 0.01 --max-usd-per-cell 0.5 the first cell runs and keeps its result.json; the second is 1 not started (batch budget) 1 3
repo hits judge --max-usd 0.5 --json with an unpriced judge one call, status budget_stopped, the judged cells keep their hits_judged.json 1 3
repo hits judge --max-usd 1 with $0.40 calls three calls, one cell left without a file 1 3

Order of precedence for a repo run batch, which the table did not give: a cell that crashed of the machinery is 5, then an error or a failed probe is 1, then a budget stop alone is 3. A batch with both a budget stop and an error exits 1, because a defect outranks an inconclusive result. A repo hits judge run whose judge call failed still exits 1 (or 2 for an output that cannot be written).

Closes #1372

Closes #1373

Changes

  • _exit_of_batch in dokimi/dokimi/commands/repo_run.py checks infra crash (5), then error or failed probe (1), then budget_stopped (3, EXIT_INCONCLUSIVE); its docstring says so. A batch with no budget stop exits as before, and so does the no-result case (1).
  • _judge in dokimi/dokimi/commands/repo_hits.py exits 3 on done.stopped; a failed judge call still goes through _stopped / _failed_after_calls.
  • docs/quickstart.md (row 3 and the text after the table) and docs/repo-evaluation-contract.md (--max-usd of repo run and of repo hits judge, §4.5) say exit 3 and name the 1 for an error or a failed judge call.
  • Tests that pinned exit 1 on a budget stop now pin 3: test_repo_run.py::test_timed_out_cell_counts_toward_batch_budget, and in test_repo_hits_judge.py and test_repo_hits_judge_cost.py the four tests of an unpriced stop and a cap stop. The failed-call tests in test_repo_hits_judge.py (exit 1) are unchanged. New tests/test_repo_run_batch_exit.py covers the order of precedence from summaries.
  • Changelog fragments (Fixed), one per issue.

Risk

A script that treats any non-zero exit of repo run --max-usd or repo hits judge --max-usd alike sees no change; one that tests for exactly 1 on a budget stop now gets 3. Exit 1 is kept for an error, a failed probe, a failed judge call and a batch with no result.

Merges with open PRs: #1184 edits row 4 of the exit-code table, next to the row 3 this PR rewrites, so the two conflict in docs/quickstart.md and the later one to merge rebases. #1190 and #1416 change the from dokimi.utils import InputError import of repo_hits.py, next to the exit_codes import this PR changes, so they conflict there by a line. #1413, #1420, #1458 and #1197 merge cleanly with this branch and touch none of the lines changed here.

Testing

On Linux, at fe97824f (on main e1f77404):

  • make ci-local: 38 passed, 0 failed, 16 skipped (docker external-catalog smoke, mutation-diff comment package, pinned Claude Code install, jobs that do not run on a PR, matrix jobs, conda-forge, fuzz, semgrep). 32011 tests passed, 27 skipped; changed-line coverage 100%.
  • On main's code, the new and changed tests fail: test_repo_run_batch_exit.py 1 failed, 8 passed (assert 1 == 3); test_repo_run.py::test_timed_out_cell_counts_toward_batch_budget fails (assert 1 == 3); test_repo_hits_judge.py and test_repo_hits_judge_cost.py 4 failed, 70 passed (assert (1, 1, 1) == (3, 1, 1) among them).
  • Mutants: checking budget_stopped before an error or a failed probe fails the two budget-plus-error and budget-plus-probe cases; checking it before the infra crash fails the budget-plus-infra case; exiting 3 only under --json fails the two text-mode repo hits judge tests.
  • Not run: the other Python versions (3.11, 3.12, 3.14); a real docker run of repo run (the tests use the fake runner); a real judge model.

Open questions

None.

Revert

A plain revert restores exit 1 for both budget stops. Nothing is stored.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

…cells were not started (intel#1372)

`repo run --max-usd` counted the cells its batch budget left unstarted in `budget_stopped` and kept the finished cells' results, but `_exit_of_batch` exited 1 for it, while the exit-code table gives exit 3 to a run that stopped short on a budget and kept its partial output.

`_exit_of_batch` now orders the reasons: a cell that crashed of the machinery is 5, then an error or a failed probe is 1, then a budget stop alone is 3 (`EXIT_INCONCLUSIVE`). A batch with a budget stop and an error exits 1: a defect outranks an inconclusive result. The no-result case stays 1. The quickstart exit-code table, the text after it and the repo evaluation contract say so, and `test_timed_out_cell_counts_toward_batch_budget` pins 3. New `tests/test_repo_run_batch_exit.py` covers the order from summaries.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
… stops it (intel#1373)

`repo hits judge --max-usd` stopped by the cap or by a call with no price writes the cells it judged and emits status `budget_stopped`, but exited 1, while the exit-code table gives exit 3 to a run that stopped short on a budget and kept its partial output.

A `done.stopped` run now exits 3 (`EXIT_INCONCLUSIVE`); a failed judge call (`JudgeFailing`, an input or infrastructure error) keeps its exit code. The quickstart exit-code table, the text after it and the repo evaluation contract say so, and the four tests that pinned exit 1 on a budget stop pin 3.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy
antonwolfy requested a review from a team as a code owner December 1, 2026 01:00
@antonwolfy antonwolfy self-assigned this Dec 1, 2026
Copilot AI balanced review requested due to automatic review settings December 1, 2026 01:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

CLI help and documentation still misstate budget-stop exit codes, infrastructure-error precedence, and the requirement for three consecutive judge failures of the same kind before exit 1.

3 open issues
What changed in this PR

3 new findings. This PR aligns budget-stop exits in repo run and repo hits judge with the CLI’s inconclusive-result contract, addressing #1372 and #1373.

Changes:

  • Returns exit 3 for budget-only stops while preserving error and infrastructure-failure precedence.
  • Updates budget-stop regression tests and adds batch exit-precedence coverage.
  • Documents the revised behavior in the quickstart, evaluation contract, and changelog.
File Description
dokimi/​tests/​test_repo_run.py Expects exit 3 when the batch budget stops further cells.
dokimi/​tests/​test_repo_run_batch_exit.py Adds coverage for batch exit-code precedence.
dokimi/​tests/​test_repo_hits_judge.py Updates capped and unpriced judge-stop expectations.
dokimi/​tests/​test_repo_hits_judge_cost.py Expects exit 3 alongside budget-stop JSON output.
dokimi/​dokimi/​commands/​repo_run.py Classifies budget-only stops as inconclusive.
dokimi/​dokimi/​commands/​repo_hits.py Returns exit 3 when budget limits leave judging unfinished.
dokimi/​docs/​repo-evaluation-contract.md Documents budget-stop exits for both commands.
dokimi/​docs/​quickstart.md Revises the exit-code table and explanatory text.
dokimi/​changelog.d/​20261201_120100_repo-hits-judge-budget-stop-exit-3.md Records the judge budget-stop exit change.
dokimi/​changelog.d/​20261201_120000_repo-run-budget-stop-exit-3.md Records the batch budget-stop exit change.

Review effort: Balanced

Comment thread dokimi/docs/quickstart.md Resolved
Comment thread dokimi/docs/quickstart.md Resolved
Comment thread dokimi/dokimi/commands/repo_run.py Resolved
@exai-bot

exai-bot commented Dec 1, 2026 •

Copy link
Copy Markdown

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

CI at `4d2bfc1`: 1 failing, 25 passing, 4 skipped

The only failing check is CodeQL (actions), blocked by a runner/tool-bundle extraction failure rather than this change. The other 29 checks passed or were skipped, including successful CodeQL Python analysis. Retry the failed job; no source-code fix is supported by the evidence.

Check Status Assessment
CodeQL (actions) failing at step Run github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 Infrastructure or flaky. CodeQL initialization failed while extracting the downloaded CLI bundle into the runner tool cache, before analysis ran. The diff only changes Python exit-code handling, tests, and documentation; it does not change the CodeQL workflow or tool installation.
Review details
  • Commit reviewed: 4d2bfc1 against merge base e1f7740
  • Coverage: 10 files in 2 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 302k tokens (189k from cache), 39s
  • Tool calls: 37 (24 file_read, 3 code_search, 3 file_read_diff, 3 local_check_results, 2 ci_status, 1 ci_log_search, 1 file_find)
  • Repo run budget-stop exit code and batch behavior: 5 files
  • Repo hits judge budget-stop exit code and evaluation contract: 5 files

Comment thread dokimi/docs/quickstart.md Resolved
@codecov-commenter

codecov-commenter commented Dec 1, 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.30%. Comparing base (e1f7740) to head (4d2bfc1).
⚠️ Report is 4 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1463      +/-   ##
==========================================
- Coverage   96.30%   96.30%   -0.01%     
==========================================
  Files         515      515              
  Lines       68905    68910       +5     
  Branches    11932    11933       +1     
==========================================
+ Hits        66360    66364       +4     
+ Misses       1568     1567       -1     
- Partials      977      979       +2     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/repo_hits.py 95.20% <100.00%> (ø)
dokimi/dokimi/commands/repo_run.py 97.31% <100.00%> (+0.01%) ⬆️

... and 8 files with indirect coverage changes

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

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

@antonwolfy, could you fix the problem I found (in the line comments) and fix what the bot's thread on dokimi/docs/quickstart.md:277, the bot's thread on dokimi/docs/quickstart.md:278, the bot's thread on dokimi/dokimi/commands/repo_run.py:511 and the bot's thread on dokimi/docs/quickstart.md:277 still point out? Then push and I'll take another look.

What I checked on fe97824: the 177 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (35,588 tests), apart from failures main has too; it merges cleanly onto main; when I changed the code on purpose, the tests caught all 5 changes.

Comment thread dokimi/dokimi/commands/repo_run.py Resolved
A rerun after earlier invocations spent --max-usd starts no cell and keeps
nothing, so it is the no-result exit 1 (docs/quickstart.md exit 3 needs a
kept partial output); it exited 3. Suggested in review.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
… return

repo run --help and repo hits judge --max-usd help still said exit 1 for a
budget stop; the quickstart said a crashed cell exits 1 (an infrastructure
crash exits 5) and that any failed judge call exits 1 (only 3 in a row with
one error stop the run; a single one leaves its pair unjudged).

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
@xaleryb

xaleryb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor
  • Run: the full suite, ruff, mypy, bandit -ll, check_growth, check_comment_blocks, docs check --strict and the CLI snapshot on head + main (Linux, Python 3.13). The only failure is the mcp-less host test that also fails on main.
  • Two repo run invocations on one batch with --max-usd 0.01 --max-usd-per-cell 0.5, where the second selects another arm (0 ran, 0 already done, 1 not started) -> exit 3 -> expected 1. Nothing was kept, and the quickstart's exit 3 needs a kept partial output (the repo_run.py:510 thread).
  • Quickstart row 3 and the text after it say a crashed cell exits 1 (a machinery crash exits 5) and that a failed judge call exits 1 (only 3 in a row with one error do; a single failure exits 0). repo run --help and the repo hits judge --max-usd help still say exit 1 for a budget stop.
  • Pushed:
    • 84e2dfc: a batch whose budget starts no cell exits 1, with tests (end to end, plus the rerun-with-done-cells case that stays 3).
    • 4d2bfc1: help, quickstart, contract and changelog give the exit codes the code returns.
  • Left for the author: nothing beyond these.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Tests miss 1 of 18 small breaks of the lines this PR changes

At 4d2bfc1: 17 caught · 1 missed

Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Where Operator Change no test notices Tests reaching the line
dokimi/dokimi/commands/repo_run.py:512 drop-clause not summary["ran"] and not summary["skipped"] → (not summary["ran"]) 4

Not checked:

  • 3 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

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

Approved on 4d2bfc1. A budget stop that kept results exits 3 in repo run and repo hits judge; our commits make a batch whose budget started no cell exit 1 (the repo_run.py:510 thread) and bring the help, quickstart and contract in line with the codes returned. Full suite, gates and CLI snapshot are green. Windows smoke had not started (the hosted Windows queue was stuck); every other check passed.

@xaleryb
xaleryb merged commit 9e41f5e into intel:main Dec 1, 2026
31 of 32 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

6 participants