Repository navigation
feat(skill-coverage): --dry-run prices the two calls before any spend (Part of #94) - #1419
Conversation
CLI interface change detectedThis PR changes dokimi's user-facing CLI surface (commands and/or options): ~ `dokimi eval skill-coverage` parameters changed:
+ added option `--dry-run`Updated on every push; the |
… (Part of intel#94) eval skill-coverage --dry-run prices its two model calls at list prices and prints the estimate. It builds no client, calls no model and writes no --out file; inputs and --out are still checked. The second prompt is counted at the skill's length, since the requirement list is not known until the first call returns. --max-usd already existed and is unchanged. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
844d419 to
f8ba451
Compare
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 6 selected item(s). CI at Review details
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1419 +/- ##
==========================================
- Coverage 96.34% 96.31% -0.03%
==========================================
Files 517 521 +4
Lines 69116 69859 +743
Branches 11971 12084 +113
==========================================
+ Hits 66587 67287 +700
- Misses 1557 1589 +32
- Partials 972 983 +11
🚀 New features to boost your workflow:
|
Mutation of changed linesAt 333a2b1: 63 caught · 2 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
Not checked:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟡 Changes needed · reviewed f8ba451
To fix: the user docs still describe the old --max-usd (exit 1 for an unpriced model) and do not mention --dry-run (line comments). The smaller estimate and output points there are optional.
✅ make ci-local --offline: 31,404 passed, 116 skipped · ✅ changed tests pass with 20 random seeds · ✅ changed-line coverage 98% · ✅ mypy, ruff, schema_compat
Pricing the two calls before any client is built matches personas discover and is well tested.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869hX1f PRRT_kwDOVBg7g869hX1m PRRT_kwDOVBg7g869hX1x PRRT_kwDOVBg7g869hX10 PRRT_kwDOVBg7g869hX19 PRRT_kwDOVBg7g869hX2D PRR_kwDOVBg7g88AAAABbFh75w 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>
|
Re: review by vlad-perevezentsev
Updated the guide and addressed the optional points. 43574e7 |
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the small thing I've marked fix before merge (in the line comments) and answer my question below? I'll approve once that's done.
I'll approve once that's done.
My question before I approve:
- A run whose two replies are already in the response cache (
DOKIMI_RESPONSE_CACHE) costs nothing, but--max-usdstill refuses it before any client is built when the estimate is over the cap. Decide whether a fully cached run should go through.
Optional, non-blocking (1)
dokimi/dokimi/skill_coverage.py:380: An estimate a hair over the cap gets through:$0.0400004against--max-usd 0.04is allowed, because line 380 rounds it to six places first.
What I checked on d6eefce: the 13 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (32,398 tests), apart from failures main has too; it merges cleanly onto main; when I changed the code on purpose, the tests caught all 12 changes.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869_FGw Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABbVPFqw.b Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
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
4 open issues
_estimate_line()hard-codes “two model calls” even thoughestimate_coverage()returnscalls.… · New For--dry-runand pre-call--max-usdrefusal paths, this eagerly builds potentially large… · New Adjust phrasing for clarity/grammar in the module docstring: “exits 0 and makes none” is ambiguous. · New The refusal message says “before the call”, but the behavior (and other output) is specifically… · New
What changed in this PR
Adds preflight pricing to eval skill-coverage so runs can be refused (or dry-run’d) before any model spend, aligning behavior with other guarded paid leaves.
Changes:
- Add
--dry-runto print a list-price estimate for the two model calls and exit 0 without building a client, calling a model, or writing--out. - Add a pre-call
--max-usdrefusal path (exit 3) when the estimate exceeds the cap or when the model is unpriced; keep mid-run cap stop behavior (exit 1). - Introduce token/cost estimation logic and targeted tests + docs/changelog updates for the new CLI behavior.
| File | Description |
|---|---|
| dokimi/tests/test_skill_coverage_dry_run.py | Adds coverage for dry-run behavior and pre-call --max-usd refusal semantics. |
| dokimi/dokimi/skill_coverage.py | Introduces estimate_coverage() and an assumed reply-token budget for list-price estimation. |
| dokimi/dokimi/commands/skill_coverage.py | Wires --dry-run and pre-call pricing/cap refusal into the CLI command, including messaging. |
| dokimi/docs/reference/cli-interface.json | Updates CLI snapshot to include the new --dry-run flag. |
| dokimi/docs/evaluating-treatments.md | Documents the new dry-run estimate and pre-call cap refusal behavior for skill coverage evals. |
| dokimi/changelog.d/20261129_120000_cli-paid-guards-2.md | Adds changelog entries describing the new pricing and cap refusal behavior. |
Review effort: Lite
| extract = _EXTRACT_SYSTEM + _EXTRACT_PROMPT.format(skill=skill.text) | ||
| listing = skill.text[:MAX_REQUIREMENTS * 200] | ||
| mapping = _MAP_SYSTEM + _MAP_PROMPT.format(requirements=listing, checks=catalogue_text(checks)) | ||
| prompt_tokens = [len(extract) // 4 + 1, len(mapping) // 4 + 1] | ||
| prices = [list_cost_usd(model, provider, tokens, ESTIMATE_REPLY_TOKENS) for tokens in prompt_tokens] |
There was a problem hiding this comment.
Keeping it. check_budget builds the same catalogue first and caps it at 120,000 chars; the listing is capped at 16,000. The strings are bounded and cost no spend, and pricing the real prompt text keeps the estimate from drifting from the prompt.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g86-LMsT Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g86-LMqb Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g86-LMrq Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · re-checked 333a2b1 · nothing required from @napetrov
🔀 Merge: safe now · merges cleanly into current main, 13 commits behind; its tests and the CLI snapshot test pass on the merge (144 passed) · after it, #1190 and #1416 need a rebase (commands/skill_coverage.py)
✅ make ci-local --offline: 32,499 passed, 125 skipped · ✅ test_skill_coverage_dry_run.py passes with 20 random seeds · ✅ changed-line coverage 98%
The earlier points are fixed; the docs, changelog and refusal output now match what the cap does.
On @vchamarthi's cached-run question I agree with keeping the preflight: the second prompt depends on the first reply, so a cache hit cannot be known before a paid miss.


Part of #94 (F1b, spend: paid-guards slice 2, the dry-run on the skill-coverage leaf).
Summary
eval skill-coveragenow prices its two model calls before any spend, aseval personas discoverdoes in #1198:--dry-runprints the list-price estimate and exits 0. It builds no client, calls no model and writes no--outfile. Inputs and--outare still checked, so a refusal reads the same as on a real run.--max-usd Xrefuses a real run before its first call (exit 3, no client built) when the estimate is over X, or when the model has no list price. The message names the estimate and the cap. Behaviour change: an unpriced model with--max-usdused to make one call and then stop (exit 1); it now refuses up front.Leaf table
eval skill-coverage--max-usd(mid-run stop, exit 1)--dry-runadded (estimate, exit 0, no client).--max-usdgains a pre-call refusal (exit 3) when the estimate is over the cap or the model is unpriced; mid-run stop stays exit 1Kept rows: none.
--jsonis not added (F2).Evidence
tests/test_skill_coverage_dry_run.py: 11 tests. Red first: the dry-run tests failed on the missing flag; then 3 failed against the pre-call gate (two new gate tests and the reworded cap test: exit 0, client built). The within-cap test passes before and after, as a guard. Green: 11 passed; withtest_cli_flags.py, 57 passed after the last doc-only edits. The fullci-localrun is the gate._client,LLMClient.__init__andLLMClient.json_objectwith functions that fail the test, so any client construction or model call is caught.cli-interface.jsonregenerated (make cli-snapshot, no diff needed for the help text change).Not in this PR
Remaining unguarded paid leaves on intel/main
e260503bbplus this change (41 paid leaves in the check):--jsonmissing (F2):skill routing,repo hits judge(guarded);catalog routing,skill novelty analyze,eval personas discover,tools preference,eval skill-coverage(--jsononly).--dry-runpresent, no--max-usd:repo reach,repo skill-reach(per-cell caps only; a batch cap needs a Spend total across cells),tasks run,eval questions refine.--max-usdpresent, no--dry-run, no estimator of its own:catalog novelty,skill novelty atoms,skill novelty probe,skill shorten,eval graph,repo run. The novelty estimator covers only the wholeanalyzepipeline.answers generate,arms run,arms matrix-run,benchmark run,benchmark batch,catalog trigger-probe,delivery scan,eval judge agreement|validate|wording,eval questions analyze|generate|review,eval redteam,eval score checklist|pairwise|panel|pointwise|ragas|reference,eval triggers generate,evaluate,explore run,subjects run.Label:
cli-interface-change.🤖 Generated with Claude Code