Repository navigation
feat(eval): report causal failures across service boundaries - #5072
Merged
Merged
Conversation
Contributor
AdamRajfer
force-pushed
the
arajfer/failure-reporting
branch
from
October 26, 2026 01:37
ad23cee to
c9b4f06
Compare
AdamRajfer
force-pushed
the
arajfer/failure-reporting
branch
from
October 26, 2026 01:48
c9b4f06 to
648613e
Compare
AdamRajfer
force-pushed
the
arajfer/failure-reporting
branch
from
October 26, 2026 03:42
648613e to
ee65dce
Compare
AdamRajfer
force-pushed
the
arajfer/failure-reporting
branch
from
October 26, 2026 11:24
ee65dce to
fbbae8d
Compare
wprazuch
previously approved these changes
Nov 3, 2026
giuliolovisotto
previously approved these changes
Nov 3, 2026
Contributor
Author
|
@giuliolovisotto thanks for the approval. To be clear on scope: the container field above (and the rest of your sandbox schema) lands in the sandbox follow-up PR stacked on this one, not here, so this PR can merge as is. |
hemildesai
previously approved these changes
Nov 3, 2026
kajalj22
previously approved these changes
Nov 3, 2026
#5235 moved RunHelper and its helpers from cli/env.py to orchestration/server_supervisor.py unchanged. This branch's server-start changes (the typed server_start_failed error with the bind errno, the output tail each server keeps, and one restart on a fresh port after EADDRINUSE) move with RunHelper to server_supervisor.py; cli/env.py is main's. The server-start tests import from and patch the new module. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Contributor
Author
|
/ok to test 4f6e66d |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41682064268 |
kajalj22
previously approved these changes
Nov 3, 2026
#5244 moved the evaluation modules into nemo_gym/eval. The lazy imports in nemo_gym/artifacts keep main's new entries together with this branch's no-generation marker. This branch's tests import rollout_reverification and rollout_compare from their new nemo_gym/eval paths. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Contributor
Author
|
/ok to test e4b8c67 |
Main moved the registries into nemo_gym/environment (#5298) and replaced the cli_setup_command shim with a moved-path entry (#5300); both merge cleanly with this branch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Contributor
Author
|
/ok to test 8a50c94 |
kajalj22
approved these changes
Nov 3, 2026
This was referenced Nov 3, 2026
35 of 41 tasks
7 tasks done
7 tasks done
Open
7 tasks done
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detect, classify and carry failures across model, agent, environment and verifier boundaries. A recovered attempt stays observable, and a sandbox or judge failure never silently becomes an ordinary incorrect answer. #5343 (recovery from saved evidence) is stacked above this PR.
Behaviour changes for users on main
Clean runs score as before, unless a benchmark is affected by the
limitor vLLM config change below.For rows whose model, verifier, judge, server or sandbox failed:
--resumeno longer re-runs judge failures, rows that kept an answer or a grade, requests that may already have been delivered, or kill-shaped rows of unknown cause. To re-judge judge failures, usegym eval reverify; on a manifest-backed run, write its output to a separate file./runwithin a connect grace period (dispatch_connect_grace_s: 60 s by default, 0 turns it off), and retries a taken server port once.unregistered:<kind>instead of dropping the report; any other invalid report is still omitted.judge_unparseablenow counts as a judge failure, alongsidejudge_failedandjudge_invalid: the row keeps its saved response and is judged again instead of run again. Only rows of that class change.Other changes:
limitcounts tasks, not rows.+limit=Nkeeps the first N tasks, and every repeat of those tasks still runs. Before, it kept the first N rows, so a benchmark with repeats built into its data ran fewer tasks.vllm_modelconfigs no longer setchat_template_kwargs,sampling_overridesandextra_bodyto null, so values a benchmark or environment config sets forpolicy_modelnow survive--model-type vllm_model. A benchmark that sets them now runs with them, which can change its generation and score.--no-health-checknow writes a health summary with the statedisabled. The report line changed from "Rollout health: … healthy … unhealthy" to "Rollout checks: … passed … flagged", so anything that matches the old line needs updating.Not in this PR
gym eval resubmit --recover,gym eval inspect, the job chain's guard) lands with feat(eval): recover from saved evidence with explicit gate results #5343. Diagrams 3–5 are folded below under "Lands in the next PR of the stack".Merge order
This PR first, then #5343, then #5443. Preserve the commits in each PR; do not squash. After this PR lands, merge main into the upper layers so each diff shows its own layer. This PR works on its own: its typed failure kinds, retries and failure records take effect in collection and resume; the recovery planner that reads those records arrives with #5343.
Reporting contract
NgFailureEventis the raised and serialized failure type. Registered kinds, boundary, operation, event ID and explicit cause links survive the supported HTTP, process and Store paths.EpisodeFailurefields remain supported; the causal report travels beside the outcome./runwithin a connect grace period, retries a taken server port once, bounds the events a failure log retains, and marks placeholders that hold no generation.Per-adapter changes
/runpath. Confirmed response-only timeouts honor the existing explicit policy. Unknown delivery cannot authorize replay. A failed reply whose report selects nothing is still verified.false_statement_judge)The diff also touches these servers and agents, which the table does not describe: rolemrc, tavily_search, browsecomp_advanced_harness, finance_sec_search, labbench2_vlm, mcqa, text_to_sql, terminus_judge, swe_together, nemo_user_sim, tau2, codex_agent, openclaw_agent, gdp_pdf_agent and remote_agent (no-generation marker). It also adds import-linter layer rules in
pyproject.toml.Review guide
Start with
typed_exceptions.py,server_runtime/episode_types.py,core/failure_kinds.pyandfailure_transport.pyfor the causal contract, thenclient/http_client.py,client/openai_client.py,verification/judge.pyandserver_runtime/verifier_observability.py, then the adapters above.Validation and remaining limits
omitted; a stream event is marked omitted only when it carries the report key. Unsupported or incomplete evidence stays non-accepting. This PR does not provide a ledger of every physical attempt.How the failure handling decides
1. A rollout attempt fails inside the run
How collection types a failed attempt, records it, and retries it within the attempt cap.
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 F(["A rollout attempt fails: agent, model, environment, judge, verifier, provider, session, transport or harness"]) --> K["The producer names the cause with a failure kind<br/>nemo_gym/core/failure_kinds.py FAILURE_KINDS, or an environment-specific server:kind name<br/>groups: transport_*, agent_*, model_*, environment_*, judge_*, verifier_error, provider_*, session_*, cancelled, kill_shaped, shutdown, server_start_failed, persistence_failed, cohort_incomplete"] K --> REC["The attempt is recorded with its kind<br/>RolloutFailureRecord in artifacts/rollouts_failures.jsonl<br/>rollouts.rollout_collection._failure_outcome"]:::fact REC --> TERM{"Terminal?<br/>rollouts.rollout_recovery.is_terminal_failure: the record is stamped _ng_failure_terminal<br/>timeout_exceeded is retryable when retry_terminal_timeouts is set"} TERM -->|"yes"| ZERO{"Does the benchmark count this failure class as a zero?<br/>count_failure_classes_as_zero"} ZERO -->|"yes"| FZ["Settled final zero: the trial counts as completed and scores 0<br/>rollouts.rollout_collection._failure_rows_counted_as_zero"]:::go ZERO -->|"no"| TF["Terminal failure: the trial stays failed with its kind"]:::stop TERM -->|"no"| ATT{"Attempts so far below the cap?<br/>rollouts.rollout_recovery._get_max_rollout_attempts, default 3 attempts per rollout identity"} ATT -->|"yes"| RTRY["Retryable: the next segment or a resume runs it again"]:::go ATT -->|"no"| EXH["Exhausted: every attempt used, nothing runs it again"]:::stop2. A segment ends
What a job segment leaves behind when it ends, for the next segment or a recovery to read. The exit codes are already on main.
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 SEG(["The segment ends its collection<br/>rollouts.rollout_collection.check_completion"]) --> ALL{"Every expected identity settled?<br/>scored, settled final zero, terminal, or omitted by an accepted partial stage"} ALL -->|"yes"| DONE["Run complete: aggregate metrics and the export are written, the job COMPLETEs"]:::go ALL -->|"no"| RTB{"Is anything still retryable?"} RTB -->|"no"| X76["exit 76: nothing is eligible for another attempt, the chain stops<br/>even if the segment made progress"]:::stop RTB -->|"yes"| PROG{"Did this segment make progress?<br/>new saved rows or new recorded failures"} PROG -->|"yes"| X75["exit 75: unfinished work, the chain continues<br/>IncompleteEvaluationError"]:::go PROG -->|"no"| X1["exit 1: no progress, the chain spends one infra retry"]:::stop X75 --> KIND["Lands in the next PR of the stack: the kind that ended the segment is written for the next job's guard"]:::fact X1 --> KIND X76 --> KINDLands in the next PR of the stack
Diagrams 3–5 show the job chain's guard, the recovery decision and the inspect gate. None of that is in this PR's diff: it lands with #5343 and is kept here only so the whole flow reads in one place.
3–5: job chain guard, recovery decision, inspect gate (#5343)
3. The job chain's guard: continue or stop
How the next segment continues, retries on an infrastructure cause, or stops and writes why.
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 -->|"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 4"] 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 -->|"no"| SF["accounting-unknown marker: automatic continuation stops, inspect the queue and the terminal accounting"]:::stop4.
gym eval resubmit --recoverandgym eval inspectHow 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/>recovery.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"]:::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"]:::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["stop: saved judge answers and policy work need separate recovery"]:::stop 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"]:::go5. 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 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, judge_failed, verifier_error, 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🤖 Generated with Claude Code