Skip to content

feat(eval): recover from saved evidence with explicit gate results - #5343

Merged
AdamRajfer merged 91 commits into
mainfrom
arajfer/eval-recovery-from-saved-evidence
Nov 4, 2026
Merged

AdamRajfer merged 91 commits into
mainfrom
arajfer/eval-recovery-from-saved-evidence

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Decide RETRY / RESUBMIT / REVERIFY / NOOP / STOP for a saved evaluation run from its persisted evidence, with retry budgets, acceptance gates and export acknowledgements. This PR consumes the typed failure observations of #5072, which has merged; its diff against main is the recovery layer only. It is based on main after #5536 and #5542, and uses the failure modules at their new locations (nemo_gym/core/, nemo_gym/utils/).

What it does

Recovery from saved evidence: gym eval resubmit <id> <benchmark> --recover (with --inspect to read only) collects the run's identities, saved results, failure records, quality summary and the chain's stored budgets, and decides one action:

  • RESUBMIT the identities a rollout store would run again (retryable failures, missing rows);
  • REVERIFY saved answers that only need grading again (masked judge failures, verify calls lost in transport, and scored rows whose judge gave no verdict) without calling the policy;
  • NOOP when the run is complete or a job of the run is live;
  • STOP with a typed reason otherwise (exhausted budget, terminal failure, unowned failure kind, unknown accounting). A run that ended before its task inventory was written gets fresh-restart with the command to queue it again.

--inspect dispatches and writes nothing; the command prints one JSON line and exits 0 only when the gate reads SUCCESS, so an inspection with work planned exits 1.

Budgets are spent, never reset. Infra retries, walltime, the per-rollout attempt cap and the server spin-up limit are raised only by explicit, journaled options: --extend-retries, --extend-attempts, --max-walltime with --walltime-reason, and --server-spinup-timeout-seconds with --spinup-timeout-reason. A run whose chain accounting is unknown can continue as an operator continuation that fills only the unreadable counters; an explicit --extend-retries still raises a readable spent count. Plain gym eval resubmit without --recover keeps its explicit-reset behaviour.

The job chain's guard (diagram 1) continues, retries on an infrastructure cause named by the scheduler, or stops and writes why to .gym_chain_incomplete. The typed stops:

  • the walltime cap (reached max_walltime cap, or less than one minute left), continued with --recover --max-walltime;
  • a cancelled segment, continued with --recover, budgets carried over;
  • FAILED, OUT_OF_MEMORY or DEADLINE without an infrastructure cause, decided by the saved evidence;
  • a driver failure kind the next segment would repeat: server_spinup_timeout, driver_install_failed (first error line quoted), collection_resume_refused, provider_credentials_rejected, each with its remedy;
  • server_start_failed in a FAILED job before any rollout was saved: the run restarts fresh once, as one infra retry; a second such failure or a spent budget stops with "fresh restart exhausted" and the fresh resubmit command;
  • a follow-up submission the scheduler refused outright (follow_up_submission_refused, with sbatch's exit code and error lines): nothing was queued, accounting is known, continue with --recover; a lost or ambiguous reply stays unknown accounting;
  • a segment that timed out before the task inventory was written, or without saving a row: the stop names the fresh-restart command.

The chain ends itself. Each follow-up gets an afterany sentinel that takes over only if the follow-up dies before its prologue. A job that completes the run cancels its sentinel and follow-up and journals the end in chain-end-journal.jsonl; a stop recorded earlier (a refused follow-up, unknown accounting, the cap) is superseded and journaled as run_complete_stop_superseded. A driver that exits 76 (nothing eligible for retry) writes the no_eligible_retry stop and cancels its own follow-up, unless it left a kind the next guard stops on.

Re-judging saved answers: gym eval reverify settles re-graded answers into the source run under a receipt. A GPU-served run that serves only its policy gets a CPU judge-only job (--judge-partition, --judge-qos); a run that serves its judge on a node pool of its own gets the job on that pool. A collection --limit no longer caps the rows a re-judge pass may re-verify (verified live: after the fix a judge-only re-judge of a limited run re-judged every due row in one pass). Re-verification of judge-failed rows is performed only for environment servers that declare a stateless verify; for servers that do not declare it, such rows stay masked (never scored as zero) and the judge-only job reports them as not re-verified, while the recovery plan still lists them under re-verify. The planner check and the declarations for the stateless judge servers follow in a separate PR.

Acceptance gate: a gate summary with response and trial health over the expected trials. Evaluation-side faults are judged against a fixed 2% limit, model failures are reported but never fail health, masked rows are listed as "completed but not measured", and metric coverage and MLflow delivery are reported as facts. Trials are observed from the run's own grading evidence (bound grading operations, saved verifier output, a self-grading agent's reward), never inferred; an unobserved trial makes the gate UNVERIFIED, not healthy.

Per-task coverage: the reward profile keeps a row for a task none of whose rollouts was saved (num_rollouts: 0, expected and missing counts, 0% completion), so a partial run's per-task report no longer lists fewer tasks than its inventory. Scores are unchanged.

Operator tooling: Store readers run on the run's pinned revision, optionally in a Slurm step (NEMO_GYM_REMOTE_READER_*); a run can be repinned to a newer commit (--repin, or automatically when the plan needs the installed revision, --no-auto-repin to refuse); resume fingerprints ignore settings added later with a default; a chain whose job ids the scheduler has purged is judged from accounting, so export and re-judge are not blocked; --run-dir restores a lost job-index entry from the run's own record, and --record inspects without the index.

Docs and skills: the resume, resumable-runs, job-records, CLI and API reference pages, and two public skills, run-and-babysit-eval (from a run's state to the one action) and add-model-eval-config (serving a new model for evaluations), plus failure-handling conformance for new benchmarks in add-benchmark and add-harness.

Review guide

  1. nemo_gym/orchestration/ (recovery, resume script, chain guard shell, collect_evidence): the decision layer; start with the typed stops and the --recover / --inspect path described below.
  2. The "Behaviour changes to note" list: every item is on by default; each has a test that fails without its change.
  3. fern/.../orchestration/how-to/resumable-runs.mdx and fern/.../reference/cli-commands.mdx: the user-facing contract (typed stops, chain-end journal, the walltime budget rule, the full gym eval resubmit option table).
  4. .agents/skills/run-and-babysit-eval and .agents/skills/add-model-eval-config: the operator path; both are checked command-by-command against --help at this head.
  5. Tests: the full unit suite passes at this head apart from machine-dependent cases, with the same failing set as main; 2,612 test ids are added and 6 are replaced on purpose (each old test's behaviour changed by this PR, its replacement named in the commit). Counted as pytest node ids, parameters included, collected from tests/unit_tests at this head and at the main commit it merges.

Behaviour changes to note

These are on by default; a user who changes no configuration sees them.

Recovery and re-judging

  • Saved answers are re-judged automatically. After every built-in collection, and on resume before any policy work, rows masked by a judge failure or by a verify call lost in transport are judged again from their saved answers. This makes extra judge calls, rewrites rollouts.jsonl in place, writes a reverification/auto-<time>-<id>/ directory and re-aggregates the metrics. A failure in this pass is logged and never fails the run; a require_complete run that used to fail can now pass. There is no switch to turn it off yet.
  • A scored row whose judge gave no verdict is re-judged: such a run inspects as PLANNED (so --inspect exits 1) until the re-judge settles it; evaluation health still counts the row as an evaluation-side fault.
  • A result masked by an evaluation-side failure kind (a lost session, a failed provider) is a failed attempt: resume runs it again within the attempt cap (masked_retryable in coverage). A masked result that keeps a saved answer stays the result.
  • Repeated allocation ends are charged. The first allocation end of a rollout stays free; from the second on, each charges the affected rows one attempt (it used to charge nothing).

Resumable chains

  • FAILED, OUT_OF_MEMORY and DEADLINE no longer retry. They used to count one retry and resume; they now stop, and the saved evidence decides. PREEMPTED, NODE_FAIL and BOOT_FAIL now count against max_retries (they used not to).
  • Chains stop instead of guessing when accounting is unknown: an empty sacct reply is retried 6 times, 10 s apart, then stops the chain (it used to resume), so a scheduler whose accounting lags more than about a minute stops chains that used to continue; an unreadable or unobserved follow-up claim stops the chain (it used to be replaced); a follow-up whose submission reply was lost is never queued again blindly. The log line names the continuation (gym eval resubmit --recover --max-walltime ... --walltime-reason ..., plus --extend-retries when retries are spent).
  • Typed stops and the chain end listed above: the one fresh restart after server_start_failed, follow_up_submission_refused, exit 76 ending its own chain, the sentinel job per follow-up, and the finishing job cancelling its follow-up and sentinel.
  • A capped run lowers its own Slurm time limit to the remaining max_walltime before services start, which needs scontrol permission to read and decrease it; failure stops the job before any work.
  • Resume accepts operational configuration drift. A change only in operational settings (timeouts, retries, ports, concurrency, health limits, paths, tracking) resumes with a warning and a line in <stem>_manifest.resume-drift.jsonl; a semantic change (data and limits, repeats, agent and model, sampling, judge and grading) is refused, naming each setting. It used to refuse any change.

Exports

  • The export marker is a content-bound receipt. <stem>_<exporter>_export_done now names the backend run and the sha256 of every file sent. A later export is skipped only while the receipt matches the files; a mismatched, legacy or malformed marker fails the export and sends nothing (it used to skip silently).

Models, agents and benchmarks

  • vLLM output-budget refit (refit_output_budget_to_window, default on). When the requested output budget alone exceeds the context window and the server refuses for length, the request is sent once more with max_tokens lowered to the window minus the prompt (minus a 16-token margin). This can add one /tokenize call and records requested_max_tokens, applied_max_tokens and output_budget_refit. A row that used to fail is now generated and scored.
  • GDP.pdf keeps an incomplete answer as the row's result instead of regenerating it at a lower DPI; regenerate_on_incomplete_output: true restores the old behaviour.
  • DeepSWE retries an inconclusive verification up to twice (inconclusive_verification_retries=2); SWE-bench masks a zero without a verdict as a verifier error instead of scoring it; SWE-bench Pro retries patch capture over a lost transport; GDPVal treats an answered agent deadline as final and never reruns it; Terminal-Bench 4 answers a resent rollout of the same run with its recorded, completed attempt (replayed_from); the Harbor, OSWorld, tau2 and verifiers agents type their failures.
  • OpenSandbox create.timeout_s defaults to unset, which waits for the request timeout plus the spec's readiness wait plus 30 s, instead of 1500 s.
  • SciCode always records how each sub-step's grading process ended (step_exits); scores are unchanged.

Training (RL) path

  • The rollout collection contract used by trainers is unchanged: run_examples / run_outcomes, their completion iterators, the sidecar failure rows and the rule that a row's result is exactly what the environment's /run returned are untouched, and every public name a trainer imports resolves with the same signature.
  • What a trainer does see, through the model server and the environments: the vLLM output-budget refit above (skipped when token capture is on); the verifiers-library agent and SWE-bench now mask a row whose grader raised or gave no verdict instead of scoring it 0 (trainers that honour the mask drop the row rather than count a negative); DeepSWE retries a verdict-less verification up to twice; a typed output message built without explicit tags is replayed as a message, not as a tool-list item.
  • Evaluation-only and not on the training path: re-judging saved answers, rerunning masked rows on resume, charging repeated allocation ends, the chain stops and the export receipts. One consequence to know: offline collection through gym eval re-judges saved judge failures after collection and rewrites rollouts.jsonl in place (with a reverification/ record); there is no switch to disable it yet.

Folded follow-up fixes (from #5513)

The follow-up PR's commits are part of this PR now, in order, on top of the reviewed head; they fix behaviour of this layer that recovery runs exposed:

  • A refused reader step is submitted again. A recovery reader whose Slurm step srun refused outright (a per-user submit or QOS limit, no node free for an immediate start) used to read nothing, so --inspect returned UNKNOWN; it is now submitted again with a back-off inside the reader queue wait.
  • A segment with nothing eligible for retry ends its own chain. A driver that exits 76 writes the stop, cancels the sentinel and follow-up it queued, and journals the end, so no allocation starts only to write the stop. A driver that left one of the failure kinds the next segment's guard turns into its own stop (spin-up timeout, install failed, resume refused, credentials rejected) keeps its follow-up; both lists come from one constant.
  • A remote reader's install waits for uv's lock as long as a run does (UV_LOCK_TIMEOUT, default 1800 s), and installs the MLflow client, so it can read the exported run's status and MLflow delivery is verified rather than reported unverified.
  • An explicit, journaled rerun of a masked row with no gradeable artifact: --recover --rerun-masked-without-artifact --rerun-reason "<text>". Opt-in, journaled per attempt beside the rollouts file, within the attempt cap; --inspect names the rows; nothing changes without the flag.
  • An explicit, journaled acknowledgement of failed judge-only jobs: --recover --acknowledge-failed-judge-jobs --acknowledge-reason "<text>" lets exactly one more judge-only job queue after the last two ended without settling; the stop message and --inspect name the flag.
  • A judge-only job does not wait for the policy endpoint's readiness, which it never calls.
  • The submit-time check of driver.gym_install.ref retries a failure to reach the repository (10, 30, 60 s) and says when it was the network that failed; only after every attempt failed does it accept a commit that a freshly pruned remote-tracking ref of the running Gym's own clone contains.
  • The gate's "score unavailable" message names the flags that read a score (--score-key, and --score-agent or --score-environment for a Gym aggregate).
  • Skills: run-and-babysit-eval reads as one path from a run's state to the action, with per-benchmark notes in references/benchmark-notes.md, the install line for the gym CLI at a pinned commit, and the flags above; add-model-eval-config checks that the served chat template renders tools.

After the fold, the chain also gained the typed follow_up_submission_refused stop, the run-complete supersession of an earlier stop, the one fresh restart after server_start_failed, and the per-task row for a task with no saved rollout (see above).

Each fix has its own tests; each new behavioural test fails without its change.

Release note

SWE-bench and GDPVal denominators change, DeepSWE retries inconclusive verifications, GDP.pdf keeps incomplete answers, and saved judge failures are re-judged after collection, so scores on these benchmarks can move against runs from older pins. Resumable Slurm chains stop on FAILED, OUT_OF_MEMORY and DEADLINE instead of retrying, and an export whose marker predates the receipt format fails until the marker is removed.

Validation

  • Unit suite: all tests pass apart from environment-specific ones unrelated to this change; the coverage gate is as CI reports on this head.
  • At the current head, against the main commit it merges: the full unit suite passes (19,395 tests) except the same 7 tests that fail on that main commit, which are unrelated to this change; ruff, format and import-linter are clean. Run as pytest tests/unit_tests at this head and at that main commit, with the failing tests compared by test id.
  • Cluster runs through this PR's own job chain: a run cancelled mid-way leaves the typed stop with the recovery hint, --recover decides RESUBMIT and dispatches once, and the chain resumes; a run that reaches its walltime cap leaves the typed cap stop and resumes only with an explicit larger budget; completed runs cancel their own follow-up and sentinel.
  • End-to-end CPU scenarios (resume, accept, re-judge, infra timeout): pass, with identical decision facts before and after each base update.
  • Real-model rollouts for the behaviour-changing adapters are in feat(eval): report causal failures across service boundaries #5072's thread.

How the failure handling decides

1. The job chain's guard: continue or stop

How the next segment continues, retries on an infrastructure cause, or stops and writes why. The job that completes the run, or whose driver exits 76, ends the chain itself in its epilogue (see above); that path is not drawn.

flowchart TD
    classDef stop fill:#fde2e1,stroke:#b42318,color:#111
    classDef go fill:#dcf5e3,stroke:#1f7a3a,color:#111
    classDef fact fill:#eceff3,stroke:#667085,color:#111
    START(["Follow-up job starts, afternotok of the previous segment"]) --> SENT{"Is this job the sentinel of a follow-up?<br/>queued afterany next to it"}
    SENT -->|"yes, and the follow-up recorded itself and queued its own follow-up"| S0["Nothing to do, exit 0"]:::go
    SENT -->|"yes, and the follow-up never started"| S1["Leave the chain as it is, exit 0"]:::go
    SENT -->|"yes, and the follow-up died before or right after its guard"| S2["Take over in its place: record the dead job, debit its elapsed time, this counts as one infra retry"]:::fact
    SENT -->|"no"| REC
    S2 --> REC["Record this allocation in the job chain and write the provisional marker<br/>if this job dies before it queues a follow-up, the marker says so"]:::fact
    REC --> ACC{"Is the chain accounting readable and known?<br/>chain file, counters, no pending submission lock, no Slurm requeue of the same job id, no unobserved follow-up claim"}
    ACC -->|"no"| A0["stop: allocation accounting unknown, reconcile the queue and the terminal chain before recovery"]:::stop
    ACC -->|"yes"| PREV{"Previous job state, read from sacct"}
    PREV -->|"COMPLETED"| P0["The run finished: exit 0"]:::go
    PREV -->|"CANCELLED"| P1["stop: chain stopped with rollouts missing, continue with gym eval resubmit --recover"]:::stop
    PREV -->|"TIMEOUT"| WALL
    PREV -->|"PREEMPTED, NODE_FAIL, BOOT_FAIL"| P3["Infrastructure cause named by the scheduler: this continuation needs one infra retry"]:::fact
    PREV -->|"FAILED, OUT_OF_MEMORY, DEADLINE"| P4["No infrastructure cause established: a stop reason is set, the saved evidence decides below"]:::fact
    PREV -->|"anything else"| P5["stop: previous state unknown or nonterminal"]:::stop
    P3 --> WALL
    P4 --> WALL
    WALL["Add the previous job elapsed time to the accumulated walltime"]:::fact --> KINDF{"Did the previous driver leave a typed failure kind?<br/>the .gym_driver_failure file of that job"}
    KINDF -->|"server_spinup_timeout"| K1["typed stop: the servers did not come up within the spin-up limit, the chain does not retry it"]:::stop
    KINDF -->|"driver_install_failed"| K2["typed stop: the install failed before Gym ran, the first error line is quoted, the chain does not retry it"]:::stop
    KINDF -->|"collection_resume_refused"| K3["typed stop: the resume was refused, semantic configuration drift"]:::stop
    KINDF -->|"provider_credentials_rejected"| K4["typed stop: the sandbox provider refused the credentials, the chain does not retry it"]:::stop
    KINDF -->|"server_start_failed, job FAILED, no rollout saved"| K5{"Restarted fresh once already, or retries used at the cap?"}
    K5 -->|"yes"| K6["typed stop: server_start_failed, fresh restart exhausted, the fresh resubmit command is printed"]:::stop
    K5 -->|"no"| K7["Restart the run fresh as one infra retry, mark the restart"]:::fact
    K7 --> CAP
    KINDF -->|"none"| INV{"Previous state TIMEOUT and no task inventory yet?<br/>artifacts/rollouts_materialized_inputs.jsonl absent"}
    INV -->|"yes"| I0["stop: the segment timed out before any work, the fresh restart command with a longer walltime is printed"]:::stop
    INV -->|"no"| RL1{"Needs an infra retry and retries used at the cap?<br/>cap = configured max_retries plus the recorded extension"}
    RL1 -->|"yes"| R0["stop: infra retry limit reached"]:::stop
    RL1 -->|"no"| CAP{"Accumulated walltime below max_walltime, with at least one minute left?"}
    CAP -->|"no"| C0["stop at the walltime cap: continue with gym eval resubmit --recover --max-walltime above the cap, budgets carry over"]:::stop
    CAP -->|"yes"| ADM{"Stop reason set, or a previous job with a rollout manifest?"}
    ADM -->|"no"| NOPROG
    ADM -->|"yes, state FAILED, TIMEOUT, PREEMPTED, NODE_FAIL or BOOT_FAIL"| READER["Admission by the installed reader on the saved evidence<br/>recovery.continuation_admission runs decide_from_collected, see diagram 2"]
    ADM -->|"yes, any other state"| D0["stop with the set reason"]:::stop
    READER -->|"driver exited 76, or the reader says stop or noop"| D1["stop: saved recovery evidence has no eligible retries, with the reader reason"]:::stop
    READER -->|"reader says resubmit: planned segment work"| NOPROG
    READER -->|"reader says resubmit: a failed attempt needs a retry"| NEEDR["This continuation needs one infra retry"]:::fact
    NEEDR --> NOPROG
    NOPROG{"Previous state TIMEOUT and the Store progress rows unchanged since that segment started?"}
    NOPROG -->|"yes"| N0["stop: the segment spent its walltime without saving a row, the fresh restart command is printed"]:::stop
    NOPROG -->|"no"| RL2{"Needs an infra retry and retries used at the cap?"}
    RL2 -->|"yes"| R1["stop: infra retry limit reached"]:::stop
    RL2 -->|"no, retry needed"| SPEND["Spend one infra retry and record it"]:::fact
    RL2 -->|"no retry needed"| RUN
    SPEND --> RUN["Run the segment: queue the next follow-up afternotok and its sentinel afterany, claim the follow-up id, clear the provisional marker"]:::go
    RUN --> SUBF{"Did the follow-up submission get an observed reply?"}
    SUBF -->|"yes"| OK["The chain continues"]:::go
    SUBF -->|"refused by the scheduler"| SR["typed stop follow_up_submission_refused: nothing queued, accounting known, continue with gym eval resubmit --recover"]:::stop
    SUBF -->|"no reply, or the request was lost"| SF["accounting-unknown marker: automatic continuation stops, inspect the queue and the terminal accounting"]:::stop
Loading

2. gym eval resubmit --recover and --inspect

How recovery decides one action from the saved evidence.

flowchart TD
    classDef stop fill:#fde2e1,stroke:#b42318,color:#111
    classDef go fill:#dcf5e3,stroke:#1f7a3a,color:#111
    classDef fact fill:#eceff3,stroke:#667085,color:#111
    COL(["Collect the saved evidence of the job directory<br/>collect_evidence.COLLECT_SCRIPT"]) --> MS{"Written by a rollout store, and is an authoritative Store reader available to select the attempts?"}
    MS -->|"store, reader unavailable or it could not verify the artifacts"| M0["stop: an authoritative Store reader is unavailable, every identity stays unknown"]:::stop
    MS -->|"reader selected the attempts, or no store"| INV{"Task inventory present?"}
    INV -->|"no, no live job, no saved rows"| F0["fresh-restart: the run ended before the inventory was written, resubmit it as a fresh run with a longer max_walltime"]:::stop
    INV -->|"no, a job of the run is live"| F1["noop: a job is still running or pending"]:::go
    INV -->|"no, otherwise"| F2["stop: no inventory to recover against"]:::stop
    INV -->|"yes"| LIVE{"Is a job of this run live?"}
    LIVE -->|"yes"| L0["noop: nothing is classified while a job writes the files"]:::go
    LIVE -->|"no"| VAL{"Inventory valid, no duplicate identities, no saved rows outside it?"}
    VAL -->|"no"| V0["stop: invalid inventory or rows the inventory does not name"]:::stop
    VAL -->|"yes"| CLS["Classify every expected identity<br/>scored, model_final, judge_recoverable, retryable, exhausted, terminal, missing, masked, omitted, unknown<br/>attempt counts from the Store, a reservation without an outcome stays unknown unless the scheduler cut that allocation"]:::fact
    CLS --> UNK{"Unknown identities that a resume would run again, or nothing else to run?"}
    UNK -->|"yes"| U0["stop: failures with no registered kind, no supported action or no rerun in the Store, nobody owns them"]:::stop
    UNK -->|"no"| POL{"Does the outcome policy stop an ungraded failure?"}
    POL -->|"yes"| PS["stop: mixed dispatch cannot enforce separate task decisions"]:::stop
    POL -->|"no"| NEED{"Does anything need the policy again?<br/>identities missing or retryable"}
    NEED -->|"no"| JR{"Judge-recoverable identities only?"}
    JR -->|"yes"| RV["reverify: re-judge the saved answers, gym eval reverify --judge-failed-only<br/>a model-served Slurm run gets a judge-only CPU job<br/>or, for a run serving its judge on a node pool of its own, a judge-only job on that pool"]:::go
    JR -->|"no"| TE{"Terminal unscored failures?"}
    TE -->|"yes"| T0["stop: terminal failures need an owner decision, the run is not complete"]:::stop
    TE -->|"no"| EX{"Exhausted identities?"}
    EX -->|"yes"| E0["stop: every attempt used since the last resubmit, a resume would run nothing<br/>--extend-attempts N raises the cap for rollouts the Store would rerun"]:::stop
    EX -->|"no"| MK{"Masked completed results?"}
    MK -->|"yes"| MK0["stop: masked results are kept and not measured, a resume would run nothing"]:::stop
    MK -->|"no"| CPL["noop: every identity is scored, a final model failure, or omitted by an accepted partial stage, the run is complete"]:::go
    NEED -->|"yes"| MIX{"Judge-recoverable identities as well?"}
    MIX -->|"yes"| MX0["resubmit: recover names the re-judge part; the resumed run re-judges the saved answers before its policy work and again at the end"]:::go
    MIX -->|"no"| BUD{"Budget known?<br/>live-job answer, max infra retries, retries used"}
    BUD -->|"no"| B0["stop: the job chain or scheduler state is unavailable, the budget is unknown<br/>an operator continuation with --max-walltime and a reason may continue it, recorded in the operator-continuation journal"]:::stop
    BUD -->|"yes"| RET{"Infra retries used below the cap, or planned segment work only?<br/>cap = configured plus recorded extension plus --extend-retries"}
    RET -->|"no"| R0["stop: the stored infra-retry budget is used"]:::stop
    RET -->|"yes"| WT{"Walltime capped?"}
    WT -->|"yes, used walltime unknown"| W0["stop: the used walltime is unavailable"]:::stop
    WT -->|"yes, used at or above max_walltime"| W1["stop: the stored walltime budget is used"]:::stop
    WT -->|"no, or below the cap"| RS["resubmit: a resume runs only the missing and retryable identities, budgets carry over"]:::go
    RS --> DRIFT{"When the resumed segment starts: configuration drift against the recorded configuration of the run?<br/>rollout_recovery._configuration_drift"}
    DRIFT -->|"semantic drift"| DR0["refused: collection_resume_refused, unless --allow-unsafe-resume, which is recorded in the unsafe-resume journal"]:::stop
    DRIFT -->|"operational drift"| DR1["allowed and recorded in the resume-drift journal"]:::fact
    DRIFT -->|"none"| DR2["resume"]:::go
Loading

3. The inspect gate

How the gate reads evaluation health and failures by kind.

flowchart TD
    classDef stop fill:#fde2e1,stroke:#b42318,color:#111
    classDef go fill:#dcf5e3,stroke:#1f7a3a,color:#111
    classDef fact fill:#eceff3,stroke:#667085,color:#111
    classDef warn fill:#fff4d6,stroke:#b54708,color:#111
    IN(["gym eval resubmit --recover --inspect reads the collected evidence and the recovery decision"]) --> COMP{"Is the run complete?<br/>decision.complete, counting a scored row planned for re-judge as scored (_health_view), and expected trials above zero"}
    COMP -->|"no"| NE["Health not evaluated: the run has unaccounted trials, the gate reports the recovery decision instead"]:::stop
    COMP -->|"yes"| CNT["Count the trial faults by kind: recovery.trial_faults<br/>every identity in a failure state, scored rows whose rollout ended on a failed policy call, and zero-scored rows the model left incomplete, truncated_answer"]:::fact
    CNT --> FC["Classify each kind: recovery.fault_class<br/>model: model_request_error, model_policy_response_timeout, model_context_limit, agent_timeout, agent_limit, agent_invalid_output, agent_command_not_allowed, truncated_answer, empty_answer, malformed_answer<br/>server: server_start_failed, model_transport_error, model_server_error, agent_timeout_infrastructure, every provider_* kind<br/>evaluation-side: server plus every other kind, agent_timeout_infrastructure, invalid_output_budget, invalid_request_parameter, judge_failed, judge_unparseable, verifier_error, environment_episode_failed, rollout_allocation_ended, sandbox and harness kinds, missing, masked, unknown"]:::fact
    FC --> LIM{"Evaluation-side faults divided by expected trials at or above GATE_FAILURE_LIMIT 0.02?"}
    LIM -->|"yes"| FAIL["evaluation_health FAIL<br/>the evaluation side failed two percent or more of the trials"]:::stop
    LIM -->|"no"| OLD{"Do the rows predate operation observations, an earlier pin?"}
    OLD -->|"yes"| PASSOLD["evaluation_health PASS on coverage, exact false<br/>the exact failure count is unavailable for that pin"]:::go
    OLD -->|"no"| JOIN{"Is every recovered attempt joined to a completed policy or grading operation?"}
    JOIN -->|"no"| UV1["evaluation_health UNVERIFIED: recovered failures are not fully joined, treatment is not defined"]:::warn
    JOIN -->|"yes"| COV{"Is every trial that is not a recorded failure observed?<br/>recovery._observed_trial_operations: a grading operation bound to the saved row, the verifier's own grading record, or a saved grading artifact"}
    COV -->|"yes"| EXACT{"Evaluation-side share, now including observed gradings without a valid verdict, below the limit?"}
    EXACT -->|"yes"| PASS["evaluation_health PASS, exact true"]:::go
    EXACT -->|"no"| FAIL2["evaluation_health FAIL, exact true"]:::stop
    COV -->|"no, some trials unobserved"| UV2["evaluation_health UNVERIFIED: n of m expected trials unobserved, known failures are a lower bound<br/>this withholds a pass and is no health failure"]:::warn
    COV -->|"no, coverage not provable at all"| UV3["evaluation_health UNVERIFIED: failures recorded only as zero rewards cannot be ruled out"]:::warn
Loading

🤖 Generated with Claude Code

@AdamRajfer AdamRajfer self-assigned this Oct 30, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 30, 2026 01:52
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work labels Oct 30, 2026

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

HOLD — one BLOCKER and twelve RISK findings remain in the recovery and gate paths.

Reviewed all seven changed files and traced the affected rollout producers, cache loader, Slurm dispatch/prologue, aggregate-metrics writer, quality-summary producer, and executor fallbacks. Several new fixtures differ from the production artifact layout, concealing answer regeneration and score-reading failures. This was a static review: tests, scheduler commands, and end-to-end acceptance were not executed. Suggested code below must be verified before adoption.

NOTE — document the public recovery workflow. The new controls in the CLI have no corresponding user guide; the resumable-runs guide only explains automatic chaining. Please add a minimal working recovery example after correcting the score selector, explain the separate dispatch ok and gate acceptance results, and document health criteria, MLflow observations, supported Slurm/resumable scope, and unsupported saved-answer rejudging. Preserve the documented ordinary resubmit behavior rather than implying it shares recovery's budget policy. Acceptance is a static check that the example matches the corrected artifact format and that users can distinguish SUCCESS, RUNNING, RESUMING, FAILED, and unsupported outcomes. The pinned rubric explicitly requires documentation for notable user-facing features.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/submit.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
Comment thread nemo_gym/orchestration/submit.py Resolved
Comment thread nemo_gym/orchestration/recovery.py Resolved
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the blocked Work cannot move forward until an external dependency is cleared label Oct 30, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team October 30, 2026 07:12
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test b221fcb

…e-judge pass may re-verify

A collection limit counts tasks, while reverify reads limit as the
largest number of rows to re-verify. The automatic re-judge after
collection and the judge-only job kept the run's limit, so a run
collected with a limit re-judged at most that many rows per pass and
never reached the rest. Both now drop it with the other collection-only
settings. Tests cover the automatic pass (a run collected with limit 4
re-judges all 10 due judge failures) and both judge-only job paths.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 7b75045

AdamRajfer and others added 3 commits November 4, 2026 04:01
… a run

Before submitting: the server spin-up limit (default 600 s) covers dependency
installation and model loading, so raise it for a large model, a fresh install
or a loaded cluster. A spin-up timeout is an infra stop that leaves rows
untouched and is never scored as zero; the chain waits for a recover with a
raised limit.

Judge-only re-judges take the judge key and the other forwarded credentials
from the environment of the dispatching shell, so export the valid key there
before dispatching.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…ith the serve extra

A container without the ray CLI installed `ray[default]` unpinned before
`ray start` and the Serve gateway. The gateway imports `ray.serve`, whose
dependencies the `default` extra does not declare, and an unpinned install
takes the newest Ray. With a Ray release whose Serve import needs a package
outside `default`, every start-up of such a policy service fails the same way
at the gateway's import.

Install `ray[default,serve]==2.59.0` instead. A container that ships its own
Ray is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…d-evidence

One conflict, in resources_servers/swebench_pro/app.py, where both sides
added code at the same place: this branch's transport retries for the
patch capture, and main's task network policy. The resolution keeps both
unchanged, and the import line carries the names both use.

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 e00a3f7

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 365ce5e

@giuliolovisotto giuliolovisotto 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.

Re-reviewed 365ce5e28. Both findings from my previous review are addressed: invalid judge outcomes no longer count as healthy, and exported trial rates use the gate's omission-adjusted denominator. The five focused health/recovery suites passed (439 tests), and I replayed both earlier probes.

I found no major blocker in the paths reviewed. I'm comfortable landing this with the following two fixes tracked as follow-ups:

  1. An unrelated masked row can prevent explicit recovery. In _decide_from_collected, unknown accounting is recognized by exact equality against the displayed reason. decision() appends a masked-artifact warning to that reason, breaking the comparison. Reproduced with one scored row, one masked row retaining an answer but no gradeable artifact, one missing row, an unreadable retry counter and an explicit OperatorBudget: it returns STOP, with no operator continuation. Removing the masked row returns RESUBMIT. Please represent the stop reason independently of display text and add this combined regression case; the masked row should remain retained while the missing row can resume.

  2. Health preparation removes group-read access from existing artifacts. atomic_json replaces the aggregate and quality_summary.json with NamedTemporaryFile files. Reproduced both changing from 0664 to 0600, so readers using group access lose access after export. Please preserve the existing file mode before replacement and test it.

Broader producer coverage, all-failure-event aggregation and further policy migration can remain incremental. This was a focused code/test review, not a full live Slurm or MLflow qualification.

@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/41822900928

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

Thanks Giulio, both are fair and both are small. I'll take them as one follow-up PR right after this lands: the recovery stop reason represented on its own (not matched against the display text) with the combined masked + missing + budget regression test, and atomic_json keeping the file's existing mode instead of the NamedTemporaryFile 0600, with a test. Tracking them so they don't get lost.

@yuhezhang-ai

Copy link
Copy Markdown
Contributor

@AdamRajfer — I finished checking the remaining review cases against the merged head (365ce5e28) and the current stack. Most earlier fixes hold. I resolved three original findings with notes accepting their remaining nonblocking limits, and left these post-merge follow-ups:

  • Credential redaction: generic service keys and session headers still reach the saved identity.
  • Math judge without a verdict: a completed reply with no verdict still receives zero credit and exact health PASS.
  • Interrupted regrading: completed grades are preserved, but partial progress is lost from failed receipts/the stopping condition, and the remote reader rejects valid unfinished-regrading evidence.

One additional finding, [P2] clear or bind attempt extensions when starting a fresh run: RolloutStore.start_or_resume(..., resume=False) replaces the old manifest and outcomes but leaves rollouts_attempt_extension. I reproduced an old extension of 5, then a fresh run at the same output path configured for 3 attempts: it starts with cap 3, but its next resume reads the old file and raises the cap to 8. Please clear this sidecar with the other fresh-run state, or bind it to the run identity and reject stale values. Relevant code: extension load and fresh-run cleanup.

Could we carry these remaining fixes into a focused follow-up? I also checked #5594 and #5596; their current changes do not address these cases. The later stack inherits them, so I have kept the findings here with the original implementation and discussion.

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

@yuhezhang-ai the attempt-extension one is fixed in #5601 (ef4699d): a fresh run now removes rollouts_attempt_extension along with the rest of the replaced run's state, so your 5 + 3 case stays at cap 3 after the resume. There's a regression test for exactly that.

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

Following up: a fresh run now discards the rerun-masked approvals journal too, in 37f71af (#5601).

This branch was previously deployed

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

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants