Skip to content

feat(cli): report saved progress for every rollout run - #5360

Closed
marcromeyn wants to merge 1 commit into
mainfrom
romeyn/eval-status-main
Closed

marcromeyn wants to merge 1 commit into
mainfrom
romeyn/eval-status-main

Conversation

@marcromeyn

Copy link
Copy Markdown
Contributor

What and why

"How far along is this run, and what is failing?" had no answer during a run without reading JSONL by hand: progress was saved only for runs with an Eval Factory manifest, and no command read it.

  • Every rollout run writes <stem>_batch_status.json beside its output: expected, completed and remaining counts, failures by class, aggregation state and last update time. Counters update under the existing write throttle and survive resume. If tracking fails, a marker records that it is disabled and why.
  • gym eval status <run-dir-or-job-id> prints every status file in a run directory, or finds a submitted job through the local submission index; --json for scripts.
  • Counts follow the run health check's rules: a later success clears a failure; an interrupted retry (an omitted-rollout row) hides the older failure; a never-started retry changes nothing. This holds with and without a manifest.
  • gym eval aggregate marks each shard's status complete or error and keeps its counts; the merged output gets no status file, since EvalRDL sums the shards' files. A status file that cannot be updated is logged and skipped, never a reason to fail the aggregation.
  • Resume streams the failures sidecar and keeps compact rows, not full payloads. A run that fails or is cancelled writes its status once more, so results persisted inside the write throttle are not lost.

EvalRDL's Gym reader reads these files (evalrdl!281).

Validation

  • With the telemetry extra: pytest tests/unit_tests/test_batch_status.py tests/unit_tests/test_cli_main.py tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_fern_docs_links.py: 980 passed.
  • New tests: status without a manifest and across resume; identity errors not aborting collection; no payloads in status; separate output names; a fresh run clearing old status; interrupted vs never-started retries (with and without a manifest); the streamed resume read; aggregation marking shards and keeping counts; an unwritable shard status; a run failing with results inside the throttle (fails without the final write); gym eval status on a run folder and a job id, text and JSON, and a missing file.
  • pre-commit on the changed files.

Rollout evidence

gym env start --resources-server example_single_tool_call --model-type openai_model with gpt-6-luna, then gym eval run --no-serve --limit 3 --num-repeats 2: rollouts_batch_status.json reported 6 expected, 6 completed, 0 remaining, aggregation complete, no failures. gym eval status <run dir> printed the same as text and with --json.

Compatibility

New file per run and a new command. Runs with an Eval Factory manifest keep their status file and format; their failure counts now treat interrupted retries as the health check does.

Linear: FEP-1841 (part of FEP-1829 / GYM-1170).

Progress was saved only for runs with an Eval Factory manifest, and there
was no command to read it. Write <stem>_batch_status.json for every run
with expected, completed and remaining counts and failures by class, keep
it across resume, and add gym eval status <run-dir-or-job-id>.

Signed-off-by: Marc Romeyn <[email protected]>
@copy-pr-bot

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

@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test adc01c1

@marcromeyn
marcromeyn requested a review from AdamRajfer October 30, 2026 12:10
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 30, 2026 12:11
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:cli Command-line interfaces and user-facing command behavior feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@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 WITH CARE

Three RISK findings affect saved progress accuracy: aggregation identity mismatches, stale destination status after merging, and unflushed progress when post-collection work fails. No demonstrated rollout-score corruption.

Completed the broad review across all ten changed files and directly affected collection, aggregation, submission, and CLI paths. Static source review only; tests were not executed.

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

Comment thread nemo_gym/batch_status.py
aggregates, artifact_error = _read_aggregate_entries(aggregate_metrics_fpath)
members = {}
for agent, expected in sorted(self._expected_by_agent.items()):
entry = aggregates.get(agent)

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.

RISK — Match aggregation outcomes by execution identity, not display label.

