Repository navigation
feat(tier3): save RAGAS goal-accuracy requests and replies in judge_attempts.json - #429
Merged
Merged
Conversation
…vidence 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]>
Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
…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]>
Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
marked this pull request as ready for review
November 9, 2026 19:50
rng1995
requested review from
chrisknvidia,
mosheabr and
rmalani-nv
as code owners
November 9, 2026 19:50
Bring the branch up to main at d717f22. Conflicts: - CHANGELOG.md: under Unreleased > Added, main added the CI onboarding entry (#443) and this branch added the RAGAS judge evidence entry, both after the OpenClaw manifest entry. Both are kept, main's entry first and this branch's entry after it. src/skillevaluator/tier3/harbor/templates/eval.py and docs/tier3-live-evaluation.mdx merged without conflicts. Main's split of _record_judge_attempt into _write_judge_attempts keeps the signature the RAGAS evidence hook uses. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[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]>
…e-calls Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
commented
Nov 12, 2026
rng1995
left a comment
Collaborator
Author
There was a problem hiding this comment.
Reviewed the full production diff, callers, report/runner contracts and affected regression coverage; no actionable findings. Existing CI on reviewed head 13e0ff2: 20 successful checks, 2 skipped; no failed or pending checks. Fresh merge-tree verification against current main ce52a09 succeeds without conflicts. No code changes or local test rerun were needed.
rng1995
added a commit
that referenced
this pull request
Nov 12, 2026
Brings in main through b38b71b (#416, #417, #420, #422, #423, #428, #429, #467). Merged without conflicts; CHANGELOG, docs, decoys.py and eval_core/checks.py auto-merged with both sides' edits in separate hunks. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the RAGAS goal scorer judges
goal_accuracy,judge_attempts.jsonnow holds each request RAGAS sent and the judge's reply, not only the final score.AsyncOpenAIclient handed to RAGAS now usesopenai.DefaultAsyncHttpxClientwith an httpx response hook (_save_ragas_exchange). The SDK's default timeout, connection limits and redirect setting stay the same, and closing the client still closes its HTTP client._record_judge_attemptas agoal_accuracyattempt with methodragasand the model named in the request body, or the selected judge model when the body cannot be read:replied, with the role-labelled request messages as the prompt and the judge's reply. The reply is the message text, or the tool-call arguments when RAGAS asked for a tool call.error, withHTTP <status>: <body>as the problem, orthe reply was not received (<error type>)when the body could not be read. The read error is raised again, so the SDK retries as before.ragasentry is unchanged:acceptedwith the score, orerrorwith the reason the prompt judge ran instead.--max-judge-callsstill counts one judge call per RAGAS score.runner._budget_usageskips theragasentries that carry a prompt, so the requests RAGAS sends itself and the SDK's transport retries are not counted, as feat(tier3): add run budget limits with admission control and partial results #404's docs say. The lastragasentry has no prompt and stays the one counted call._redact_judge_evidenceand are shortened, like the other judge evidence. The error body is not cut before redaction, so a credential cannot be split at the cut.DefaultAsyncHttpxClient, logsCould not save RAGAS judge evidence: <error type>. A write failure is logged by_record_judge_attemptasCould not save judge evidence: <error type>, as for the other judges. In both cases RAGAS scores as before.TimeoutError) instead of logging it as an evidence failure. In a real request the SDK then treats it as a connection error and retries; the RAGAS time budget (asyncio.wait_for) still bounds the run, as onmain.docs/tier3-live-evaluation.mdxlists therepliedstatus and the RAGAS entries, and says the request entries do not count toward--max-judge-calls. CHANGELOG entry under Unreleased > Added.Known gap: a request that fails before any response arrives, such as a refused connection, saves no entry of its own. If RAGAS then fails, the outcome entry records why; an attempt that a retry recovers leaves no trace. The docs say so.
Why
#303 saved every prompt judge attempt to
judge_attempts.json, but for RAGAS it recorded only the outcome, with no prompt or reply. RAGAS builds its own prompts and parses its own replies, so they were not saved anywhere. Agoal_accuracyscore from RAGAS could not be audited like the other judge scores, and when RAGAS failed or returned a non-binary score, the reply behind that failure was lost. Onmain, a stubbed RAGAS run with one judge request saves only theacceptedoutcome entry (score 1.0), with no prompt or reply.RAGAS runs only with the
openaiprovider on the canonical endpoint and a judge that is not a GPT-5 or GPT-6 reasoning model.Kept from public
judge_goal_accuracyand its fallback to the prompt judge are unchanged, including the binary-score check and the outcome entry._judge_goal_accuracy_ragaskeeps its canonical-endpoint gate, its time budget and its cleanup: cancelling pending tasks, the bounded client close, and the close-failure warning._record_judge_attempt,_redact_judge_evidenceandjudge_attempts.jsonare used as they are. No new status logic was needed:_record_judge_attemptalready takesstatus.salvageentries still do not count, and a RAGAS score or failure still counts once.main()sets. Judges run outside the verifier still save nothing.Tests
tests/tier3/test_ragas_judge_evidence.py(19 tests). The RAGAS modules are fakes, but their requests go through the real OpenAI SDK and httpx client, and a stub of the transport behindopenai.DefaultAsyncHttpxClientanswers them. The stub fails the test before any request if that client is not anhttpx.AsyncClient. An autouse fixture refuses DNS lookups and connections beyond loopback and fails the test if one was tried, so a request the stub misses cannot reach the provider. The fixture also clearsHTTP_PROXY,HTTPS_PROXY,ALL_PROXYandNO_PROXYin both spellings and setsNO_PROXY=*, so a proxy in the developer's shell or system settings does not change the results.replied, before theacceptedoutcome. A key-shaped string in the prompt and the configured API key in the reply are both masked.erroroutcome, and the prompt judge then runserrorwith their prompt and a redacted problem, and the retried request is then saved asreplied.runner._budget_usagecounts the three entries as 1 judge call (2 cases)Could not save RAGAS judge evidencewarning and leaves the RAGAS score unchanged (2 cases)judge_attempts.jsonwrite logsCould not save judge evidence: PermissionErroronce per entry, no RAGAS warning, and leaves the score unchanged_record_ragas_exchangeand_ragas_evidence_http_clientre-raise the judge deadlineTimeoutErrorand log nothing (2 cases). This pins the helpers only, not the request flow.main()run saves the RAGAS request between the accuracy attempt and the RAGAS outcome, andrunner._budget_usagecounts 2 judge calls, as onmainHTTPS_PROXYor a SOCKSALL_PROXYset, RAGAS still reaches only the stub and saves both entries (2 cases)api.openai.comwith no proxy, an HTTPS proxy or a SOCKS proxy set (3 cases)tests/tier3/test_run_budget.py:_budget_usagecounts anllmattempt and a RAGAS outcome as 2 judge calls and skips the tworagasrequest entries, oneerrorand onereplied.tests/tier3/test_judge_failure_artifacts.pyuse a fakeopenaiwithoutDefaultAsyncHttpxClient, so they now log the evidence warning and score as before. That file is unchanged frommain, which now holds fix(tier3): report missing tools as environment problems, not skill defects #379's edits to it.eval.pyfrommainatd717f22cfand this PR's tests, the 15 tests that exercise the evidence code fail (the 2 proxy-stub tests among them), and the SDK check and the 3 network-guard tests pass.eval.pyfails exactly one test: noTimeoutErrorre-raise in_record_ragas_exchange, or in_ragas_evidence_http_client; the error body cut to 2000 characters before redaction; no fallback model for an unreadable request.trust_env=False, the guard test with an HTTPS or a SOCKS proxy fails, and so does the SOCKS stub test whensocksiois not installed.HTTPS_PROXY=http://proxy.example:3128 pytest tests/tier3/test_ragas_judge_evidence.pyfailed 1 of the earlier 12 tests, andALL_PROXY=socks5://proxy.example:1080failed 9; with this PR both give 19 passed.httpx.AsyncHTTPTransport, the SDK check test fails (DID NOT RAISE).runner.pyfrommainatd717f22cf, the new budget test and the 3 budget checks in the new module fail:judge_callsis 4 instead of 2 in the budget test, 3 instead of 2 for themain()run, and 3 instead of 1 after a 503 or a cut-off reply.tests/tier3plustests/test_accuracy_arithmetic.py,test_character_facts.py,test_harbor_metrics_truth.py,test_harbor_runtime_skill_isolation.py,test_harbor_scaffold_transactions.py,test_harbor_task_toml_retry_env.py,test_llm_judge.py,test_retry.py,test_tier3_public_runtime.py,test_transport_rules.pyandtest_verifier_error_redaction.py(pytest -n 4): 11509 passed, 5 skipped.tests/tier3/test_judge_contracts.py,tests/tier3/test_judge_failure_artifacts.py,tests/test_ci_workflows.pyand the docs and CHANGELOG readers (test_accuracy_arithmetic.py,test_tier3_public_runtime.py,test_harbor_claude_refusal_fallback.py,test_oss_packaging.py,test_benchmark_rollout_docs.py,test_ci_change_classifier.py,tests/ci/test_image_build.py,tests/tier3/test_private_loose_source.py): 843 passed.mainatd717f22cf.CHANGELOG.mdconflicted with docs: simplify repository CI onboarding #443's entry under Unreleased > Added; both entries are kept, this one after docs: simplify repository CI onboarding #443's.eval.pyand the docs page merged cleanly, but feat(tier3): add run budget limits with admission control and partial results #404's judge-call budget needed a follow-up commit: it counted each saved RAGAS request as a judge call, sorunner._budget_usagenow skips those entries.ruff checkandruff format --checkare clean on the changed Python files, andscripts/check_oss_boundary.pypassed.🤖 Generated with Claude Code