Skip to content

fix(nooa): retain task services through grading and preserve terminal failures - #4291

Closed
drazvan wants to merge 133 commits into
NVIDIA-NeMo:codex/nooa-eval-reproducibilityfrom
drazvan:rdinu/nooa-eval-lifecycle-fixes
Closed

drazvan wants to merge 133 commits into
NVIDIA-NeMo:codex/nooa-eval-reproducibilityfrom
drazvan:rdinu/nooa-eval-lifecycle-fixes

Conversation

@drazvan

@drazvan drazvan commented Oct 9, 2026

Copy link
Copy Markdown

What does this PR do?

Stacked on #4088 (codex/nooa-eval-reproducibility), which remains part of the pending NOOA integration stack. Ports the fixes used during local Terminal-Bench evaluation; no separate issue is needed for this follow-up.

  • Separate agent finish from close so successful task services survive native grading, then receive bounded cleanup. BenchAgent TB/SWE profiles opt in; failures and cancellation still clean up.
  • Apply NOOA's invocation-scoped preservation to fresh shells and delegated async work.
  • Clear recovered main-model errors, isolate optional summary failures, and retain the actual terminal exception. Required-resource and unrecovered model failures remain fatal.
  • For the NVIDIA inference gateway only, remove equal duplicate reasoning aliases and the unsupported cache hint. Other backends and unequal reasoning values are unchanged.
  • Update the immutable NOOA dependency pins to 19caab169b018476ac433d040f6ae3f06aeff101, included in the now-merged Fix benchmark task rendering, CodeAct loops, shell lifecycle, and summarization labs-OO-Agents#426.

Validation

  • pre-commit run --all-files and git diff --check: passed.
  • Focused lifecycle/runner/adapter tests plus the VLLM model-adapter suite: 247 passed; 1 existing failure (TestEndpointFile::test_unpublished_endpoint_grace_lifecycle). The same failure reproduces on the unchanged base (159 passed, 1 failed); it passes individually. Imported source paths were verified against this worktree.
  • Real-process adapter smoke: a fresh shell's HTTP server returns 200 after agent close, and external teardown succeeds.

Tests exercised:

tests/unit_tests/test_process_supervisor.py
responses_api_agents/nooa_agent/tests/test_{sandbox_runner,finish,bench_agent_adapter,runner,gym_llm}.py
environment_servers/single_agent_turn/tests/test_service_lifecycle.py
responses_api_models/vllm_model/tests/test_app.py

Run with pytest -p pytest_asyncio.plugin --asyncio-mode=auto --import-mode=importlib, the pinned NOOA source on PYTHONPATH, and NEMO_GYM_EXTRA_ROOTS pointing to this checkout. Full repository tests were not run.

Rollouts

Prior live native kv-store-grpc canary rdinu-nooa-lifecycle-20261008-195032 validated the lifecycle patch: reward 1.0, all seven native tests passed, diagnostic RPC succeeded during grading, and cleanup removed all six socket-owning processes. This is historical evidence, not a fresh rollout from this assembled branch. Draft pending a fresh native model smoke. No new benchmark/model rollout or active evaluation modification was performed for this PR.

Compatibility and benchmark impact

The default finish endpoint delegates to close for other adapters. Retention is opt-in through finish_agent_before_verification; the external harness owns final service cleanup. Custom NOOA profiles need the updated shell-scope and summary-marker APIs. The dependency update also brings full task rendering, the BenchAgent 7-in-15 loop guard, todo removal, and append-only summarization. Native tests and grading are unchanged; no suite score gain is claimed.

Checklist

  • Contributing guidelines reviewed; focused follow-up
  • Regression tests and documentation added/updated
  • Pre-commit passed; new files have NVIDIA SPDX headers
  • DCO sign-off included
  • Fresh native model smoke against the assembled branch

ananthsub and others added 30 commits September 23, 2026 13:51
Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Environment servers now answer /aggregate_metrics, so rollout collection has one
place to ask rather than reaching past them to an agent.

