Skip to content

feat(eval): check selected attempts in rollout health reports - #3881

Merged
AdamRajfer merged 130 commits into
mainfrom
yuhez/2135-recovery-health
Nov 4, 2026
Merged

AdamRajfer merged 130 commits into
mainfrom
yuhez/2135-recovery-health

Conversation

@yuhezhang-ai

@yuhezhang-ai yuhezhang-ai commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Health reports now inspect the same completed attempts selected for evaluation scoring, including after resume or judge-only recovery. An older success cannot reappear after a newer failed or interrupted attempt. Reports read selected records directly from the original run files, so a separate merged projection is unnecessary.

Stacked on #5443 in Adam's failure and recovery stack, which includes #5072 and #5343. Follow-up to #3302 for #2135. #3879 adds ordinary re-scoring above this PR.

Aggregation passes its exact scoring-history snapshots into health checks. Record checks, coverage and selected-failure timing therefore remain consistent if a collector appends while metrics are computed. Standalone checks read current history. Workers validate file identity and rollout/attempt identity before reading saved byte ranges; imported attempts keep their assigned execution numbers.

The integration preserves the stack's failure observations, artifact-digest binding, disabled/provisional reports, model-call-capture reads, persisted limits and shard-report entry points. Loose JSONL and explicit failure sidecars retain their diagnostic reading behavior. Scores and retry decisions are unchanged.

Validation

Python 3.13.14, Linux, dedicated CPU allocation:

python -m pytest -q -o addopts='' -o log_cli=false --tb=short \
  tests/unit_tests/{test_journal_health,test_rollout_health,test_health_timeouts,test_recovery_health_binding,test_evaluation_health,test_rollout_records,test_rollout_store,test_rollout_collection,test_recovery_review,test_eval_recovery_gate,test_aggregate_metrics,test_fern_docs_links}.py
pre-commit run --all-files
cd fern && npm run check
  • 1,893 passed, plus 24 subtests. All-files hooks passed; private guardwords catalog unavailable. Fern: zero errors, one warning.
  • Covers source advancement during aggregation, both merge modes, serial/process workers, mixed managed/loose inputs, aliases, file replacement, rewritten identity and the stack's same-attempt judge settlement through the standalone run-directory entry point.
  • The combined tree with feat(eval): rescore selected answers from resumed runs #3879 passed 2,335 tests, plus 24 subtests.
  • Fresh CPU Qwen2.5-0.5B smoke through actual Gym HTTP model/agent/FrontierScience services: three generated answers; a controlled saved judge failure recovered through feat(eval): recover from saved evidence with explicit gate results #5343 without changing its attempt; another attempt interrupted; two selected answers re-scored and checked by standalone health with no duplicate identities. No further policy calls occurred. FrontierScience declares its ordinary re-scoring mode UNKNOWN, so this controlled mechanics smoke explicitly used --force; it is not judge-accuracy or production-workload validation. Captured training-token traces and execution checkpoint restoration were not exercised.

Full sandbox/server CI remains pending for this rewritten head.

Compatibility and scope

Removes the temporary health guard against superseded histories and its obsolete internal projection argument. Existing report schema and policy remain in place. Judge-only recovery comes from #5343; execution checkpoint restoration remains outside this PR under #3024/#3893.

Checklist

  • Focused change with behavioral regressions and real-model integration evidence.
  • Local tests, all-files pre-commit and docs checks passed; full CI pending.
  • SPDX headers and DCO sign-off included.

@yuhezhang-ai yuhezhang-ai added feature New capabilities, enhancements, or enablement work area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters labels Oct 1, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 1, 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.

@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 1322d2c

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

@yuhezhang-ai
yuhezhang-ai force-pushed the yuhez/2135-recovery-health branch 2 times, most recently from f14cb90 to 922ee26 Compare October 6, 2026 18:46
Base automatically changed from yuhez/2135-rollout-recovery to main October 30, 2026 23:52
@yuhezhang-ai
yuhezhang-ai force-pushed the yuhez/2135-recovery-health branch from 922ee26 to 01ddac3 Compare November 1, 2026 16:43
@yuhezhang-ai

Copy link
Copy Markdown
Contributor Author

/ok to test 01ddac3

@AdamRajfer

Copy link
Copy Markdown
Contributor

/ok to test 0d06b64

AdamRajfer and others added 2 commits November 4, 2026 13:08
Main now carries #5343 as one squashed commit, while this branch carries
its original history. Two places conflicted where this branch adds lines
that #5343 never had (an import in nemo_gym/cli/eval.py and the
`gym eval status` tests); both keep this branch's text. The merged tree is
identical to this branch's previous tree: no content changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Brings in the base branch's merge of main, which now carries #5343 as one squashed commit. The tree is unchanged.

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

Copy link
Copy Markdown
Contributor

/ok to test ee83176

AdamRajfer and others added 10 commits November 4, 2026 14:34
run_examples records a shard on copies of the rows that name the shard's
run, but the copies kept the row's own rollout id, and with it the capture
key the model calls are staged under. Capture files are kept by default, so
a later shard that dispatched the same task and rollout (a row an earlier
shard returned, fed back, or indices numbered again each step) merged the
earlier shard's calls into its own records.

Each dispatched copy of a recorded shard now carries the row's own id (its
_ng_rollout_id, or <task>-<rollout>) prefixed with the shard's run id. A row
an earlier shard returned has that prefix replaced, not nested. The capture
key is that id with the usual attempt suffix, so capture_key and the
/ng-rollout/<capture key> path keep their form; only the key is now the
shard's own. The Store, the manifest, the records and the returned rows use
the same id, so a caller reads a capture's key from the returned row.
enrich_results without recording keeps the caller's keys.

Tests: two shards that dispatch the same task and rollout, with the row fed
back or the indices numbered again, each record only their own calls (they
fail without the change). The shard tests stage captures under the
dispatched key, as the model server does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
A recorded shard's manifest hashed the caller's rows and the recording
options, while the manifest gym eval run computes on resume hashes the
source file's bytes and the resolved configuration. Resuming a shard with
resume_from_cache was therefore refused for its source dataset and its
configuration. The earlier test passed the saved manifest in as the current
one, so it never compared the two.

The writer now builds the shard's manifest with RunManifest.create, the
identity function collection uses. Its inputs are the shard's materialized
inputs as the source file, the rows as dispatched, a collection config that
names the shard's input and output paths and leaves every other setting at
its default, and the call's server configuration. The identity file is
saved beside the manifest, as for any run, and replaced with the shard. So

  gym eval run +input_jsonl_fpath=<dir>/rollouts-<shard>_materialized_inputs.jsonl
    +output_jsonl_fpath=<dir>/rollouts-<shard>.jsonl +resume_from_cache=true

verifies and runs only what the shard still lacks. An operational
difference resumes with the usual drift note, and a semantic one is refused
and named. If the running configuration gives no identity (for example it
does not name the rows' agent), the shard is still recorded, with a
warning, and a resume refuses it and says why.

Tests: a shard recorded with one failure resumes through run_from_config,
dispatches only the failed row and ends with both rows scored; a shard
without a configuration identity is recorded and warns. Both fail without
the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
The training-framework section now says that a recorded shard dispatches
each row under its rollout id prefixed with the shard's run id, so a
capture's key is read from the returned row, and that a shard resumes with
gym eval run on its materialized inputs and its rollouts file.

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

Only a recorded shard prefixes its rollout ids with its run id. A plain
gym eval run and run_examples with enrich_results alone dispatch every row
under the id Gym derived before: <task>-<rollout>, or the row's own
_ng_rollout_id. The saved results carry the same ids, so recovery and
re-verification of such runs read the identities they always did. The test
passes before and after the shard change.

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

With record_omitted_rollouts left off, the shard writer returned for an
omitted row before its status write. When that row was the last one
expected and status writes were throttled, the final counts never reached
the status file: with two scored rows and an omitted third, gym eval status
reported one completed result instead of two. Closing the iterator
corrected it, but iterating to the end does not close it.

The early return now flushes the status when it handles the last expected
row. As with any flush, a writer that another writer superseded leaves the
newer status alone. The saved results do not change.

Test: the throttled status test also writes two scored rows and an unkept
omitted row, and expects two completed and one remaining (it reports one
completed without the change).

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

A recorded shard prefixes each row's rollout id with its run id, after
removing the prefix an earlier shard put on a row it returned. A row fed back
as `<earlier run>.0` and a new row whose own id is `0` therefore both became
`<this run>.0` in the same call. They would then share capture files and one
manifest identity. A training framework hits this when a step resubmits a
returned row next to fresh rows whose numbering restarted.

run_examples now refuses such a call before dispatch, and before the
existing shard is replaced. The error names both rows and both of their own
ids, so the caller can give each row a distinct _ng_rollout_id or distinct
task and rollout indices.

Test: `<earlier run>.0` beside `0` is refused with both ids named, nothing
is dispatched and the existing shard is kept. `<earlier run>.0` beside `1`
still dispatches, as `<run>.0` and `<run>.1`. It fails without the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
The capture key, a rollout id with its attempt suffix, also names the model
server's capture files. The longest of them is `<key>.capture.incomplete`,
and a file name holds at most 255 bytes. A recorded shard adds a 33-character
run-id prefix to each row's id, so a long explicit id could pass that limit
and fail only when the first model call was captured, mid-rollout.

A shared check, check_rollout_id_length in nemo_gym.core.episode_context,
allows a rollout id of up to 230 bytes. That leaves room for attempt
suffixes up to -a9999 and the longest capture file suffix, and also keeps a
key under a 256-character id limit. run_examples applies it to each
recorded row's id after the prefix is added, before dispatch and before the
existing shard is replaced. The error names the id, its length and the
limit.

Test: an id one byte over the limit, after the prefix, is refused with
nothing dispatched and no shard written. The longest id that fits
dispatches, and its capture file name at attempt 9999 is exactly 255 bytes.
It fails without the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
The library reference page generated from the judge_profile module failed
to parse: its module docstring wrote the pool node variable as
``${GYM_POOL_<POOL>_NODES}``, and the generated MDX read `<POOL>` as a tag.
The docs preview of any change that rebuilds the full reference failed on
it.

The docstring now names the variable as ``GYM_POOL_*_NODES``. No other
docstring combines a ${...} reference with an angle-bracket placeholder,
and the other pages built from docstrings parsed in the same build.

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

The library reference page for the judge_profile module failed to parse.
The page generator writes each field's default into an MDX attribute as
its Python repr, and JudgeExecutionProfile.qos_source defaulted to the
string "the partition's default". Because of the apostrophe, the repr is
double-quoted, so the generated line was

  <ParamField path="qos_source" type="str = "the partition's default"">

and MDX stopped at the `'` ("Unexpected character `'` in attribute name").

The default is now the module constant PARTITION_DEFAULT_QOS, with the same
text, so the page shows `str = PARTITION_DEFAULT_QOS`, as it does for
`kind: str = CPU_PROFILE`. The two other places that set the same source
use the constant too. The text in the operator's log does not change. No
other plain string default in nemo_gym contains an apostrophe.

Verified by generating the page locally with the docs CLI and compiling it
with MDX 3: the old page fails with the error above, the new one compiles.
The judge profile tests pass unchanged.

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

Copy link
Copy Markdown
Contributor Author

Rechecked ee8317605 against its immediate stack base. The earlier aggregation/health snapshot concern is addressed: health checks now use the same selected attempts, coverage and selected-failure timing as scoring. Fresh regressions passed, including source advancement during aggregation, mixed inputs and serial/process workers. No remaining code blockers were found in this pass.

Core, sandbox and server CI passed. The remaining docs-preview and nonblocking conformance failures also occur on the immediate base; the docs error is in the library reference generated from main.

@AdamRajfer, this looks ready for your final review. Thanks!

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

I ran this and read the health change. The tests are real: the health, store, records and recovery-review files pass on this head (1,777), and 47 of them fail against the current health module, so they pin the new behaviour (selected-offset reads from the original shards, replaced-file detection while appends stay allowed, a late success of a superseded attempt staying out, the aggregation cases).

The design reads right to me. Workers read the selected byte ranges from the histories that own selection, aggregation hands in its own snapshots so coverage and selection cannot drift apart, and the guard that refused superseded histories is gone. I looked for other users of the removed selected_projection and JournalHealthUnavailable: the only one left is a compatibility branch in cli/eval.py that checks whether the parameter exists, so it switches itself off with this change. Two small things inline.

Comment thread nemo_gym/rollouts/rollout_health.py Resolved
Comment thread nemo_gym/rollouts/rollout_health.py Resolved
AdamRajfer and others added 2 commits November 4, 2026 17:52
…recovery-health

Brings in the #5443 commits that landed after this branch last merged it, so the merge with main sees the shared history. No conflicts.

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

No conflicts; git merged every file on its own.

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

Copy link
Copy Markdown
Contributor

/ok to test 163203e

@AdamRajfer

Copy link
Copy Markdown
Contributor

Merged main after #5443 landed. The resolution kept main's manifest helpers and carried the digests: this PR's own diff against main is unchanged, and git merged every file on its own.

AdamRajfer
AdamRajfer previously approved these changes Nov 4, 2026
@kajalj22

kajalj22 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

/ok to test dd8348d

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

AdamRajfer and others added 2 commits November 4, 2026 19:14
No conflicts; git merged every file on its own, following the test files #5589 moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Main now mirrors nemo_gym's packages in tests/unit_tests (#5589). The
journal health test covers nemo_gym/rollouts/rollout_health.py, so it
moves to tests/unit_tests/rollouts/, and its import of the re-judge test
helpers follows that module to tests/unit_tests/eval/. Without the import
change the settled-judge-answer test fails with ModuleNotFoundError on the
merged tree.

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

Copy link
Copy Markdown
Contributor

/ok to test ddeb7ed

@AdamRajfer

Copy link
Copy Markdown
Contributor

Merged main again after #5589 left this out of the queue with a conflict. git merged it on its own; on top, test_journal_health.py moves to tests/unit_tests/rollouts/ to follow #5589's layout, and its import of the re-judge helpers now points to tests/unit_tests/eval/, where #5589 moved them.

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

This branch was previously deployed

1 inactive deployment
public — ddeb7edb Deployed Nov 4, 2026 by copy-pr-bot[bot] via release / finalize / notify #10086
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 needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants