Skip to content

fix(novelty): a capped catalog routing run with failed model calls exits 1 again, not 3 - #1410

Merged
napetrov merged 3 commits into
intel:mainfrom
xaleryb:fix/routing-failed-call-exit-1
Dec 2, 2026
Merged

napetrov merged 3 commits into
intel:mainfrom
xaleryb:fix/routing-failed-call-exit-1

Conversation

@xaleryb

@xaleryb xaleryb commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1374. A capped all-vs-all catalog routing run whose model calls partly failed now exits 1 again, as the #1374 changelog fragment and the quickstart exit-code table say ("a run with failed model calls exits 1"). Since #1374 it exited 3 (budget stop), so a script that retries on 3 never saw the failures. Before #1374 it exited 1.

Repro on main 63797d1: catalog routing <root> --queries-by-skill q.json --model m --max-usd 1, where the first model call raises and the later calls cost $0.60 each -> exit 3, while the saved partial file has n_failed: 1 and reason: spend_cap. With this change: exit 1; the cap message and the partial file are unchanged.

What was run (Linux, Python 3.13, main 63797d1 plus this commit):

  • New test tests/test_novelty_partial_exit_code.py::test_an_all_vs_all_run_with_a_failed_model_call_exits_1_when_the_cap_stops_it_too: red on main (exit 3), and red under two mutants (the override in novelty_routing.py set to None; stop_if_partial ignoring its reason). Green with the fix.
  • Full suite: 31301 passed, 49 skipped, 1 failed (test_agent_arm_dependencies, no mcp on the host; it fails on main too). ruff, mypy, bandit -ll, check_growth, check_comment_blocks, the changelog-fragment check and docs check --strict pass.

…e cap also stops it

A capped all-vs-all run whose model calls partly failed exited 3 (budget
stop), so a retry-on-3 script never saw the failures. Failed calls now
set exit 1; the cap message and the saved partial file are unchanged.

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

exai-bot commented Nov 29, 2026 •

Copy link
Copy Markdown

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

CI at `0b7b313`: 1 failing, 20 passing, 4 skipped

CI is non-green because Tests (py3.14) was interrupted by a runner shutdown, not a demonstrated code regression; four other checks were skipped. The diff and available logs provide no evidence that this change caused the interruption, and local lint and type checks passed. Rerun the interrupted job to obtain a complete test result; no code fix is indicated.

Check Status Assessment
Tests (py3.14) failing at step Run tests Infrastructure or flaky. The runner received a shutdown signal and canceled the test process at approximately 97% completion. The log shows no test assertion failure or traceback tying the interruption to this change.
Review details
  • Commit reviewed: 0b7b313 against merge base 8e9bd57
  • Coverage: 7 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 81k tokens (48k from cache), 12s
  • Tool calls: 11 (7 file_read, 2 code_search, 1 ci_status, 1 local_check_results)
  • Novelty routing partial-failure exit codes, reporting, tests, and documentation: 7 files

@codecov-commenter

codecov-commenter commented Nov 29, 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.33%. Comparing base (8e9bd57) to head (0b7b313).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1410      +/-   ##
==========================================
- Coverage   96.34%   96.33%   -0.01%     
==========================================
  Files         522      522              
  Lines       69949    69952       +3     
  Branches    12098    12099       +1     
==========================================
- Hits        67390    67388       -2     
- Misses       1582     1584       +2     
- Partials      977      980       +3     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/novelty_routing.py 97.70% <100.00%> (ø)
dokimi/dokimi/commands/novelty_routing_report.py 99.43% <100.00%> (+<0.01%) ⬆️

... and 5 files with indirect coverage changes

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

@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 6e24f88

To fix: the exit-code docs and the last stderr line still describe a plain budget stop on this path (line comments). Both are small.

✅ make ci-local --offline: 31,235 passed, 0 failed · ✅ a capped run with one rate-limited call: exit 1, partial file kept with "reason": "spend_cap" and n_failed: 1 · ✅ the new test fails on the base, where stop_if_partial exits 3

The exit code now follows the failed calls again, and the saved partial file does not change.

show()
stop_partial(f"{partial['message']}. The partial result, {partial['calls_done']} of "
f"{partial['calls_planned']} model calls, is in {out}", partial["reason"])
f"{partial['calls_planned']} model calls, is in {out}", reason or partial["reason"])

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.

docs/quickstart.md still says a capped catalog routing that keeps its partial file exits 3, with only a permanent provider error as the exception.

With this PR, a capped run with a failed model call exits 1, but the exit-code table (row 3) and the paragraph under it ("exit 3 when the budget or an unpriced call stops them ... and 1 when ... a permanent provider error stopped them") do not say so.

Suggestion: add "or a failed model call (catalog routing)" next to "a permanent provider error" in both places.

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.

Fixed in 6f2dd59: docs/quickstart.md row 3 and the paragraph under it now say a catalog routing run with a failed model call exits 1, next to the permanent provider error; docs/skill-novelty.md (routing cap section, all-vs-all failed calls) and the changelog fragment say the same. 0b7b313 merges current main, which rewrote row 3 for repo run and repo hits judge; the exception is kept in the merged row.

Comment on lines +101 to +102
stop_if_partial(payload, out, lambda: print_all_vs_all_summary(*summary),
"failed_calls" if failed else None)

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.

When the cap stops a run that also had failed calls, the last stderr line is the cap message, which says "Raise --max-usd", but the run exits 1.

The N of M model call(s) failed message from exit_partial_all_vs_all is never printed on this path. The only hint at the cause is the WARNING line near the top of the output:

WARNING: 1 model call(s) failed (first error: rate limited); ...
spend cap reached: $1.20 of $1.00 after 2 calls ... Raise --max-usd, ... The partial result, 3 of 4 model calls, is in o.json

A user who reads the last line raises the cap, gets the same exit 1, and does not see why.

Suggestion: when failed, add the failed-call count to the stop message (for example "; 1 of 3 model call(s) failed, so this exits 1"), and assert that in the new test.

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.

Fixed in 6f2dd59: when calls failed, the cap message (the last stderr line) ends with ; 1 of 3 model call(s) failed, so this exits 1; with no failed call it is unchanged. The new test asserts the last line (the old check also matched the WARNING line above it), and the existing all-vs-all cap test asserts the message still ends with the file path. Dropping the addition, or always adding it, turns a test red.

…its 1

The cap message, the last stderr line, now ends with "N of M model
call(s) failed, so this exits 1" when calls failed; unchanged otherwise.
The exit-code docs name a failed model call (catalog routing) as exit 1.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
quickstart.md row 3 takes main's text (repo run and repo hits judge exit 3 on
a budget stop) and keeps the catalog routing failed-call exception.

Signed-off-by: Alexander Rybkin <alexander.rybkin@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 0b7b313)

  • Contract: candidate. defaults dokimi/dokimi/commands/novelty_routing_report.py:660
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

With the same regression test, a capped routing run with a failed model call exited 3 on the merge base and exits 1 here. The final diagnostic includes the failure count, and the quickstart documents the same rule. A cap alone still exits 3. All 67 tests in the two affected test files passed locally.

@napetrov
napetrov merged commit 10745c8 into intel:main Dec 2, 2026
33 of 34 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.

5 participants