The base server registers the route and declares the method abstract, so every
protocol states where its metrics come from. single_agent forwards to the
resources server that verified; legacy_agent forwards to the agent it fronts.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Collection posted /run and /aggregate_metrics straight to the agent. Both now go
to the environment server declared for that agent, so nothing reaches an agent
without passing through one.

Resolving the server from the agent only describes an episode that has exactly
one. Routing should name the server directly once tasksets can.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
The base declares four limits every environment server must state. A relay
enforces none of them, so configs had to repeat values that did nothing.

They now carry defaults, and setting one warns.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Declares a legacy-agent environment server beside every bound agent instance.
Idempotent, with a --check mode.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
…o entrypoint

Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Benchmarks that landed after the last sweep declare an agent with no environment
server, which rollout collection cannot reach.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
…ts per row (NVIDIA-NeMo#3576)

## What does this PR do?

Lets one rollout-collection batch mix native (materialized) tasksets and
compatibility-routed flat rows, with no new agent × resources pairing,
and keeps the chosen environment server's identity on every row through
shards, retries and results.

- A materialized task (`task_id.taskset` plus `task_input`) now routes
by `environment_server_routes` in **every** `environment_routing_mode`;
it is the native episode request and no agent-server `/run` accepts it.
- A flat row keeps following the mode: `agent` (default) resolves the
row's own environment server at dispatch, as today; `legacy` sends every
flat row to `environment_server_name`; `taskset` stays native-only and
rejects flat rows, so a native run cannot silently pick up legacy input.
- A materialized row whose taskset has no entry in
`environment_server_routes` fails at preprocessing with the missing
route named. (NVIDIA-NeMo#3491 no longer has a `tasksets` config block, so routes
are the only declaration.)
- Two knobs that cannot apply to a materialized row now fail with the
fix named instead of a `KeyError`: `num_repeats_add_seed` (the seed
lives in the top-level prompt, which a materialized row keeps under
`task_input`).
- No config or YAML changes: routes point at existing environment-server
deployments, and flat rows reach the `legacy_agent` servers that NVIDIA-NeMo#3490
generates in front of each existing pairing.

The `_ng_environment_server` stamp, written once at preprocessing,
already reaches the materialized input file, resume retries
(`_load_from_cache` re-reads the stamped rows) and result rows; this PR
does not change that path.

## Interaction flow

```mermaid
sequenceDiagram
    participant C as Rollout collector
    participant N as Native environment server, one per taskset route
    participant L as legacy_agent environment server, one per pairing
    participant A as Agent server

    Note over C: preprocess stamps _ng_environment_server once per row
    Note over C: materialized row routes by task_id.taskset, flat row follows the routing mode
    C->>N: POST /run with the episode request, episode_id plus task
    C->>L: POST /run with today's flat row
    L->>A: relay /run
    N-->>C: SingleAgentEpisodeResponse
    L-->>C: legacy result
```

## Stack position

Stacks on NVIDIA-NeMo#3491 (part 12,
`ananthsub/episode-orchestration-10-rollout-routing`) and touches only
`nemo_gym/rollout_collection.py`, which NVIDIA-NeMo#3492 does not modify. It can be
squashed into NVIDIA-NeMo#3491 if preferred, since it changes the semantics of the
routing mode that PR introduces.

Follow-up (separate PR): aggregate metrics grouped by
`_ng_environment_server` instead of `agent_ref.name`, and native
`failure` replies written to the failures sidecar, so identity also
persists through `gym eval aggregate` and retries of native episodes.

## Validation

