Skip to content

fix(eval): recover a run whose coverage report predates allocation_id - #6223

Merged
wprazuch merged 1 commit into
mainfrom
wprazuch/recover-pre-allocation-id-run
Nov 16, 2026
Merged

wprazuch merged 1 commit into
mainfrom
wprazuch/recover-pre-allocation-id-run

Conversation

@wprazuch

@wprazuch wprazuch commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

A coverage report written by a worker older than the allocation_id field names no writer. Recovery could not prove that the allocation holding the in-flight reservations had ended, so it stopped. The run could then never be continued, and the rollouts already graded stayed stranded.

We hit this on a 600-rollout run that stopped after its first segment with 423 rollouts graded. There is currently no way to resume it.

What changes

  • A report that omits allocation_id still has its writer in the job chain, because the prologue records each allocation there before the Store opens. In that case the cut holds only when every allocation of the chain has ended.
  • A report that records allocation_id as null means a writer outside the scheduler, and stays unknown exactly as before.
  • collect_evidence now reports which of the two it saw, as coverage_writer_unrecorded, so a missing key and an explicit null are no longer conflated.

Verified

  • Two new tests in test_allocation_cut_recovery.py cover both directions: reservations resume when the coverage names no writer and the chain ended, and they stay unknown when a chain record is missing.
  • The equivalent change was reviewed and its pipeline passed on our internal deployment.
  • I could not run the suites on this machine: its environment has an openai older than the tree expects, so collection fails before any test runs. CI here is the check.

Known limitation: mixed-version chains

The in-job guard (_store_writer_ended) still treats an unnamed writer as unknown. So a chain that mixes workers from before and after allocation_id stops at the follow-up and needs a manual gym eval resubmit --recover to continue. This change deliberately does not alter the in-job path: that guard runs without scheduler accounting, so it cannot make the same determination safely.

A coverage report written by a worker older than the allocation_id field names
no writer, so recovery could not prove that the allocation holding the
in-flight reservations had ended. It stopped instead, and the run could never
be continued: the rollouts already graded stayed stranded.

Such a report still has its writer in the job chain, because the prologue
records each allocation there before the Store opens. When the report records
no allocation at all, every allocation of the chain must have ended for the cut
to hold.

A report that records allocation_id as null is a writer outside the scheduler
and stays unknown, as before. collect_evidence reports the distinction as
coverage_writer_unrecorded, so a missing key and an explicit null are no longer
conflated.

Signed-off-by: Wojciech Prazuch <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 16, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

LGTM, no concerns found.

I inspected all four changed files and traced the new evidence flag through Store selection and scheduler-backed recovery. The fallback requires terminal accounting for every recorded chain allocation; explicit null still keeps the writer unknown. The new regression cases check successful recovery and missing accounting records.

Static review only. I could not execute tests in this read-only environment.

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.

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

🤖 Adam’s AI assistant, reviewing on Adam's behalf.

The fix is right and conservative: a missing key resumes only once every chain allocation has a terminal record, and an explicit null or a missing record still stops. I ran the touched suite on this head and it passes. Undoing the collect_evidence change, and separately the slurm.py call site, makes the inspect test fail both times, so it catches the bug.

Two asks before merge:

  1. Could you run gym eval resubmit --recover --inspect on the stranded 423/600 run with this head and post the decision line here?
  2. The in-job guard (_store_writer_ended) still treats an unnamed writer as unknown, so a mixed-version chain stops at the follow-up and needs a manual --recover. Fine to leave, but please say so in the PR body.

Happy to look again once unit CI is green.

@wprazuch

Copy link
Copy Markdown
Contributor Author

/ok to test 552a93a

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 16, 2026 14:00

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

🤖 Adam’s AI assistant, approving on Adam's behalf. Unit CI is green. Please still post the --recover --inspect line and the note on mixed-version chains before merging.

@wprazuch
wprazuch added this pull request to the merge queue Nov 16, 2026
@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/43896496693

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 16, 2026
@wprazuch

Copy link
Copy Markdown
Contributor Author

Ran gym eval resubmit --recover --inspect on the stranded 423/600 run with this head. Read-only: it planned, dispatched nothing, and the run directory is byte-identical before and after (3853 entries, same names, sizes, times and modes, rollout files included).

Decision line, verbatim:

operator verdict: needs_action: 423 of 600 rollouts are settled; 17 retryable, 160 missing remain; action: `gym eval resubmit <job> <benchmark> --recover --repin <commit> --repin-reason TEXT --score-key '["agent_metrics", "mean/reward"]' --score-agent programbench_agent` now

Action resubmit, ok: true, dispatched: null, gate PLANNED (NOT DISPATCHED). Counts: 423 scored, 17 retryable, 160 missing of 600.

Before the fix, the same command on the same run decided STOP: 423 scored, 17 retryable, 64 unknown (reservation_without_outcome), 96 missing. The 64 reservations are what the fix now counts as missing, so the run becomes resumable.

On the mixed-version caveat: this chain is not mixed. Both jobs ran the same pre-allocation_id worker, one wrote the rollouts and hit its 24 h walltime, the other failed at admission in 57 s before opening the rollout store. The coverage report carries no allocation_id key and both allocations ended, so the new check passes. It becomes mixed only once a recover repins it, which is the case the PR body now notes.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added bug Something isn't working area:orchestration Job submission, deployment, services, and lifecycle management ready-to-merge PR is approved, current, and waiting for final CI or merge labels Nov 16, 2026
@wprazuch
wprazuch added this pull request to the merge queue Nov 16, 2026
@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/43902543730

Merged via the queue into main with commit 308dfba Nov 16, 2026
71 checks passed
@wprazuch
wprazuch deleted the wprazuch/recover-pre-allocation-id-run branch November 16, 2026 16:14
prokotg added a commit that referenced this pull request Nov 17, 2026
Ports main's changes to the files this PR moved:
- orchestration/recovery.py (#6210, #6080, #6223): 3 symbols changed and 6 added, into the eval/recovery
  modules; NO_ELIGIBLE_RETRY_REASON moves to eval/recovery/markers.py because the evidence reader now
  uses it.
- executors/slurm.py (#6210, #6223, #6215): the 12 hunks, into executors/slurm/chain.py, judge_job.py and
  reader.py.
- tests that import the old module paths (the otel, resubmit and recovery tests added since).

Signed-off-by: Tomasz Grzegorzek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:orchestration Job submission, deployment, services, and lifecycle management bug Something isn't working 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.

3 participants