Repository navigation
fix(novelty): exit 1 after a failed model call the run went on past (#1556) - #1600
Conversation
`skill routing`, `skill novelty atoms`, `probe` and `analyze` absorbed a model call that raised an error nobody expects: they exited 0, and `skill routing` wrote `"status": "ok"` with only "1 failed" in its summary line, while `catalog routing` already exited 1. They now write their result as before, print the failed calls with the first error, and exit 1 (`stop_partial` with the `failed_calls` reason, the code `catalog routing` uses). `skill routing` writes `"status": "partial"`; atoms and probe files have no status on a finished run and keep none, so `probe` still reads an atoms file with unread spans. A failed call in a run `--max-usd` stopped exits 1 too, as in `catalog routing`. A reply that does not parse (a malformed wording, a cut reply) is not a failed call and still exits 0. `tools preference` and `repo hits judge` keep recording a failed item in their output and exiting 0. The extraction report counts the spans lost to failed calls (`ExtractionReport.failed_spans`), the probe set lists the wording calls that raised (`ProbeSet.failed_calls`), and `analyze` warns about them in its artifact. `docs/quickstart.md` and `docs/skill-novelty.md` say which command exits what. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 11 selected item(s). CI at Review details
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Aligns CLI exit codes across novelty/routing commands so that unexpected model-call failures that don’t stop the run still produce artifacts but now exit with code 1 (and routing results become status: partial), per #1556.
Changes:
- Update
skill routingandskill novelty atoms|probe|analyzeto write results and then exit1when a model call failed but the run continued. - Track and surface failed-wording calls in
ProbeSet, and failed-span counts in extraction reporting. - Add/adjust tests and documentation to codify the new exit-code behavior.
| File | Description |
|---|---|
| dokimi/tests/test_novelty_routing_cost.py | Updates expectations to exit 1 after a failed model call while still writing routing.json. |
| dokimi/tests/test_failed_call_exit.py | Adds new end-to-end-ish tests covering exit codes, partial statuses, and “failed call” messaging. |
| dokimi/dokimi/novelty/probes.py | Records failed wording calls and threads that state through wording generation. |
| dokimi/dokimi/novelty/atoms.py | Adds failed_spans calculation and reuses it in warnings. |
| dokimi/dokimi/novelty/analyze.py | Carries probe_set through results and emits warnings when wording calls failed. |
| dokimi/dokimi/commands/novelty_routing.py | Marks failed routing calls as status: partial, emits reason, and exits 1 post-write. |
| dokimi/dokimi/commands/novelty_budget.py | Adds helpers for “failed call” notes and ensures capped runs exit 1 if failures occurred. |
| dokimi/dokimi/commands/novelty.py | Applies “exit 1 after write” behavior to atoms/probe/analyze flows. |
| dokimi/docs/skill-novelty.md | Documents partial status + exit 1 behavior for failed calls. |
| dokimi/docs/quickstart.md | Updates exit code table and explanatory text for failed-call behavior. |
| dokimi/changelog.d/20261203_100000_failed-call-exit.md | Changelog entry describing the fixed behavior regression. |
Review effort: Lite
Conflict in dokimi/docs/quickstart.md: both sides edited the exit 3 row of the exit-code table. Kept main's row (with its `trace consistency --contract` addition) and applied this branch's change to it: a `skill routing`, `skill novelty atoms`, `probe` or `analyze` run with a failed model call exits 1, like `catalog routing`. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…as failed (intel#1556) A wording call that raised ValueError before returning a reply was left out of failed_calls, because json_array wraps both the call and the parse and the check excluded every ValueError. _generate now makes the call with client.text and parses its reply in a second step: any error of the call is recorded (a reply cut at the output ceiling, OutputTruncated, is still no failed call), and only a reply that is no array stays exempt. exit_partial ends in one stop_partial call whose message and reason the failed branch replaces, so the second call is no longer an unreachable line after the first. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at Declined, with the evidence in the replies:
Follow-up issues opened:
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head ba37c2e)
- Contract: changed. defaults dokimi/dokimi/commands/novelty_budget.py:66; defaults dokimi/dokimi/commands/novelty_budget.py:78
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
Ready to merge.
Rechecked transport errors, malformed and truncated replies, and exit codes after saving results. 28 focused tests and required CI passed. The optional jobs show the file-length failure on main (#1605) and a runner shutdown.
@napetrov (#1600 (review)): Nothing to change. The review's findings match what I checked at this head: the PR's tests pin the exit codes and the new defaults in |
|
Review points answered at Declined, with the evidence in the replies:
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1600 +/- ##
==========================================
- Coverage 96.46% 96.45% -0.02%
==========================================
Files 566 566
Lines 74980 75032 +52
Branches 12949 12958 +9
==========================================
+ Hits 72328 72369 +41
- Misses 1628 1634 +6
- Partials 1024 1029 +5
🚀 New features to boost your workflow:
|
|
Review points answered at Declined, with the evidence in the reply:
|
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at Declined, with the evidence in the replies:
Follow-up issues opened:
|
Conflicts, both in the novelty commands, resolved by keeping both sides. - dokimi/dokimi/commands/novelty.py: main's `cli_preset` import and its `cli_preset.apply(args)` calls sit beside this branch's failed-call helpers (`analyze_failed_calls`, `exit_if_calls_failed`, `failed_calls_note`) in `cmd_novelty_analyze` and `cmd_novelty_probe`. - dokimi/dokimi/commands/novelty_routing.py: `skill routing` keeps main's `call_cap` as a budget_stopped reason and this branch's `partial` status with the failed call's message when no cap stopped the run. docs/reference/cli-interface.json rebuilt by scripts/cli_surface.py dump: unchanged. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>


Summary
#1556: when one model call of a run raised an error nobody expects and the run went on, the exit code depended on the command. On
main, with a fake model whose second call raises:mainskill routing(3 queries, 1 call raises)"status": "ok", only "1 failed" in the summary line"status": "partial"skill novelty atoms(200 spans, 25 lost to the failed call)atoms.jsonwrittenskill novelty probe(a wording call raises)probes.jsonwrittenskill novelty analyze(a wording call raises)novelty.jsonwritten with a warningcatalog routingOption taken (the issue's proposal, decided by its author): exit 1, after the result is written, reusing
stop_partialand thefailed_callsreason thatcatalog routingalready uses. A failed call in a run--max-usdstopped exits 1 too (ascatalog routingalready says), not 3. A reply that did not parse (a malformed wording, a cut reply) is not a failed call and stays exit 0.tools preferenceandrepo hits judgekeep recording a failed item in their output and exiting 0, anddocs/quickstart.mdnow says so.eval personas discover(exit 5, #1555) is untouched.Closes #1556
Changes
skill routing(commands/novelty_routing.py): a model arm withn_failed > 0writes"status": "partial", printsN of M model call(s) failed (first error: ...)and exits 1; with--jsonthe document sayspartialwith that reason, then the exit stands.skill novelty atoms,probe,analyze(commands/novelty.py,commands/novelty_budget.py):failed_calls_notenames the spans lost to failed extraction calls (ExtractionReport.failed_spans) and the wording calls that raised (ProbeSet.failed_calls, set innovelty/probes.py);exit_if_calls_failedexits 1 after the result is saved and printed. Atoms and probe files keep no status on a finished run, soprobestill reads an atoms file that has unread spans. In a cap-stopped runexit_partialends the message with the failed calls and exits 1.ValueErrorfrom the transport included:_generate(novelty/probes.py) makes the call withclient.textand parses its reply in a second step, so only a reply that is no array, or one cut at the output ceiling, stays no failed call.analyzewarnsN wording call(s) failedin its artifact (novelty/analyze.py);AnalyzeResultcarriesprobe_set.docs/quickstart.md: exit-code row 1, the exit 3 row's clause and the paragraph below the table;docs/skill-novelty.md: the routing and permanent-error paragraphs.tests/test_failed_call_exit.py(new);tests/test_novelty_routing_cost.py::test_a_model_run_whose_every_call_fails_prints_no_price_blamepinned exit 0 for a run whose every call fails, and now expects exit 1 with the result written.Follow-ups, not in this PR:
skill novelty probeandanalyzerecord a failed answer or grade call as an ERRORED run and exit 0Risk
A script that read exit 0 from
skill routing,skill novelty atoms,probeoranalyzeafter a failed call now sees 1 (and forskill routingapartialstatus instead ofok). The result file is still written, and a cap-stopped run with a failed call exits 1 instead of 3. The merge ofmainresolved one conflict, in the exit-3 row ofdocs/quickstart.md, which #1408 also edited: that row keeps main'strace consistency --contractclause and this PR'sskill routing,skill novelty atoms,probeoranalyzeclause. Open PRs #1578 (commands/novelty.py), #1249 (tests/test_novelty_analyze.py) and #1190 (commands/novelty.py,commands/evaluate.py,commands/repo.py) also conflict with this branch in the files named; whichever merges second rebases. #1590, #1565, #1562 and #1515 merge cleanly with it.Testing
On a Linux review host, at
9a287c67(onmain691253e3):make ci-local: 38 passed, 0 failed, 16 skipped (docker, semgrep, conda, other-matrix jobs). The test step: 35715 passed, 28 skipped. Thetest_import_architecture.py::test_package_uses_the_new_modulesfailure of the previous head is gone with the merge ofmain(fix(runs): import InputError from dokimi.files, not dokimi.utils #1609 changed thedokimi.runs.resolveimport); that file passes (56 passed).skill routing, second of three calls raises):exit 0 status okonmain,exit 1, statuspartialhere. Onmain10 of the 18 tests of the new file fail (10 failed, 8 passed; the first onassert 0 == 1); the 8 that pass there are the no-failed-call controls.--jsonstatus,failed_spans, a malformed reply counted as failed, the analyze warning, the analyze exit, the cap passthrough in probe, atoms and analyze).ValueError("provider failure")(test_novelty_probe_with_a_wording_transport_raising_value_error_is_a_failed_call_and_exits_1): exit 1 with1 wording call(s) failed (last error: ValueError: provider failure); at the previous head the test fails, since theValueErrorwas not counted. A wording reply cut at the output ceiling (test_a_wording_reply_cut_at_the_output_ceiling_is_no_failed_call) records no failed call; with that exemption removed the test fails. With the failed-calls reason ofexit_partialreplaced by the stop's own, the three cap-stop tests that expect exit 1 fail.Open questions
None.
Revert
A plain revert restores exit 0 (and
"status": "ok"forskill routing) after a failed call. Nothing is stored: result files written under the new behaviour keep the statuspartialthey were given.Checklist
pytestpasses [the full run has 1 failure,test_import_architecture.py::test_package_uses_the_new_modules, which fails onmaintoo (runs/resolve.pyimportsdokimi.utils)]ruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)