- `pytest tests/unit_tests/test_rollout_collection.py
tests/unit_tests/test_global_config.py -q` → 383 passed.
- Adversarial review (four lenses, two independent refuters per finding,
each reproduced against the code): the two surviving findings
attributable to this PR are fixed in the second commit.
- New tests in `TestEnvironmentServerRouting`: a mixed batch dispatches
the native row to its taskset's route as an episode request and the flat
row to the server fronting its agent as today's flat body; a
materialized row without a route fails before dispatch; `legacy` mode
stamps flat rows with `environment_server_name` and materialized rows by
taskset, then dispatches both through `run_examples` against a
`legacy_agent` server that binds no resources server;
`num_repeats_add_seed` on a materialized row fails before dispatch;
`taskset` mode still rejects flat rows.
- `ruff check` and `ruff format --check` pass.

## Compatibility and benchmark impact

Default behavior for flat-only batches is unchanged. Materialized rows
in `agent` mode previously had no route and could not be dispatched;
they now require `environment_server_routes`, which is what `taskset`
mode already required.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Adil Asif <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit 3178fd3)
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit 7ba7393)
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit ffb3039)
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit 0adc36b)
Replace four internal flags with SessionPhase and RunnerCleanup while preserving close retries, unknown-launch safety, cleanup receipts, and locking. Extend lifecycle assertions for completed invocations, rejected input, and cleanup-confirmed close retries.

Validation: 79 lifecycle/environment/resource tests passed, 5 skipped; 56 controller checks passed with the unused model_tools dependency import isolated. Full pre-commit and diff checks passed. No new real-model smoke: internal state representation only; Linux supervisor and full Hermes integration were not rerun.
Signed-off-by: yaoyu-33 <[email protected]>
(cherry picked from commit f1dc2d0)
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch 2 times, most recently from 278f017 to de966de Compare October 15, 2026 23:20
init-nikhil added a commit that referenced this pull request Oct 15, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
init-nikhil added a commit that referenced this pull request Oct 15, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from de966de to be7577c Compare October 15, 2026 23:39
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from be7577c to 03fba88 Compare October 16, 2026 00:04
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 03fba88 to 500d3d1 Compare October 16, 2026 00:11
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 500d3d1 to 77e606c Compare October 16, 2026 02:23
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 77e606c to 1d701f4 Compare October 16, 2026 03:45
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch 2 times, most recently from 75456ae to 32ae695 Compare October 16, 2026 19:24
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 32ae695 to b90166b Compare October 16, 2026 20:43
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
init-nikhil added a commit that referenced this pull request Oct 16, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from b90166b to 129dadc Compare October 16, 2026 21:59
init-nikhil added a commit that referenced this pull request Oct 19, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 129dadc to 6572042 Compare October 19, 2026 21:15
init-nikhil added a commit that referenced this pull request Oct 19, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 6572042 to 49a8ff0 Compare October 19, 2026 21:20
init-nikhil added a commit that referenced this pull request Oct 20, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit 666d2ed)
Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from 49a8ff0 to f8fbeec Compare October 20, 2026 02:10
init-nikhil added a commit that referenced this pull request Oct 20, 2026
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR #4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit 666d2ed)
Signed-off-by: Nikhil Deshmudre <[email protected]>
@init-nikhil
init-nikhil force-pushed the codex/nooa-eval-reproducibility branch from f8fbeec to 10a2a19 Compare October 20, 2026 04:46
@drazvan

drazvan commented Oct 22, 2026

Copy link
Copy Markdown
Author

Closing this in favor of the NOOA stack, which now contains these changes. #4291 was based on an older version of codex/nooa-eval-reproducibility that has since been force-pushed several times, so it no longer rebases cleanly.

Where each part went:

Not carried over: the vLLM workaround for the NVIDIA inference gateway (duplicate reasoning fields and the prompt cache hint). It isn't specific to NOOA. If that gateway still rejects these requests, it will go to main as its own PR.

@giuliolovisotto, thanks for the review. #4357 covers the termination-labelling points: policy-budget and invalid-output stops are labelled incomplete, and real failures are kept.

This branch was previously deployed

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

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working complexity:high Cross-component or shared-contract change with a large review surface needs-review PR is ready for code review and waiting on a reviewer sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants