Repository navigation
fix(eval): aggregate execution metrics in the environment server - #5455
Merged
yaoyu-33 merged 17 commits intoNov 12, 2026
Merged
Conversation
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Review follow-ups for the Env-side execution aggregation: - Update the single_agent_turn README, which still said skip_verification returns empty aggregate metrics, and the legacy README, which still said /aggregate_metrics is forwarded unchanged; the legacy server inherits the new behavior. - Return early from _add_completion_token_metrics when no row carries ng_perf, so repeat rows a Resources server published without _ng_rollout_index pass through instead of raising KeyError in the Env. - State in the add_execution_metrics docstring that it replaces perf_summary, strips agent_ref from repeat rows, and what it requires of existing repeat rows. - Pin the agent_ref removal and repeat ordering for repeats the Env adds, stripping of non-dict ng_perf from the Resources body, and the pass-through case above. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 8b4ea78 |
- Keep a perf_summary that Resources published itself when no row carries ng_perf; observed batches still replace it. - Share one helper for the perf summary between add_execution_metrics and the fully masked early return of compute_aggregate_metrics. - Run the Env's CPU-bound execution reduction in a worker thread so it does not stall the server's event loop. - Note in the aggregate-metrics page that ng_perf token statistics add per-repeat rows even for a single repeat. - Freeze the direct-path result of a mixed batch as a regression oracle (the values also hold on origin/main's reducer) and pin the perf_summary keep-or-replace behavior. - Collapse the redundant skipped-and-masked parametrization and rename the test to match the case that has valid scores. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]> # Conflicts: # environment_servers/single_agent_turn/app.py # environment_servers/single_agent_turn/tests/test_app.py
Contributor
Author
|
/ok to test 089d732 |
Contributor
This was referenced Nov 3, 2026
Main now names the bound resources server through config.resources_server and raises boundary failures with raise_boundary_failure; the environment aggregation keeps both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test c396405 |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 10, 2026
…eduction Merge main to include the agentic-if-realworld reporting contract. Expect only ng_perf to be removed on the Environment-to-Resources hop while retaining exact final artifact equality and benchmark evidence checks. Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 16232f3 |
Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 5091249 |
Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 595eeb3 |
adil-a
approved these changes
Nov 11, 2026
adil-a
left a comment
Contributor
There was a problem hiding this comment.
Re-approving after the stale-review dismissal. The PR's own commits are unchanged since the earlier approval except the release-rehearsal changelog commit and a sync with main, and CI is green on this head. (Delta check done with Claude Code on Adil's behalf.)
yaoyu-33
enabled auto-merge
November 11, 2026 23:08
kajalj22
approved these changes
Nov 12, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43259683611 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review follow-up validation (2026-11-09): On
ws,python -m pytest --import-mode=importlib environment_servers/single_agent_turn/tests/test_app.py environment_servers/single_agent_turn_legacy/tests/test_app.py tests/unit_tests/metrics/test_aggregate_metrics.py -q: 317 passed. Includes custom unindexed/mixed repeat-row regression coverage. Independent source and patch review found no additional blocker. Fullpre-commit run --all-fileswas attempted: Ruff, formatting and import layering passed; repository-wide guardword findings and a hook Python environment mismatch prevented a clean full run. No new model rollout was run for this guard/naming/docs follow-up; prior smoke scope is recorded below.single_agent_turncurrently loses execution metrics when verification is skipped and delegates their reduction to Resources otherwise. This change makes Env aggregateng_perfinto performance summaries, per-repeat token statistics, and confidence intervals. Resources retains benchmark scoring and task-specific weighting. Regression tests exercise the production path.flowchart LR A["Agent observations + model captures"] --> C["Rollout collection: persisted batch"] C --> E["Env /aggregate_metrics"] E -->|"benchmark evidence; ng_perf excluded"| R["Resources server: benchmark reducers"] E -->|"ng_perf from all supplied rows"| P["Shared performance reducer"] R --> M["Env: merged result"] P --> MThe same Env implementation works with different Resources scoring policies. Verification controls whether quality metrics are computed; execution accounting remains available in both cases.
flowchart LR E["Same Env implementation"] --> V{"Verification enabled?"} V -->|"yes"| R["Configured Resources: task-specific scores"] V -->|"no"| N["Quality metrics omitted"] E --> P["Execution metrics in either case"]Compatibility:
single_agent_turnand its legacy subclass now add performance metrics for all supplied rows, including verification-off and fully masked batches.critpt_custom_graderand gdpval comparison mode gainperf_summaryand token statistics that their own reducers did not publish. In gdpval multistage runs, quality/sample counts cover the final stage while token statistics cover every supplied stage. Reverification posts directly to the resources server and does not apply this environment-server enrichment, so its performance fields can differ from collection. Custom repeat rows without_ng_rollout_indexare preserved and skip the token merge.response.usage, provider metrics, and benchmark fields are preserved.Remaining paths:
legacy_agentstill delegates aggregation to the agent and returns empty metrics when verification is skipped.nemo_user_simdelegates to the resources server withng_perfattached; its skip-verification changes are in #5823. Unifying those paths is separate follow-up work. No new public issue is created by this focused fix.Validation at
1fe629b94(main merged at379ae226don 2026-11-06; a review team and a second independent review found no correctness problem):environment_servers/single_agent_turn/tests: 191 passed;single_agent_turn_legacy/tests: 43 passed;tests/unit_tests/metrics/: 128 passed, 3 skipped, 3 failed (the samewandbgap);test_session_contract_repo.py+test_global_config.py: 233 passed;pre-commit run --files: clean. CI atd3d4b5df1failed only main'stest_each_cleanup_has_its_own_budgettiming test.Validation at
d3d4b5df1(main merged on 2026-11-05; the flat aggregate test moved totests/unit_tests/metrics/with main's test layout):environment_servers/single_agent_turn/tests/test_app.py: 159 passed.environment_servers/single_agent_turn_legacy/tests/test_app.py: 43 passed.tests/unit_tests/metrics/: 128 passed, 3 skipped, 3 failed. The 3 failures needwandb, which the local environment lacks; they fail the same way onmain.tests/unit_tests/test_public_api.pyandtest_public_api_facades.py: 935 passed.tests/unit_tests/: the remaining failures (sandbox, orchestration resume scripts and similar) all come from 49 files that fail the same way on an untouchedmaincheckout in this environment. None is in metrics, rollouts or the environment servers.pre-commit run --files <changed files>passed.Scripted-model smoke at the current head (no real model).
example_single_tool_call+ Simple Agent +single_agent_turn_legacy, with a local stub of the Responses API (oneget_weathercall, then a final message, fixed usage), observability on, 5 tasks x 2 repeats, throughgym env startandgym eval run --no-serve:perf_summarymean/reward1.0skip_verification=trueverification_skipped)key_metricsis{})On
main, the skipped arm returns empty aggregate metrics. Real-model smoke at the current head is still pending.Earlier validation at
377d74a37521a7140ba414dc0d2f15ddc864d013: 808 tests passed, 24 comparisons against the pre-change reducer passed, and four real NIM rollouts passed through the production Collector and HTTP servers. Both verified runs scored 1.0; verification-off runs published no quality score. Every rollout executed one weather tool call over two model turns, with full token capture coverage. Replay was deterministic and Resources sessions were released.Exact checks and smoke scope at 377d74a
Python 3.13.14; isolated checkout imports verified. With
PYTHONPATHset to the checkout and dependency site-packages, bypassing the shared environment's editable install:Pre-commit passed; the guardwords hook reported its private catalog unavailable. Commit includes DCO sign-off. Independent source review found no material issue. The 24 baseline comparisons cover one/two repeats, unmasked/mixed/fully masked batches, and absent/empty/partial/full observations.
Smoke:
example_single_tool_call+simple_agent+single_agent_turn+inference_provider, usingnvidia/nemotron-3.5-lightning-30b-a3bvia NVIDIA NIM. Two repeats per verification mode; real model/tool/verifier calls, persisted observations, Collector capture joins, and HTTP aggregation. All smoke servers stopped. Initial setup lacked a required cleanup timeout; after correction, the first model choice returned account-level 404s with no generations. The completed Lightning run supplies the evidence above. This is a focused smoke, not benchmark re-baselining or full repository CI. Full CI still requires maintainer authorization; the PR remains draft.🤖 Generated with Claude Code