Repository navigation
fix(recovery): follow-ups from the #5343 review - #5601
Conversation
…e identity The resume identity saved beside a run's manifest redacts credentials by name, but its pattern missed two names the artifact masker hides. A service_key setting and an X-Session header under client.headers were written verbatim into the identity. A name ending in _key now counts as a credential when the word before it names an account or a service (service_key, client_key, signing_key, license_key, ...). The same holds for a session name: session, session_id, or X-Session. Other _key settings (reference_key, metric_key) and other header values (X-Dataset-Version) still select what is measured, so they stay in the identity and a resume still notices when they change. Test: the credential canary config also sets service_key, an X-Session header and reference_key. No file the run writes holds the canary, and reference_key keeps its value in the identity. Five tests fail without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
The math judge parsed [[A=B]] / [[A!=B]] from the judge's reply but saved
only the request and the reply. A completed reply with no verdict ("I
cannot determine whether these answers are equivalent.") scored 0 like an
unequal answer, and nothing in the saved row told it apart from a real
grade. The gate therefore counted it as a healthy trial, and recovery never
re-judged it.
Each judge evaluation now carries verdict_label: [[A=B]] or [[A!=B]] for
the verdict it used (the last one in the reply), or judge_parsing_error
when the reply gave none, including a refusal or a reasoning-only reply.
The reward is unchanged. With the label saved, the gate reads such a row as
judge_unparseable through its existing missing-label path, and recovery
selects it for re-judging; a valid verdict keeps its grade.
Test: the evaluation saves judge_parsing_error for a reply without a
verdict and the right label for equal, unequal and last-verdict replies,
also in a dump that drops None values. It fails without the change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…unts as progress When a judge-only pass failed after some regrades had answered (one /verify succeeded, a later one disconnected), the exit callback settled the known grade and withdrew the rest, but threw the counts away. The failed receipt then reported selected, judged, settled and withdrawn as 0, although the source held the new grade. Separately, recovery counted every failed judge-only job as having settled nothing, so two failed jobs that had each settled a saved answer still stopped recovery as "without settling a saved answer". The callback now records the pass's counts (selected, judged, settled, withdrawn, unsupported) on the helper, so the failed receipt carries them. A failed job, like a completed one, counts as unsettled only when it settled nothing. Test: two judge failures, one regrade answers and the other disconnects. The failed receipt reports 2 selected, 1 judged, 1 settled and 1 withdrawn, and two such failed jobs do not block recovery, while two that settled nothing still do. It fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…issions When a re-judge pass is killed after admitting its judge failures, the Store reader reports those admissions as unresolved_rejudgments, and local recovery re-judges them (REVERIFY). The remote bridge, however, accepts only a fixed list of reader-owned fields from the reader's projection, and this one was missing. For the same saved run, remote recovery therefore refused the valid projection as "changed collection evidence" and stopped. unresolved_rejudgments is now a reader-owned field the projection may set, as the reader's other Store facts are. Test: a run whose re-judge pass admitted its judge failure and was killed is read through the remote bridge. The projection is accepted, carries the unresolved admission, and recovery decides REVERIFY, as the local read does. It fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
Failed-pass receipts still have two accounting edge cases, and the math-judge change lacks the required real-rollout validation evidence. The credential redaction and remote-reader changes fit their surrounding contracts in the inspected source.
I reviewed all nine changed files and their directly affected callers, consumers, and regression tests. This was a source-only review; I couldn't execute tests.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| "selected": len(binding["failures"]) + len(unsupported), | ||
| "unsupported": len(unsupported), | ||
| "judged": len(judged), | ||
| "settled": settled, |
There was a problem hiding this comment.
RISK — Count settlements that became durable before an exception.
Failure: Regrade one saved answer successfully, then let the settlement Store's exit-time coverage write raise an OSError. The settlement loop has already fsynced the new outcome and closed its admission, but Store exit raises before the count returns. This callback retries settlement; the exact admission-map check rejects that retry because the admission is now closed. Consequently, the failed receipt reports settled=0 despite the saved grade. Two such partial-progress jobs can incorrectly trip the no-progress guard while other answers remain due.
Correction: Could you update settle_rejudgments() and this callback to retain or reconcile durable settlements for this pass's admission operation IDs even when settlement raises? The receipt must count effects completed before the exception, without including another pass's outcomes. A whole-run settlement total isn't sufficient. I haven't identified a small replacement patch that safely covers partial writes and admission-close failures.
Preservation and acceptance: Retain the added disconnect regression's selected=2, judged=1, settled=1, withdrawn=1, successful-pass accounting, and killed-pass recovery of unresolved admissions. Proposed regression: inject a one-shot failure in the settlement Store's exit-time coverage write after one grade is saved. Assert that the original error propagates, the new grade remains selected, and the failed receipt reports settled=1; two positive-progress receipts must not block recovery. These checks are source-derived, not executed.
There was a problem hiding this comment.
Fixed in 2133d7a. Each settlement is recorded by its admission operation id as soon as it's fsynced, so the failed receipt counts it even if the coverage write then raises. The settle retry skips what this pass already settled and closes a settled admission that's still open. test_a_grade_saved_before_the_coverage_write_failed_counts_as_settled injects the OSError and gets settled=2 with both grades selected, and two such receipts don't block recovery.
| "unsupported": len(unsupported), | ||
| "judged": len(judged), | ||
| "settled": settled, | ||
| "withdrawn": len(binding.get("withdrawn", [])) + withdrawn, |
There was a problem hiding this comment.
NOTE — Count actual withdrawals rather than planned withdrawals twice.
Failure: With two bound answers, return a masked result for one and a result containing a changed saved answer for the other. settle_rejudgments() puts the masked identity into binding["withdrawn"] before validating the planned writes. Validation rejects the changed answer without committing either result. During unwinding, this callback actually withdraws both admissions, then adds the one planned withdrawal: the receipt reports three withdrawals for two selected answers. The source rows remain safe, but the diagnostic receipt is wrong.
Correction: As a focused accounting improvement, track completed withdrawals by this pass's admission operation IDs and count each once. Don't add the pre-write plan to the cleanup count. Changes in settle_rejudgments() must also preserve completed withdrawals if a later operation raises; merely clearing the list in this callback would lose those effects. The exact error-safe implementation needs verification against those partial-write paths.
Preservation and acceptance: Proposed regression: use the two replies above and assert that validation raises, both original rows remain selected, both admissions are withdrawn, and the failed receipt contains selected=2, judged=2, settled=0, withdrawn=2. Retain the existing masked-reply behavior that keeps the original row, and the added disconnect case's single withdrawal. I haven't executed these checks.
There was a problem hiding this comment.
Fixed in bf7d500: withdrawals are counted by admission operation id when they actually happen, in settlement and in the exit callback, and the planned list is gone. test_a_failed_pass_counts_each_withdrawn_admission_once runs your masked plus changed-answer case and gets selected=2, judged=2, settled=0, withdrawn=2 with both original rows kept.
| else self.JUDGE_NOT_EQUAL_LABEL | ||
| ) | ||
| judge_evaluation = JudgeEvaluation( | ||
| responses_create_params=responses_create_params, response=judge_response, verdict_label=verdict_label |
There was a problem hiding this comment.
RISK — Add representative real-rollout evidence for the changed judge-recovery behavior.
The supplied validation lists unit tests, server tests, and linting, but no real model rollout. The new persisted label changes observable behavior: a completed no-verdict reply now enters saved-answer re-judgment instead of remaining a healthy zero. The protected repository guidance requires representative real smoke rollouts and inspection of agent and verifier behavior for behavior-changing environment work; mocked tests alone don't satisfy that requirement.
Could you add a small judge-enabled smoke run and record the model, judge/configuration, commands, and links to the inspected rollout and recovery artifacts? No code rewrite is requested. The validation should show that a saved answer reaches the judge, its persisted verdict_label matches the final verdict used, and any recovery grades that same saved answer without regenerating it.
Retain the existing concrete assertions for no verdict → judge_parsing_error with reward zero, valid unequal → zero, both equal judgments → one, whitespace normalization, and last-verdict/reverse-order handling. The controlled no-verdict case should also demonstrate judge_unparseable classification and re-judge selection through the existing consumer tests. These are requested acceptance checks, not results I executed.
There was a problem hiding this comment.
Added a real-rollout smoke to the description's Validation section: an API-served model as policy and judge on math_with_judge, with four complete judge replies stripped of their verdict. All four were saved as judge_parsing_error with reward 0, then re-judged from the same saved answers with no new policy call, and they settled as [[A=B]]=1 twice and [[A!=B]]=0 twice.
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Please also address the existing bot review alongside the two additional findings below. I reproduced both accounting cases at 70fb8dbfc:
- Durable settlements reported as zero progress: a saved grade survives the injected coverage-write failure, but the receipt reports
settled=0; two such receipts can incorrectly stop recovery. Please fix this before merging. - Withdrawals counted twice: the two-answer case reports
withdrawn=3while preserving the original results. Please correct the count; this is a nonblocking diagnostic issue. - Representative real-model smoke evidence: this remains needed before merging under the repository guidance. The controlled tests do not replace that validation.
The shared judge-field regression below is blocking; the failed-pass message suggestion is nonblocking.
| response: NeMoGymResponse | ||
| # The verdict the reply gave, `[[A=B]]` or `[[A!=B]]`, or `judge_parsing_error` when it gave none. A reply without | ||
| # a verdict still scores as unequal, and the saved label lets recovery re-judge it instead of keeping that zero. | ||
| verdict_label: Optional[str] = None |
There was a problem hiding this comment.
[P1] Preserve valid verdicts from other JudgeEvaluation producers
physics_judge, math_with_autograder, and ugphysics_judge override the parser and construct this shared model without setting the new field. When they invoke their judge, the serialized evaluations now contain verdict_label: null. The existing collector treats an explicit null as an unparseable judgment, so valid verdicts are selected for regrading and counted as evaluation faults.
With controlled judge replies through the real local /verify routes, valid positive and negative physics/autograder verdicts retained the correct rewards but became judge_unparseable; the same four checks pass on the immediate base, where the field is absent. A reduced managed-run reproduction also regraded all four saved answers and still failed its health check afterward because the null labels remained.
Could we populate the parsed verdict in every producer, or preserve an omitted field for producers that do not supply it? Please cover the serialized reply through recovery selection, including valid positive and negative controls, while retaining the intended missing-verdict behavior for math_with_judge.
There was a problem hiding this comment.
Good catch, thanks. Fixed in d09b9a9: an unset verdict_label is now left out of the serialized evaluation, so physics_judge, math_with_autograder and ugphysics_judge save their evaluations as before, and a null label still means no verdict for the servers that write one. TestSavedVerdictForRecovery in the physics_judge and math_with_autograder tests sends a positive and a negative verdict through /verify and checks that the row isn't selected for re-judging.
| def _judge_job_unsettled(entry: Mapping[str, Any]) -> bool: | ||
| return entry.get("state") == "failed" or (entry.get("state") == "completed" and not entry.get("settled")) | ||
| # A failed job that settled a saved answer before it failed made progress, as a completed one does. | ||
| return entry.get("state") in ("failed", "completed") and not entry.get("settled") |
There was a problem hiding this comment.
[P3] Report partial progress in the failed-job message (nonblocking)
Now that a failed job with settled > 0 counts as progress, could we also update judge_job_note and the matching _reverify_with_receipt docstring?
For a failed receipt with selected=2, settled=1, withdrawn=1, the current note only says the saved answers it was to grade again "stay as they were" and omits the successful regrade. I verified that two such receipts correctly allow recovery to continue. The answer text is preserved, but its grade may have changed; reporting the settled and withdrawn counts would explain what completed and why recovery can continue.
There was a problem hiding this comment.
Done in 7145186: the failed-job note now says what was settled and withdrawn, for example "before it failed it settled 1 of 2 selected saved answer(s), which counts as progress, and withdrew 1", and the _reverify_with_receipt docstring says the same. Test: test_the_note_on_a_failed_judge_job_says_what_it_settled_and_withdrew.
…valuation physics_judge, math_with_autograder and ugphysics_judge parse their own verdict and build math_with_judge's JudgeEvaluation without setting the new verdict_label. Their /verify replies then saved `verdict_label: null`, which recovery reads as a judge that gave no verdict (as it must for equivalence_llm_judge and xstest, whose null label means exactly that). A valid verdict from these servers was counted as judge_unparseable and re-judged. JudgeEvaluation now leaves the field out when it is unset, so those servers save the evaluation as they did before the label existed. math_with_judge always sets it: `[[A=B]]`, `[[A!=B]]`, or `judge_parsing_error` when the reply gives no verdict. Tests, through the real /verify routes with a positive and a negative judge verdict: the saved evaluations of physics_judge and math_with_autograder carry no label, the collected grading facts are not unparsed, and recovery does not select the row for re-judging. They fail without this change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…s then fails A judge-only pass could save a grade (fsynced, admission closed) and then fail on the Store's exit-time coverage write. Its exit callback settled again, but the admission-map check refused the retry because that admission was already closed, so the failed receipt reported settled=0 with the grade saved. Two such receipts stopped recovery as "without settling a saved answer" while answers were still due. settle_rejudgments now records each settlement in the binding by its admission operation id as soon as record_rejudgment has fsynced it. The receipt counts those, so a failed pass reports what it saved and never another pass's outcomes. Settling again skips what this pass already settled, closes a settled admission that is still open, and expects only the pass's other admissions to be open. Test: a pass whose two regrades are saved and whose exit-time coverage write raises OSError. The error propagates, both new grades stay selected, and the failed receipt reports selected=2, judged=2, settled=2, withdrawn=0. Two such receipts do not block recovery. Before this change the receipt reported settled=0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
… receipt settle_rejudgments stored its planned withdrawals in the binding before it validated the planned writes. When validation then refused a result, the failed pass's exit callback withdrew every open admission and added the planned list on top. Two bound answers, one masked and one grading a changed answer, gave withdrawn=3. The rows stayed safe; only the receipt's count was wrong. Withdrawals are now recorded by admission operation id when they complete, in settle_rejudgments and in the callback alike. The receipt counts that set, and a later settle skips what this pass already withdrew. Test: the two replies above. Validation raises, both original rows stay selected, both admissions are withdrawn, and the failed receipt reports selected=2, judged=2, settled=0, withdrawn=2 (3 before this change). The masked-reply and dropped-connection cases keep their counts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
A failed job that settled a saved answer now counts as progress, but its note still said only that the saved answers it was to grade again "stay as they were". It left out the grade that was saved. The note on a failed job with a receipt now gives the counts: "before it failed it settled 1 of 2 selected saved answer(s), which counts as progress, and withdrew 1, left as they were; the others stay as they were". A failed job that settled and withdrew nothing keeps the old wording. The _reverify_with_receipt docstring now says the same. Test: the note for a failed receipt with settled=1, withdrawn=1; with settled=0, withdrawn=2; and with nothing settled or withdrawn. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 7145186 |
…extension RolloutStore.start_or_resume(resume=False) replaces the old manifest and outcomes and removes the earlier run's resubmit offset, coverage and aggregation files, but it left rollouts_attempt_extension behind. A fresh run at the same output path, configured for 3 attempts, started with cap 3. Its first resume then read the earlier run's extension of 5 and raised the cap to 8. The fresh-run reset now removes the attempt extension with the other state of the run it replaces. Test: an earlier extension of 5, then a fresh run configured for 3 keeps cap 3 when it starts and when it resumes, and the stale file is gone. It fails without this change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test ef4699d |
No conflicts; git merged every file on its own, following the test files main moved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Main moved the re-judge tests to tests/unit_tests/eval/; the managed recovery test's import follows them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
The journal of approvals to run masked results again (`--rerun-masked-without-artifact`) survived a fresh run at the same output path. Its entries name a task, rollout and attempt, and a fresh run numbers attempts from 0 again, so an old approval could name the new run's first attempt. The journal now goes with the other state a fresh run discards. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 37f71af |
|
Merged main (the test-tree move) so this can merge, plus the approvals-journal twin of your P2; the push dropped your approval, could you re-approve? Nothing else changed. |
|
@yuhezhang-ai added the smoke details to the Validation section (collapsed block): Llama 3.3 70B Instruct as policy and judge at 70fb8db, the exact command and config change, the four saved rows before and after the re-judge, and the proxy script that strips the verdict. The run's files aren't hosted publicly, so the rows and counts there are taken from them. Your review got dismissed by the push; could you re-approve when you have a minute? |
Picks up the opencode_search lock files (#5629) that the lock check and dependency tests need. No conflicts; git merged every file on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test e70b84c |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Rechecked e70b84c: the previously reviewed fixes are preserved, and the additional fresh-run cleanup and moved-test import are correct. Focused regression checks pass, and the core, sandbox, server-suite, and lint CI checks are green.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41933798150 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41938339696 |
main changed two files this branch moves (#5601). Its hunks are carried to their new homes: - the failed-judge-job progress rule (_judge_job_unsettled) to nemo_gym/eval/recovery/decision.py - the failed judge job note (judge_job_note) to nemo_gym/eval/recovery/gate.py - the host-collected unresolved_rejudgments field to nemo_gym/orchestration/executors/slurm/reader.py Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Follow-ups to the post-merge review of #5343: the three threads that stayed open, and the review of this PR. One commit per item, each with a test that fails without it.
Changes
Resume identity redaction (thread). The resume identity saved beside a run's manifest now redacts two kinds of names that the artifact masker already hid: a
_keyname whose first word names an account or service (service_key,client_key,signing_key, …), and a session name (session,session_id,X-Session). Other_keysettings (reference_key,metric_key) and other header values (X-Dataset-Version) still select what is measured, so they stay in the identity and a resume still notices when they change.A math judge reply without a verdict (thread).
math_with_judgenow saves the verdict each judge evaluation found (verdict_label:[[A=B]],[[A!=B]], orjudge_parsing_errorwhen the reply gives none). A completed reply such as "I cannot determine whether these answers are equivalent." still scores 0. The gate now reads it asjudge_unparseablethrough its existing missing-label path, and recovery re-judges it, where before it counted as a healthy grade.physics_judge,math_with_autograder,ugphysics_judge) set no label. An unset label is left out of the saved evaluation, so their valid verdicts are saved as before and are not re-judged. A saved null label still means "no verdict" for the servers that write one on purpose.Re-judge settlement follow-ups (thread):
unresolved_rejudgments. A pass killed after admitting its re-judgments is then re-judged through the remote bridge, as it already was locally, instead of being refused as "changed collection evidence".A fresh run inherited an earlier run's attempt extension (comment). Starting a fresh run at an output path removes the earlier run's resubmit offset, coverage and aggregation files, but it kept
rollouts_attempt_extension. A fresh run configured for 3 attempts then resumed with the old extension added, for example cap 8 instead of 3. The fresh-run reset now removes it with the rest.Tests
tests/unit_tests/test_resume_identity_credentials.py::test_no_file_the_run_writes_holds_a_credentialand::test_the_identity_keeps_the_semantic_settings_and_marks_credentials_redactedresources_servers/math_with_judge/tests/test_app.py::TestApp::test_the_judge_evaluation_saves_the_verdict_it_foundresources_servers/physics_judge/tests/test_app.py::TestSavedVerdictForRecoveryandresources_servers/math_with_autograder/tests/test_app.py::TestSavedVerdictForRecovery: a positive and a negative verdict through/verify, saved without a label and not selected for re-judgingtests/unit_tests/test_rejudge_saved_judge_failures.py:::test_a_failed_pass_records_what_it_settled_and_is_not_counted_as_settling_nothing::test_a_grade_saved_before_the_coverage_write_failed_counts_as_settled: injected coverage-write failure, receiptsettled=2::test_a_failed_pass_counts_each_withdrawn_admission_once: one masked reply, one changed answer, receiptwithdrawn=2::test_the_note_on_a_failed_judge_job_says_what_it_settled_and_withdrewtests/unit_tests/test_remote_managed_recovery.py::test_the_remote_reader_reports_the_admissions_a_killed_rejudge_pass_lefttests/unit_tests/test_attempt_extension.py::test_a_fresh_run_at_the_same_path_does_not_inherit_an_earlier_runs_extensionValidation
Real-rollout smoke (judge change): CPU only, with Llama 3.3 70B Instruct (
meta-llama/Llama-3.3-70B-Instruct, served behind an OpenAI-compatible API) as both policy and judge, at70fb8dbfc, onegym eval runofmath_with_judge(should_use_judge=true) on four rows whose expected answers are written in words, so the symbolic check fails and the judge decides (library_reward0.0 on every row). A pass-through proxy removed the verdict tag from the first four judge replies only, so collection received complete replies without a verdict (for example "My final verdict is different .").verdict_labeljudge_parsing_error.[[A=B]]with reward 1 for the two equal rows,[[A!=B]]with reward 0 for the two unequal ones.Smoke run: configuration, command and saved rows
Data (
smoke.jsonl, four rows in the shape ofresources_servers/math_with_judge/data/example.jsonl: the user message with the\boxed{}instruction,questionandexpected_answer):Configuration: a copy of
resources_servers/math_with_judge/configs/math_with_judge.yamlwhose validation dataset points atsmoke.jsonl(with a license line), and whose train entry is removed (it needs a Hugging Face token).should_use_judgeis set on the command line, and the judge uses the policy model server, as the shipped config does.Command (the proxy URL, key, model id and output path are placeholders):
Saved rows, collected → settled:
verdict_label_ng_rejudge_operation_idjudge_parsing_error[[A=B]]judge_parsing_error[[A=B]]judge_parsing_error[[A!=B]]judge_parsing_error[[A!=B]]reverification/<pass>/.The run's files are not hosted anywhere public. The table and counts above are taken from them.
The proxy (
verdict_strip_proxy.py):Full unit suite: 0 failures (19515 passed, 25 skipped) before the attempt-extension fix; the 26 test files that open or resume a store pass with it (2149 tests).
Judge server tests:
math_with_judge134,physics_judge31,math_with_autograder27 andugphysics_judge23, all passing.ruff and the import-layering contract pass.
🤖 Generated with Claude Code