Repository navigation
feat(tier3): add run budget limits with admission control and partial results - #404
Conversation
… results Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Automated review: 16 findings (3 P1, 7 P2, 6 P3); 16 posted inline.
Checked admission control, usage and cost accounting, the budgeted runner loop, collection of exhausted runs, and the budget wiring through tier3 evaluate, tier3 PATH, validate, catalog children and evals/config.yml, using probes that drive run_harbor_eval and _run_agent_pair with fake Harbor jobs and the real collector.
Tests at 2d236d0: test_run_budget 8 passed; Tier 3 progress, evals config, workflow, stop-on-pass concurrency, timeout recovery, skip-with-skill and runner status suites 414 passed (2 skipped) and 217 passed; CLI surface, result display and command tests 66, 93 and 4 passed.
Merges cleanly into main. Real file conflicts: #384/#388 (cli.py, evaluation/options.py), #387 (cli.py, options.py, tier3/result_display.py), #225 (evaluation/options.py), #400 and #406 (tier3/harbor/runner.py, adjacent appends after results.update), #405 (runner.py, result_display.py) and #398 (docs/tier3-live-evaluation.mdx). The other open PRs conflict at most in CHANGELOG.md; #333 and #368 already conflict with main on their own.
#384: run_config["budget"] is not in _NON_COMPARISON_FIELDS, so any budgeted run is rejected as a baseline source, and planned_attempts is computed before --reuse-baseline sets skip_baseline. Land after #384 (and #387/#388), move the budget block after the reuse decision and exclude budget from the comparison identity.
#384: _budget_usage is a second token reader that disagrees with #384's measured_condition_usage on crashed trials (partial sums vs None), and it leaves our earlier P3 on that function's undercount unaddressed.
#225: --backend nemo-gym ignores the budget flags and harbor.max_* keys and runs unbudgeted with no budget block; whichever PR lands second should pass the budget to Gym or reject the flags there.
#406: not-run attempts stay in expected_attempts, so #406 reports budget_exhausted attempts as execution failures.
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
SkillEvaluator CI resultsRequired gate: Skipped Only Tier 1 blocks CI; Tier 2 and Tier 3 are advisory.
Commit: |
Signed-off-by: Christopher Kevin <[email protected]>
…-budget Signed-off-by: Christopher Kevin <[email protected]> # Conflicts: # CHANGELOG.md # docs/tier3-live-evaluation.mdx
…-budget Signed-off-by: Christopher Kevin <[email protected]> # Conflicts: # CHANGELOG.md
…-budget Signed-off-by: Christopher Kevin <[email protected]> # Conflicts: # tests/test_evaluation_service.py
…-budget Signed-off-by: Christopher Kevin <[email protected]> # Conflicts: # CHANGELOG.md
…-budget Signed-off-by: Christopher Kevin <[email protected]> # Conflicts: # CHANGELOG.md # src/skillevaluator/tier3/harbor/runner.py # src/skillevaluator/tier3/result_display.py
…-budget Signed-off-by: Christopher Kevin <[email protected]> # Conflicts: # CHANGELOG.md
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
The RAGAS evidence entries saved each HTTP request RAGAS makes as its own `ragas` entry in judge_attempts.json. The --max-judge-calls counter added by #404 counts every non-salvage entry, so one RAGAS score counted as two judge calls, and an SDK retry after a 503 as three. That contradicts the documented budget, which leaves out transport retries and requests RAGAS makes internally. _budget_usage now skips `ragas` entries that carry a prompt. The entry without a prompt, which holds RAGAS's score or failure, stays the single counted call, as on main. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ttempts.json (#429) * feat(tier3): save RAGAS goal-accuracy requests and replies as judge evidence The RAGAS goal scorer builds its own prompts and parses its own replies, so judge_attempts.json held only its final score. The AsyncOpenAI client handed to RAGAS now uses the SDK's default async HTTP client with a response hook that saves each request and the judge's reply, or the HTTP error, as a redacted goal_accuracy attempt with method "ragas" and status "replied" or "error". Evidence failures are only logged and never change a score; the judge deadline alarm still passes through. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(tier3): describe the saved RAGAS judge requests and replies Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(tier3): make the RAGAS evidence provider stub fail closed The provider stub patched only httpx.AsyncHTTPTransport. An OpenAI SDK whose default async client is built on another HTTP stack would skip the stub and send the tests' requests to the real provider with the fake key. - The stub now patches the transport class of the SDK's own DefaultAsyncHttpxClient, and fails the test before any request when that client is not an httpx.AsyncClient. - An autouse fixture refuses DNS lookups and connections beyond loopback and fails the test if one was tried. - The tests that ignored the stub's request count now check it. - A failed judge_attempts.json write is logged by _record_judge_attempt ("Could not save judge evidence"), not as a RAGAS evidence failure; a new test pins that. - The deadline test is renamed: it pins only that _record_ragas_exchange re-raises TimeoutError. In a real request the SDK treats the re-raised error as a connection error and retries; the RAGAS time budget (asyncio.wait_for) still bounds the run. The earlier commit message said more than that. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(tier3): keep the RAGAS evidence tests proxy-proof and pin three edge cases The network-guard test failed when the shell set HTTPS_PROXY: the unstubbed client looked up the proxy host, not api.openai.com. With ALL_PROXY set to a SOCKS proxy and no socksio, every stubbed test errored because the clients could not be built. - no_network clears HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY in both spellings and sets NO_PROXY=*, so the verifier's client ignores env and system proxies. - The stub's class probe and the guard test's client use trust_env=False. - The guard test also runs with an HTTPS and a SOCKS proxy set, and a new test runs RAGAS through the stub with each proxy set. New cases pin behavior no test covered: - _ragas_evidence_http_client re-raises a TimeoutError from the client constructor and logs nothing. - A configured key that straddles the 2000th character of an error body is masked whole. - An unreadable request body names the selected judge model. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(tier3): count one judge call per RAGAS score, not per RAGAS request The RAGAS evidence entries saved each HTTP request RAGAS makes as its own `ragas` entry in judge_attempts.json. The --max-judge-calls counter added by #404 counts every non-salvage entry, so one RAGAS score counted as two judge calls, and an SDK retry after a 503 as three. That contradicts the documented budget, which leaves out transport retries and requests RAGAS makes internally. _budget_usage now skips `ragas` entries that carry a prompt. The entry without a prompt, which holds RAGAS's score or failure, stays the single counted call, as on main. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(tier3): say RAGAS request entries do not count toward --max-judge-calls Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Signed-off-by: Narendran Raghavan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Tier 3 could limit attempts, concurrency and time, but it had no budget for what a run consumes. This PR adds limits on what the evaluator can measure, enforced before new paid work starts. It does not just report totals afterwards.
tier3 evaluate, also settable in the evals config:--max-attempts-total Ncounts logical attempts across cases, attempts, arms and agents.--max-agent-tokens Nuses observed agent tokens.--max-judge-calls N.--max-cost-usd Xis allowed only with--price-file PATH, a JSON file of per-model input/output prices per million tokens. A model with no price is an error.--max-attempts-total, the run fails fast and no paid work starts.not_runwith reasonbudget_exhausted. They are not scored, not counted as failures, and the result is marked partial.budgetblock (limits, used, status, which limit was hit, attempts not run). The CLI and HTML show one line when the budget is exhausted. Usage that couldn't be measured is shown as "not measured", not 0.Verification
make lint(ruff check and format on the changed files)make test(focused run-budget tests)make buildRelease Impact
CHANGELOG.md