Failure: A materialized taskset routed to environment, bound to agent hermes, gets a status member named environment because its input intentionally lacks agent_ref. However, _call_aggregate_metrics labels that server's metrics entry hermes. This lookup returns None, reporting aggregation error after successful aggregation. The existing producer regression asserts exactly that metrics shape.

The same mismatch affects _refresh_shard_status_aggregation: two shards naming agent agent_x behind env1 and env2 have agent-named status members, but combined metrics use server labels. Both shards are falsely marked error. Scores themselves are unaffected.

Correction: Could status tracking retain compact environment-server provenance and associate each member with its producing server(s), then resolve entries through their _ng_environment_server field? Supply that association to shard refresh as well, either in status metadata or from shard inventories. A member spanning multiple servers must check every relevant outcome. Keep the agent-name fallback for artifacts without server provenance; do not rename the metrics producer's intentionally distinct labels. The current compact projection drops the routing stamp, so a one-line lookup change is insufficient; the exact plumbing needs verification. Invariant: display-label differences must not turn successful aggregation into an error or attribute another server's outcome.

Preservation / proposed acceptance checks (not executed): (1) One materialized task through environment bound to hermes: expected/completed/remaining 1/1/0, aggregation complete. (2) Two shared-agent server shards: both successful means both complete; an aggregation_error for env2 marks only its shard error. A single member covering both servers must report error if either fails. (3) Ordinary one-server-per-agent and unstamped legacy artifacts retain agent-labelled resolution. (4) Retain pending/deferred states, missing-entry errors, unchanged counts, disabled/unwritable-status handling, and the distinct labels asserted by the shared-agent regression.

force=True,
)
else:
_refresh_shard_status_aggregation(input_paths, aggregate_metrics_fpath)

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.

RISK — Clear stale destination status when replacing a run with merged shards.

Failure: Collect into results/rollouts.jsonl, creating rollouts_batch_status.json, then aggregate different shards into that destination. When the destination is not an input shard, aggregation replaces its rollouts and writes a shard list, but this refresh updates only input statuses. The destination's previous status survives. Consequently, eval_status reports the old run's counts beside the new merged output, violating the stated no-independent-status-for-merged-output contract. Status-summing consumers can retain an obsolete extra run. The existing collection-then-merge test reaches this transition.

Correction: After successful replacement of the merged destination, remove only its stem-derived general-run status when not in_place. Suggested addition, traced statically and requiring author verification:

if not in_place:
    status_fpath = batch_status_path_for(output_fpath)
    try:
        status_fpath.unlink(missing_ok=True)
    except OSError:
        logger.warning(
            f"Could not remove stale run status at {status_fpath}.",
            exc_info=True,
        )

Invariant: after replacing a destination with other shards, those shards remain the progress owners; the destination must not retain unrelated counts. Cleanup should remain best-effort.

Preservation / proposed acceptance checks (not executed): Start with destination expected/completed counts of 2, merge a different one-row shard, and assert the destination status disappears while the shard retains its counts and becomes aggregation-complete. Retain the status for an in-place single-shard repair, leave destination sidecars untouched with merge_shards=False, preserve manifest-backed batch_status.json, and ensure a cleanup permission error is logged without aborting aggregation.

)
collection_succeeded = True
finally:
if not collection_succeeded and batch_tracker is not None and getattr(batch_tracker, "enabled", True):

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.

RISK — Flush durable progress before fallible post-collection work.

Failure: With two successful rollouts finishing within five seconds, the first writes status and the second is throttled. collection_succeeded then becomes true, skipping this flush. If upload raises or aggregation fails before returning its artifact—for example, during head-server setup—execution never reaches the final status update. The output contains two persisted successes, but saved progress remains one completed/one remaining. Cancellation during post-collection work has the same gap. This affects progress reporting, not saved scores.

Correction: Could this cleanup boundary flush the enabled tracker after both successful and unsuccessful collection? Replace the guard with the following and update its explanatory comment:

Suggested change
if not collection_succeeded and batch_tracker is not None and getattr(batch_tracker, "enabled", True):
if batch_tracker is not None and getattr(batch_tracker, "enabled", True):

Invariant: all persisted collection results reach status before upload/aggregation begins. Keep the later write so it still publishes complete/error/deferred aggregation state. This change was traced through the inspected callers and tests, not executed; verify before adopting.

Preservation / proposed acceptance checks: Add two immediately successful futures and an _call_aggregate_metrics override that raises. After the expected exception, assert two output rows and status (completed, remaining) == (2, 0), with aggregation pending. Also retain (2, 1) for failure during collection, deferred status and cleared failures in the resume regression, and manifest-backed complete/error/repaired outcomes in the existing integration test. Proposed checks were not run.

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 2, 2026
AdamRajfer added a commit that referenced this pull request Nov 2, 2026
…ure kinds

The original #5360 initialized a run's status from raw rollouts.jsonl and
its own reader of the failures sidecar, which #3302 had replaced on main
with the Store's selected records: raw JSONL can count an older success
after a newer retry. Status for a run without a batch manifest now goes
through the same path as a manifest-backed run: the RunStatusTracker is
built from the materialized rows (compacted as they are read, an
Environment Server route naming its dispatch target), initialized from
store.selected_records("success") and store.failures(), fed by the loop as
outcomes are recorded, and written once more if the run stops before its
final write, through the collection exit stack. Any error in the
manifest-less path disables the status with its reason and collection goes
on. The raw-JSONL reader is removed.

Status rows carry the failure kind beside the class, and mark the rows that
are the evaluated model's final result: an answered agent deadline
(is_answered_agent_deadline) or a failure its producer settled as a scored
zero. Both trackers report failures_by_kind and model_final_by_kind beside
the existing keys; nothing is renamed, since EvalRDL sums the per-shard
status files. gym eval status prints both, and the docs say what the counts
mean and where they come from.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
AdamRajfer added a commit that referenced this pull request Nov 3, 2026
…ure kinds

The original #5360 initialized a run's status from raw rollouts.jsonl and
its own reader of the failures sidecar, which #3302 had replaced on main
with the Store's selected records: raw JSONL can count an older success
after a newer retry. Status for a run without a batch manifest now goes
through the same path as a manifest-backed run: the RunStatusTracker is
built from the materialized rows (compacted as they are read, an
Environment Server route naming its dispatch target), initialized from
store.selected_records("success") and store.failures(), fed by the loop as
outcomes are recorded, and written once more if the run stops before its
final write, through the collection exit stack. Any error in the
manifest-less path disables the status with its reason and collection goes
on. The raw-JSONL reader is removed.

Status rows carry the failure kind beside the class, and mark the rows that
are the evaluated model's final result: an answered agent deadline
(is_answered_agent_deadline) or a failure its producer settled as a scored
zero. Both trackers report failures_by_kind and model_final_by_kind beside
the existing keys; nothing is renamed, since EvalRDL sums the per-shard
status files. gym eval status prints both, and the docs say what the counts
mean and where they come from.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>

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

gym eval status, the per-run <stem>_batch_status.json, aggregation marking each shard complete or error, and the CLI docs are all in #5443. The difference is that counts now come from the Store's selected records and failures rather than the raw JSONL, so the success-clears-failure and interrupted-retry rules are the ones resume uses, and the file also has failures_by_kind and model_final_by_kind. One edge worth knowing from the port: with the write throttle, the early return for an omitted last row that isn't kept skipped the final status write, so a shard could report one completed rollout too few; #5443 flushes there now. #5443 is in the merge queue; once it lands nothing remains here and this can be closed.

@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Nov 4, 2026
@marcromeyn

Copy link
Copy Markdown
Contributor Author

Carried into #5443 (merged), rebased onto the failure stack with authorship kept; closing this one.

@marcromeyn marcromeyn closed this Nov 5, 2026

This branch was previously deployed

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

Labels

area:cli Command-line interfaces and user-facing command behavior 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.

3 participants