Repository navigation
feat(cli): report saved progress for every rollout run - #5360
marcromeyn wants to merge 1 commit into
Conversation
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]>
|
/ok to test adc01c1 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
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.
| aggregates, artifact_error = _read_aggregate_entries(aggregate_metrics_fpath) | ||
| members = {} | ||
| for agent, expected in sorted(self._expected_by_agent.items()): | ||
| entry = aggregates.get(agent) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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:
| 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.
…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]>
…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
left a comment
There was a problem hiding this comment.
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.
|
Carried into #5443 (merged), rebased onto the failure stack with authorship kept; closing this one. |
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.
<stem>_batch_status.jsonbeside 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;--jsonfor scripts.gym eval aggregatemarks each shard's statuscompleteorerrorand 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.EvalRDL's Gym reader reads these files (evalrdl!281).
Validation
telemetryextra: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.gym eval statuson a run folder and a job id, text and JSON, and a missing file.pre-commiton the changed files.Rollout evidence
gym env start --resources-server example_single_tool_call --model-type openai_modelwithgpt-6-luna, thengym eval run --no-serve --limit 3 --num-repeats 2:rollouts_batch_status.jsonreported 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).