Skip to content

fix(recovery): follow-ups from the #5343 review - #5601

Merged
AdamRajfer merged 13 commits into
mainfrom
arajfer/recovery-review-followups
Nov 5, 2026
Merged

AdamRajfer merged 13 commits into
mainfrom
arajfer/recovery-review-followups

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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 _key name whose first word names an account or service (service_key, client_key, signing_key, …), and a session name (session, session_id, 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.

  • A math judge reply without a verdict (thread). math_with_judge now saves the verdict each judge evaluation found (verdict_label: [[A=B]], [[A!=B]], or judge_parsing_error when 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 as judge_unparseable through its existing missing-label path, and recovery re-judges it, where before it counted as a healthy grade.

    • Servers that parse their own verdict and reuse this evaluation model (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):

    1. A judge-only pass that fails after some regrades answered now records what it settled and withdrew, so its failed receipt no longer reports zeros. A failed job that settled a saved answer now counts as progress, so it no longer stops recovery as "without settling a saved answer". Its note in the recovery report gives those counts.
    2. A settlement counts as soon as it is fsynced, by its admission. A pass that fails afterwards (for example on the Store's exit-time coverage write) still reports it, and the settle retry accepts an admission it already closed. Withdrawals are counted when they happen, each once, never the planned ones on top.
    3. The remote Store reader may report 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_credential and ::test_the_identity_keeps_the_semantic_settings_and_marks_credentials_redacted
  • resources_servers/math_with_judge/tests/test_app.py::TestApp::test_the_judge_evaluation_saves_the_verdict_it_found
  • resources_servers/physics_judge/tests/test_app.py::TestSavedVerdictForRecovery and resources_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-judging
  • tests/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, receipt settled=2
    • ::test_a_failed_pass_counts_each_withdrawn_admission_once: one masked reply, one changed answer, receipt withdrawn=2
    • ::test_the_note_on_a_failed_judge_job_says_what_it_settled_and_withdrew
  • tests/unit_tests/test_remote_managed_recovery.py::test_the_remote_reader_reports_the_admissions_a_killed_rejudge_pass_left
  • tests/unit_tests/test_attempt_extension.py::test_a_fresh_run_at_the_same_path_does_not_inherit_an_earlier_runs_extension

Validation

  • 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, at 70fb8dbfc, one gym eval run of math_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_reward 0.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 .").

    • All four collected rows were saved with reward 0 and verdict_label judge_parsing_error.
    • The run's re-judge pass printed "Re-judged saved judge failures: 4 rollout(s) settled from their saved answers".
    • It made six judge calls (two for each equal row, one for each unequal row) and no policy call: four policy calls for the whole run.
    • The saved answer is byte-identical in each collected and settled row.
    • The settled rows carry the verdict used: [[A=B]] with reward 1 for the two equal rows, [[A!=B]] with reward 0 for the two unequal ones.
    • Coverage reports 4 of 4 complete. Mean reward is 0.5 after re-judgment, against 0.0 from the collected rows alone.
    Smoke run: configuration, command and saved rows

    Data (smoke.jsonl, four rows in the shape of resources_servers/math_with_judge/data/example.jsonl: the user message with the \boxed{} instruction, question and expected_answer):

    question expected_answer
    How many sides does a hexagon have? six
    What is one half written as a decimal? zero point five
    What is 2 + 3? seven
    How many days are in a week? eight

    Configuration: a copy of resources_servers/math_with_judge/configs/math_with_judge.yaml whose validation dataset points at smoke.jsonl (with a license line), and whose train entry is removed (it needs a Hugging Face token). should_use_judge is 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):

    python verdict_strip_proxy.py <API base URL> 18555 4 proxy.log &
    uv run gym eval run \
      --config <copy of math_with_judge.yaml> \
      --config responses_api_models/openai_model/configs/openai_model.yaml \
      --split validation --output <out dir>/rollouts.jsonl --num-repeats 1 \
      "++math_with_judge.resources_servers.math_with_judge.should_use_judge=true" \
      "+policy_base_url=http://127.0.0.1:18555" "+policy_api_key=<key>" \
      "+policy_model_name=meta-llama/Llama-3.3-70B-Instruct"

    Saved rows, collected → settled:

    expected extracted library_reward collected reward / verdict_label settled reward / verdict used judge calls in the re-judge _ng_rejudge_operation_id
    six 6 0.0 0 / judge_parsing_error 1 / [[A=B]] 2 set
    zero point five 1/2 0.0 0 / judge_parsing_error 1 / [[A=B]] 2 set
    seven 5 0.0 0 / judge_parsing_error 0 / [[A!=B]] 1 set
    eight 7 0.0 0 / judge_parsing_error 0 / [[A!=B]] 1 set
    • The stripped judge replies were complete answers without the tag, for example "My final verdict is equivalent ." and a reasoning paragraph ending "…the answers are not equivalent. My final verdict is different .". A settled reply ends "My final verdict is equivalent [[A=B]].".
    • The proxy log, in order: 4 policy calls; 4 judge calls stripped (collection); 6 judge calls passed (re-judge). No policy call after the first judge call.
    • The rollouts file holds 8 rows (4 collected, 4 settled), and the failures sidecar is empty. The pass kept its 4 judged rows under reverification/<pass>/.
    • The saved answer has the same sha256 in each collected and settled row.

    The run's files are not hosted anywhere public. The table and counts above are taken from them.

    The proxy (verdict_strip_proxy.py):

    """Pass-through proxy for an OpenAI-compatible endpoint that removes the verdict from the first N judge replies.
    
    Usage: python verdict_strip_proxy.py <upstream base url> <port> <N> [log file]
    
    Point the Gym model server's base_url at http://127.0.0.1:<port>; every request is forwarded to
    <upstream base url> + <request path> with its headers (API key included). A request whose body contains the
    math judge's format marker "[[A=B]]" is a judge call. The first N judge replies have every "[[A=B]]" / "[[A!=B]]"
    removed from their text, so they are completed replies without a verdict; all later replies pass through unchanged.
    Set N to the number of rows: each stripped reply counts as "not equal", so collection makes exactly one judge
    call per row, and the end-of-run re-judge pass then gets real verdicts.
    
    Every request is logged as one JSON line: kind (judge/policy), action (stripped/passed), path, status.
    """
    
    import json
    import re
    import sys
    import threading
    import time
    import urllib.error
    import urllib.request
    from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
    
    UPSTREAM = sys.argv[1].rstrip("/")
    PORT = int(sys.argv[2])
    STRIP_FIRST = int(sys.argv[3])
    LOG = open(sys.argv[4], "a") if len(sys.argv) > 4 else sys.stderr
    VERDICT = re.compile(r"\[\[\s*A\s*!?\s*=\s*B\s*\]\]")
    _lock = threading.Lock()
    _judge_calls = 0
    
    
    def _strip(value):
        if isinstance(value, dict):
            return {key: _strip(item) for key, item in value.items()}
        if isinstance(value, list):
            return [_strip(item) for item in value]
        if isinstance(value, str):
            return VERDICT.sub("", value)
        return value
    
    
    class Handler(BaseHTTPRequestHandler):
        def _forward(self, method):
            global _judge_calls
            body = self.rfile.read(int(self.headers.get("content-length") or 0)) if method == "POST" else None
            headers = {
                k: v for k, v in self.headers.items() if k.lower() not in ("host", "content-length", "accept-encoding")
            }
            request = urllib.request.Request(UPSTREAM + self.path, data=body, method=method, headers=headers)
            try:
                with urllib.request.urlopen(request, timeout=900) as response:
                    status, data = response.status, response.read()
                    ctype = response.headers.get("content-type", "application/json")
            except urllib.error.HTTPError as error:
                status, data = error.code, error.read()
                ctype = error.headers.get("content-type", "application/json")
            kind = "judge" if body and b"[[A=B]]" in body else "policy"
            action = "passed"
            if kind == "judge" and status == 200:
                with _lock:
                    _judge_calls += 1
                    strip = _judge_calls <= STRIP_FIRST
                if strip:
                    data = json.dumps(_strip(json.loads(data))).encode()
                    action = "stripped"
            with _lock:
                LOG.write(json.dumps({"t": time.time(), "kind": kind, "action": action, "path": self.path, "status": status}) + "\n")
                LOG.flush()
            self.send_response(status)
            self.send_header("content-type", ctype)
            self.send_header("content-length", str(len(data)))
            self.end_headers()
            self.wfile.write(data)
    
        def do_POST(self):
            self._forward("POST")
    
        def do_GET(self):
            self._forward("GET")
    
        def log_message(self, *args):
            pass
    
    
    ThreadingHTTPServer(("127.0.0.1", PORT), Handler).serve_forever()
  • 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_judge 134, physics_judge 31, math_with_autograder 27 and ugphysics_judge 23, all passing.

  • ruff and the import-layering contract pass.

🤖 Generated with Claude Code

AdamRajfer and others added 4 commits November 4, 2026 15:38
…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 svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread nemo_gym/eval/rollout_reverification.py Outdated
"selected": len(binding["failures"]) + len(unsupported),
"unsupported": len(unsupported),
"judged": len(judged),
"settled": settled,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread nemo_gym/eval/rollout_reverification.py Outdated
"unsupported": len(unsupported),
"judged": len(judged),
"settled": settled,
"withdrawn": len(binding.get("withdrawn", [])) + withdrawn,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 yuhezhang-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=3 while 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

AdamRajfer and others added 4 commits November 4, 2026 18:35
…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]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/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]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/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]>
AdamRajfer and others added 2 commits November 4, 2026 21:17
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]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 37f71af

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

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.

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

@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]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test e70b84c

@yuhezhang-ai yuhezhang-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@AdamRajfer
AdamRajfer added this pull request to the merge queue Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41933798150

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 4, 2026
@AdamRajfer
AdamRajfer added this pull request to the merge queue Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41938339696

Merged via the queue into main with commit 03ee974 Nov 5, 2026
64 of 67 checks passed
@AdamRajfer
AdamRajfer deleted the arajfer/recovery-review-followups branch November 5, 2026 00:17
AdamRajfer added a commit that referenced this pull request Nov 5, 2026
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]>

This branch was previously deployed

1 inactive deployment
public — e70b84c5 Deployed Nov 4, 2026 by copy-pr-bot[bot] via release / finalize / notify #10182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants