Skip to content

feat(eval): persist failures and resume unfinished evaluations - #3302

Merged
yuhezhang-ai merged 46 commits into
mainfrom
yuhez/2135-rollout-recovery
Oct 30, 2026
Merged

yuhezhang-ai merged 46 commits into
mainfrom
yuhez/2135-rollout-recovery

Conversation

@yuhezhang-ai

@yuhezhang-ai yuhezhang-ai commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This PR makes interrupted Gym evaluations recoverable while keeping failures separate from measured scores and making partial results clear.

Example: a 100-task evaluation stops after 80 completed results have been saved. Resume keeps those 80 results and retries the remaining eligible tasks from their original inputs. Previous failures remain available for diagnosis. If the run remains incomplete, its score report shows how much of the planned evaluation actually completed.

The five main changes are:

  • Keep completed work: save results as tasks finish and reuse them on resume.
  • Record failures honestly: retain failure details separately, without inventing measured zero scores.
  • Bound retries: distinguish retryable failures from terminal failures and intentional skips, and enforce a failure budget.
  • Protect the experiment: allow one writer per run and check that saved work belongs to the same tasks and model configuration before reusing it.
  • Explain partial scores: report completed, failed, skipped and unfinished work alongside metrics, with consistent interpretation during collection and later aggregation.

Recovery scope: this is evaluation-run resume: unfinished tasks restart from their inputs. Restoring an agent's conversation or environment state partway through a task is the execution-checkpoint follow-up in #3893. Limited rejudging of saved answers is described below; broader judge-only recovery remains #3879.

Implementation details

This is the restart-from-input milestone of run recovery (#2135, #3024), following Ananth's scope review. Prerequisites #4029 and #4178 are integrated. The branch includes main through e165690fb (#5214), including #4840 Slurm orchestration fixes and #4836 URL trace propagation, in addition to #4788 health accounting, #4852 failure/retry exports and #4873 persisted retry caps. Broader judge-only recovery (#3879) and checking superseded trajectory histories (#3881) remain separate drafts. The previously agreed release scope is unchanged.

  • Save each finished outcome directly to the result file or failure sidecar. There is no dispatch journal or separate outcome commit.
  • Reserve execution IDs durably through one controller-owned allocator in the run manifest. The newest reservation selects the outcome, including an interrupted execution with no saved result.
  • Count recorded, nonterminal delivered/possibly-delivered failures toward the retry cap. Admission timeouts, nonterminal kill_shaped replies and interruptions without outcomes do not spend the failure budget or establish retry progress. Reported interruptions remain saved.
  • Hold one exclusive run lock across preparation, validation, collection and reporting. Refusals identify the holder; unsupported filesystems produce an actionable error.
  • Validate replies in both routing modes. With failure routing enabled, malformed replies become terminal environment_protocol_violation records; stale execution replies remain retryable. Preserve the producer's shared failure explanation, optional kind and diagnostic evidence without inventing a reward.
  • Partition coverage into measured, masked, unscored, failed, omitted, not-started and missing-outcome tasks. failure_budget_exhausted counts tasks at their eligible-failure cap. Offline readers capture outcome-file boundaries before reading the manifest, avoiding results newer than their reservation snapshot.
  • Preserve feat(rollout): let run_examples callers cancel rollouts still in flight #4029's cancellation/drain API, including the new direct run_outcomes() interface, and main's timing/capture cleanup. Telemetry counts outcomes only after persistence and includes actual reward and masking data in feat(telemetry): export the reward of each scored rollout #4609's reward counter. Cached results are not counted again.

Integration changes after the prerequisites

The latest main merge retains #4840's requeue guard, cancellation/walltime incomplete markers and resubmit fixes alongside this PR's exit-75 continuation and exit-76 stop rules. When an evaluation exits 76, the already-queued follow-up now exits 1, records .gym_chain_incomplete, and queues no further job. Previously that follow-up exited 0, although the evaluation itself correctly reported incomplete. Saved outcomes and scores are unchanged. The merge (96fd03ed1) and this status fix (e3261dfe3) are separate commits.

gym eval resubmit (#4766) works with managed recovery history: completed results remain selected, retryable failures receive a fresh bounded budget, and execution IDs keep increasing. Ordinary automatic restarts retain the reset boundary. Resubmission still checks experiment identity and terminal/omission policy. Live collection and offline readers use the same saved boundary; source protection and fresh-run cleanup include the resubmit offset. Existing GDPVal helper imports and offset format remain compatible. The merge and this compatibility fix are separate commits.

The subsequent #4736 model-call reader import refactor is integrated as well. The obsolete core invalid-judge migration, cached-deliverable retry wiring, Stirrup-only retry exceptions and removed configuration option are gone. GDPVal keeps #4178's own cached-deliverable implementation and retry policy; its completion check now receives explicit retryability and progress signals. An agent-stage crash does not request automatic continuation, and exhausted work cannot loop forever on exit 75. Temporary collector request failures remain eligible for a later job while budget remains; GDPVal's in-process retry and partial-waiver policies are unchanged.

gym eval reverify --judge-failed-only now accepts a manifest-backed source into a separate output when every saved outcome remains selected by its history. It carries successful rows through and rejudges saved judge_failed answers, including native saved partial responses. The source and its recovery state remain unchanged. Diagnostic failure responses are not treated as saved answers. In-place recovery and histories containing superseded outcomes remain refused until #3879.

Proposed reporting integration, pending agreement with Adam and maintainer review: this implements Ananth's suggested ownership. Runs with a manifest derive health and exporter counts from the store's selected history. Legacy runs keep raw-sidecar accounting. The merge is separate from the implementation commit.

  • The manifest saves the retry cap. Changing the process environment on resume or aggregation cannot change an established run's allowance. Older draft manifests acquire the cap on their first validated resume.
  • Intentional omissions are reported separately from failures. Exhausted failures are final. retries/at_cap matches failure_budget_exhausted, excluding free interruptions and failures before an explicit reset.
  • For managed runs, coverage/missing means reserved executions with no outcome. The new coverage/not_scored preserves expected minus scored. This is an intentional change to an existing metric's meaning; dashboard consumers still need to confirm compatibility.
  • coverage/failed/<class> counts selected failures; retries/attempts retains historical saved failed attempts, including interruption records. Historical attempts are distinct from eligible failures in the current budget.
  • Health reporting uses the same accounting during normal completion and SIGTERM, inside the collector's lock. A refused resume leaves existing reports untouched. Producer mask_sample behavior and scoring policy are unchanged.
  • Timeout, kill-shaped and judge recovery checks recognize both the canonical name and retained producer class. Saved answers survive that conversion. The E2E completion gate has explicit complete/incomplete/interrupted and require_complete regression coverage.

Health checks still inspect selection for the trajectory file they actually read. Older sidecar failures do not prevent checking successful retries, and managed merged projections use the original histories for accounting. Checking raw files with superseded trajectory rows remains #3881.

Checkpoint boundary

#3893 should use allocator-provided target attempts, validate the experiment before restoring, associate checkpoints with the persistent manifest run ID, and extend the collector's existing lock acquisition to cover checkpoint_dir. A process invocation ID is distinct from that persistent run ID. Do not nest a second run lock around run_from_config.

A checkpoint stop with unfinished work should use the incomplete-run exit path, with an advanced checkpoint counted as progress. No execution checkpoint restoration or joint #3893 validation is claimed here. The append-only reservation-log/performance follow-up remains #4360.

Validation

Current head: c3afe6dad. Merges main at 988df7527 (#5388), which independently fixes the same SWE Pivot test import failure addressed here in 4cd096ff6. The sole conflict was in test setup; the resolved file matches main exactly. Compared with the previous PR head, only the local stub variable name and an explanatory comment change. Recovery behavior, verifier behavior, scores and the pending policy decisions are unchanged.

On this merged tree, gym env test +entrypoint=resources_servers/swe_pivot +should_validate_data=true passed 190 tests and example-data validation in the isolated server environment, using CI's pinned uv 0.11.29. All-files pre-commit (including layering) and git diff --check passed; optional private guardwords catalog unavailable. DCO sign-off is included. No new model rollout is needed for this test-only merge. Exact-head full CI is pending; the unrelated non-blocking Kilocode probe remains separate.

Previous production head: 000bf70b0. Addresses the three concrete issues in Ananth's October 30 review:

  • Merged managed runs retain per-source rollout identity, selected failure history and timeout evidence. A directory health recheck agrees with aggregation, including superseded attempts and imported legacy rows. Original source artifacts are unchanged.
  • Exhausting the Slurm infrastructure/no-progress retry allowance writes .gym_chain_incomplete before exiting 1.
  • The manifest persists retry_terminal_timeouts; offline health/aggregation use the saved policy. Resume inherits it unless explicitly changed. Older manifests without the field default to false and can be updated through an explicit resume option.

Validation of this commit: 3,803 passed, 1 skipped across recovery, collection, store/records/outcomes, health/timeouts, CLI, resume scripts, comparison, artifacts/exporters/metrics, telemetry, import contracts, relevant native/legacy server paths, GDPVal and conformance helpers. All-files pre-commit (including layering), Ruff and git diff --check passed. The optional private guardwords catalog was unavailable. Fern check passed with 0 errors, 1 warning. The three bug regressions failed before their fixes; the additional legacy projection cases also failed before export retained the run identity. DCO sign-off is included.

No fresh model rollout was run for these reporting, persistence and generated-script changes. Script tests execute rendered Bash with controlled Slurm responses; no live multi-job Slurm chain is claimed. The upstream swe_pivot test import failure is fixed by the current test-only commit above; full CI for the current head is pending. The remaining interruption/final-failure reporting decisions and #5072/#3893 integration are not claimed resolved by these three fixes.

Previous head: e3261dfe3. After merging main, the recovery, collection, health, reverification, Slurm/resubmit/orchestration, CLI, telemetry and docs-link selection passed 2,767 tests and 24 subtests, with no failures; that selection omitted the two test files now corrected above. All 30 rendered resume-script tests passed separately (overlapping the selection). The strengthened exhausted-stop regression failed before the fix and passed afterward with both zero and remaining infrastructure-retry allowances. All-files pre-commit passed; Fern validation passed with 0 errors, 1 warning after moving npm's cache off the full local home filesystem. Both commits have DCO sign-off. These tests execute generated Bash with controlled Slurm command responses; no live multi-job Slurm chain or fresh model rollout was run for that script-only fix.

Earlier validation of the recovery implementation: the selections below overlap and are not an additive test total. The real-model evidence below identifies its tested revisions; the reporting smoke below predates the latest Slurm/main merge.

  • Python 3.13.14 with the locked dev, telemetry and Ray dependencies, on a bounded four-CPU Slurm allocation.
  • Recovery, collection, reverification, CLI completion, health, Slurm-resume, telemetry and GDPVal orchestration suites: 2,078 passed.
  • Adjacent CLI/comparison/docs, run timing, ATIF reverification, native/legacy environment adapters, GDPVal scoring, remote agent and harness-conformance helper suites: 764 passed, 2 skipped, 21 subtests passed.
  • Resubmit command, Slurm scripts/executor, submission/job tracking and exporter suites: 457 passed. Final focused resubmit checks: 37 passed (overlapping the broader selections, plus the helper directory-creation regression).
  • All-files pre-commit passed. Fern validation: 0 errors, 1 warning. The optional private guardwords catalog was unavailable locally. DCO sign-off included.
  • Regression tests cover actual reward-counter increments after saving, no recount on resume, separate-output judge recovery with an unchanged source, rejection of superseded histories and diagnostic-only answers, and GDPVal's current retry policy.
  • Eighteen earlier regression cases cover actual HTTP-503 continuation/recovery/exhaustion, legacy class/kind scoring through resume and offline aggregation, monitoring-only identity changes, and typed-outcome cancellation/drain. All eighteen detect the prior implementation's gaps.
  • Local conformance helper tests do not establish live external-agent/sandbox conformance. No full server matrix or joint checkpoint integration is claimed locally; current-head CI status is recorded above.

Rollouts

Fresh reporting/resubmit smoke passed on exact commit b69725015dff8222dd01865009675a0bbcc98160 (clean source tree bf94c0e2b1cc0f51a8fe64c599af5f2062abb9c7), using CPU Qwen2.5-0.5B through llama.cpp and the Gym HTTP setup described below. One answer was retained while two tasks experienced a controlled judge outage. Across automatic resumes and two explicit resubmissions, exits were [75, 76, 76, 75, 76, 76, 0, 0]; all eight failure records remained, and only unfinished tasks reran after recovery. Health failure/finality counts and exporter exhaustion matched selected coverage after every invocation. Changing the resumed process cap from 2 to 99 left the saved cap at 2. Completed resume made zero policy calls; online/offline score metrics agreed. All owned processes exited. This exercises production collector configuration/HTTP/persistence, with a controlled protocol producer around real model answers; it does not validate native agent-session lifecycle or a Slurm requeue.

Fresh resubmit smoke on source tree 11a7a831a505c11712f725a463d6cd4b18a5dbe3 (commit fa5492b87) passed using the same tiny real model and Gym HTTP setup described below, with bounded provider retries for fault injection. One task completed while two experienced a judge outage. Across two explicit resubmissions, automatic restarts exhausted each two-failure allowance and stopped; resubmission granted a fresh allowance while retaining the completed answer and all eight failure records. Once the judge recovered, only the two unfinished tasks ran, with successful execution indices [0, 4, 4]. Verified experiment identity remained true, completed resume made zero new policy calls, and online/offline metrics agreed. The full command/job-submission path is covered by executor/script tests, not a claim of real Slurm resubmission here.

The earlier full recovery smoke passed on source tree eff926a6d4fe3581f7caf741bb050549a4e5feea, using cached Qwen2.5-0.5B via llama.cpp, Gym model adapters, SimpleAgent and FrontierScience verification over HTTP. A controlled protocol producer wraps real agent outcomes; this checks conversion/recovery rather than native agent-session lifecycle.

  • SIGKILL with two answers saved and one request in flight: resume preserved the first two answers and completed 3/3. A concurrent writer was refused; damaged tails were repaired. Changing the reporting interval and monitoring hostname on resume preserved verified identity without allow_unsafe_resume.
  • Judge outage: three real answers persisted without rewards. Separate-output judge recovery re-scored all three with zero new policy calls, left every source artifact unchanged and was idempotent. Whole-task retry separately completed 3/3 with three new policy calls.
  • Empty resume exited 1 without dispatch. Mixed completed/omitted runs and their resumes exited 0; all-omitted runs exited 76. Repeated resume added no calls.
  • Admission/kill-shaped fault injection: two invocations each saved six failures, spent zero failure budget and exited 1 each time. Health checks read three successes after retry despite older sidecar failures.
  • Online/offline metrics agreed; driver write counts and bytes matched persisted work. Aggregation refused to overwrite another saved run through a symlink.

This validates recovery mechanics, not benchmark accuracy, GPU serving, sandboxes, distributed training or checkpoint restoration.

Compatibility and benchmark impact

The default retry cap is three eligible recorded failures, saved in the manifest when the run starts, not three dispatched executions. Changing the environment variable does not raise an existing run's cap; explicit resubmission grants a fresh allowance under the saved limit. outcomes_recorded counts all saved outcomes; progress_outcomes_recorded excludes uncounted nonterminal interruptions. Terminal failures stop independently, with the existing explicit timeout_exceeded override retained.

Library and CLI honor require_complete. Local commands default to false and may return partial results; gym eval submit enables it by default. When enabled, exit 75 means retryable work with progress, 1 means retryable work without progress, and 76 means nothing unfinished is eligible for retry. Mixed completed/omitted runs exit 0 with a count warning; all-omitted runs exit 76. Omitted and unscored tasks never acquire a fabricated reward. Failure-to-zero/missing-to-zero options affect metric inputs only, not saved outcomes or completion state.

Manifest format is version 2. Earlier unmerged dispatch-journal artifacts need their original revision or a fresh output location. A missing current manifest cannot safely be reconstructed from outcomes because reserved execution IDs may be lost. Restore a backup or start a new run. Legacy artifacts allow explicit unsafe import; corrupt/conflicting history and foreign-run records remain errors. With --no-serve, identity uses the running servers' settings; changing models/tasks is rejected. Timing-report intervals, warning thresholds and queue-monitoring addresses may change without invalidating identity; the same field names inside task data remain checked. #4178's removed options and old GDPVal layouts remain unsupported as documented upstream.

The shared EpisodeFailure.failure_reason, optional failure_kind and legacy sidecar aliases are retained. Producers own their explanation; unrelated grader/error fields remain diagnostics. The collector owns persisted identity, delivery/source and omission bookkeeping. Bare legacy _ng_no_persist replies become saved intentional omissions; GDPVal multistage retains its own retry treatment. Older explicit execute_only completions remain unscored successes.

_ng_failure_class follows the canonical failure kind. When a direct legacy producer supplies a different original class, it is retained as _ng_failure_legacy_class outside the shared failure model. Live and offline count_failure_classes_as_zero match either name and count the row once, preserving existing explicit scoring policies. Consumers needing the original class should prefer that optional field. Producer echoes cannot choose it. Older unmerged artifacts that already discarded the original name cannot recover it automatically; select their saved canonical class explicitly when counting those failures. The shared failure schema and per-outcome counter labels are unchanged by this class-alias fix. Run-level coverage/retry metric changes are described above.

Dashboard metrics preserve older producers' routing-class/type labels and add a kind only when supplied. Native episodes and the legacy Environment Server adapter use their shared kind for routing; an unspecified kind remains unspecified. When that kind supplies both class and kind labels, unregistered values are bucketed. This changes the adapter's earlier generic class/no-kind labels. Terminal skips are omitted; kill-shaped failures count as failed outcomes; cached and undispatched work is not counted. The existing scored outcome label includes supported unscored completions; the reward counter requires a numeric reward.

Aggregation and reverification protect established source runs and their companion artifacts, including aliases. Readers preserve unambiguous legacy alias-sidecar layouts; collection requires companions beside the resolved output. Ambiguous layouts are rejected. Aggregation writes results, metrics and coverage at the same resolved location used by comparison. Metrics-only aggregation uses a separate coverage report and refuses a file alias into another existing run unless it is the sole input. No exactly-once remote execution or hardware-failure durability guarantee is claimed.

Checklist

  • Contributing guidance followed; changes scoped to evaluation recovery.
  • Tests added/updated and passed locally; current-head full CI remains pending and must be checked before merge.
  • Documentation and all-files pre-commit checks passed.
  • New source files have NVIDIA/Apache-2.0 SPDX headers.
  • Authored commit has DCO sign-off.

@copy-pr-bot

copy-pr-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 1e89221

@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test f993e61

@yaoyu-33 yaoyu-33 added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Sep 11, 2026
waple0820 added a commit to waple0820/Gym that referenced this pull request Sep 12, 2026
Now that NVIDIA-NeMo#3179 landed, `BaseVerifyResponse` can name the kind of failure rather
than only whether the sample is usable. The three fields stay orthogonal:
`mask_sample` decides usability, `failure_kind` groups, `failure_reason` explains.
A degraded but validly measured sample names a kind and stays unmasked.

The field validates against `nemo_gym.failure_kinds` and warns rather than
rejects. An unregistered name is a migration signal; failing the response over it
would replace a visible wrong label with an invisible lost failure. An environment
that needs something the shared set should not grow uses `<server>:<kind>`.

Run-level reconciliation is no longer here. NVIDIA-NeMo#3302 implements it for NVIDIA-NeMo#2135, using
the materialized inventory and attempt journal to account for omitted and unknown
work offline — neither of which this contract can see. A second copy would be the
duplication this workstream exists to remove. What remains is the per-sample half:
the contract field and masked-aware aggregation.

Signed-off-by: waple0820 <[email protected]>
@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 67aa8fc

waple0820 added a commit to waple0820/Gym that referenced this pull request Sep 14, 2026
Now that NVIDIA-NeMo#3179 landed, `BaseVerifyResponse` can name the kind of failure rather
than only whether the sample is usable. The three fields stay orthogonal:
`mask_sample` decides usability, `failure_kind` groups, `failure_reason` explains.
A degraded but validly measured sample names a kind and stays unmasked.

The field validates against `nemo_gym.failure_kinds` and warns rather than
rejects. An unregistered name is a migration signal; failing the response over it
would replace a visible wrong label with an invisible lost failure. An environment
that needs something the shared set should not grow uses `<server>:<kind>`.

Run-level reconciliation is no longer here. NVIDIA-NeMo#3302 implements it for NVIDIA-NeMo#2135, using
the materialized inventory and attempt journal to account for omitted and unknown
work offline — neither of which this contract can see. A second copy would be the
duplication this workstream exists to remove. What remains is the per-sample half:
the contract field and masked-aware aggregation.

Signed-off-by: waple0820 <[email protected]>
@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 9dd9db9

Resolve import-only conflicts from the client (#5206) and trajectory (#5209) package moves, retaining the recovery imports and current behavior.

Signed-off-by: Yuhe Zhang <[email protected]>
Expose the existing ConfigError and ENVIRONMENT_SERVER_FAILED definitions
through the package APIs used by the conformance runner and legacy adapter.
Update the remaining recovery test and conformance import paths. No failure,
scoring, or retry policy changes.

Validation: 3,197 targeted tests and all-files pre-commit passed, including
package interfaces, import layering, recovery, legacy adapter and conformance.

Signed-off-by: Yuhe Zhang <[email protected]>
@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test f741bd7

AdamRajfer
AdamRajfer previously approved these changes Oct 30, 2026
@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 10820bd

balasaajay
balasaajay previously approved these changes Oct 30, 2026

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

Thanks, Yuhe. The split works, and so do the fixes from last round.

What's in place now:

  • Retry cap. It is saved in the run manifest, and every reader of a manifest-backed run uses it.
  • Counts agree. retries/at_cap equals failure_budget_exhausted. Omissions are no longer failures. The health summary, exporters, coverage file and exit code all project from coverage(), and they agree for success, judge failure, kill_shaped, admission, terminal skipped, exhausted and resubmit.
  • Merge with main. The three silent merge breakages are gone. A trial merge with today's main conflicts only in import blocks from the #5206 and #5209 module moves, and the core suite passes on the merged tree.
  • Last round's threads. The class fix and the completion-check test are in, and I'll resolve those threads.

Before merge:

  1. Merged-shard health. Adam's inline finding is real and comes from this branch. I've replied in his thread with a fix.
  2. The no-progress stop leaves no chain marker. The prologue's infrastructure-retry stop exits 1 without writing .gym_chain_incomplete, even though rollouts are still missing. The 76 stop now writes it, and this branch sends every retryable run without progress down the exit-1 path. Calling _gym_stop_incomplete in that branch of the resume script would cover it.
  3. The health recheck ignores retry_terminal_timeouts. See inline.

Decisions to state in the description:

  • How a kill_shaped interruption is reported. It is either a failure, which is what this branch does, or an omitted or missing rollout, as #5081 does. See inline.
  • Completion when #5072 lands. #5072 counts a final failure that counts as zero as a completed sample, while here it leaves an unfinished gap and exits 76. One side has to decide.
  • source="collector" or the RFC's boundary="collection". This branch is the first writer of these records on main, so this is the last cheap rename.

For whichever of this and #5072 lands second:

  • _sanitize_legacy_result silently drops #5072's _ng_failure_counts_as_zero. It needs to go into _LEGACY_RESULT_FIELDS, or be rejected loudly.
  • A trial merge of #5072's current head gives about a dozen conflict hunks in rollout_collection.py, several of them semantic. Only the judge-failure path works in either order today.

Neighbouring work:

  • #5201 gates resume in _load_from_cache, which this collector no longer calls, so after this lands it does nothing while its tests still pass. Its policy belongs in the store's retry selection, with #3879 owning judge-only recovery.
  • #3893 needs four things:
    • target attempts from the manifest allocator;
    • checkpoint state keyed to RunManifest.run_id;
    • checkpoint_dir passed to the existing lock, with restore and close inside it;
    • a newer published checkpoint counted as progress, or a rollout spanning several jobs exits 1 each time.
  • Upcoming module moves. The subpackage moves in #5231, #5244 and #5212 will need to carry rollout_records, rollout_recovery and rollout_store.

Nits, fine as follow-ups:

  • Reverification still exports coverage/missing with the old meaning, expected minus scored.
  • _load_from_cache passes the environment's cap, so a changed NEMO_GYM_MAX_ROLLOUT_ATTEMPTS raises there, against resume.mdx. Only a benchmark script calls it now.
  • Tests do not reach the managed merge_shards branch, and they do not check retries/at_cap against a terminal failure or a nonzero health not_final.
  • The reader race after a torn tail is still open.
  • Folding test_recovery_review.py into the module test files is still pending.

Comment thread nemo_gym/rollout_health.py Resolved
Comment thread nemo_gym/rollout_collection.py Resolved
@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 000bf70

@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 4cd096f

@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

Thanks @ananthsub the three concrete fixes and the upstream CI test-import fix are pushed.

With #3302 landing first, the remaining items for @AdamRajfer #5072 integration are:

  1. Preserve _ng_failure_counts_as_zero through collection.
  2. Agree whether final failures scored as zero count as completed.
  3. Agree how kill_shaped interruptions should be reported.
  4. Settle source="collector" versus boundary="collection" naming.

Could you take another look at #3302 ?

@AdamRajfer

Copy link
Copy Markdown
Contributor

Thanks, I rechecked these against the current store and collection paths. I’ll handle the integration in #5072 and #5343.

  1. I’ll preserve _ng_failure_counts_as_zero through collection and save/reload. It must come from an explicit final policy decision, never from reward=0 or kill_shaped alone.
  2. Yes, an explicitly final failure scored as zero should count as complete for resume and the score denominator. It must not get another model attempt. The failure stays visible in health, and completion must not imply that verification ran.
  3. I’d keep kill_shaped as an ungraded interruption. Preserve the saved answer, attempt history and elapsed budget. It adds no model-failure debit by itself and never resets earlier usage. Resume still needs an eligible interruption cause and remaining budget. If the cause is unknown, automatic recovery stops. A saved answer waiting on verification must not be regenerated.
  4. I’d keep source="collector" in the saved record and boundary="collection" in the causal event. They describe different facts: who recorded the failure and where it occurred. I don’t think renaming one into the other is the right fix. I’ll document the mapping and test the handoff.

The recovery reader also needs to follow the store’s selected attempt and saved policy. An older successful row must not hide a later interrupted attempt. I’ll cover that in the integration tests.

@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test c3afe6d

@AdamRajfer AdamRajfer 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 the production fixes in 000bf70 at 4cd096f. The three concrete findings are addressed: merged health checks preserve source identities and selected timeout history, exhausted infrastructure retries write .gym_chain_incomplete, and offline readers use the saved retry_terminal_timeouts policy. My earlier merged-shard finding is fixed. The regressions reproduced before the fixes and pass afterward.

The collection, recovery, health and neighboring tests passed. I also checked the move to c3afe6d: it only aligns the SWE Pivot test stub with the upstream fix, with no production delta. No additional blocking finding was confirmed in this bounded review. This does not claim live rollout or multi-job Slurm validation. The four interfaces discussed above remain my #5072 integration follow-through.

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

Approved.

Thanks also to @AdamRajfer for taking the #5072 integration in #5072 and #5343: keeping _ng_failure_counts_as_zero, treating a count-as-zero final failure as complete, reporting kill_shaped as an ungraded interruption, and documenting the source / boundary mapping.

Follow-ups, none blocking:

  • the reader race after a torn tail;
  • folding test_recovery_review.py into the module test files;
  • reverification still exporting coverage/missing as expected minus scored;
  • the cap check in _load_from_cache;
  • the #3893 changes listed in my last review.

@github-actions

Copy link
Copy Markdown
Contributor

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

This branch was previously deployed

1 inactive deployment
public — c3afe6da Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8866
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 complexity:high Cross-component or shared-contract change with a large review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants