Skip to content

feat(env): honor skip_verification in nemo_user_sim - #5823

Open
yaoyu-33 wants to merge 4 commits into
mainfrom
yuya/nemo-user-sim-skip-verification
Open

yaoyu-33 wants to merge 4 commits into
mainfrom
yuya/nemo-user-sim-skip-verification

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What and why

#4949 made single_agent_turn honor skip_verification. nemo_user_sim still always called /verify, so a run
with the global skip_verification flag still scored every UserSim conversation with the probe scorer. This
gives nemo_user_sim the same fields and behavior as single_agent_turn, and says in each Environment Server's
README where the setting applies.

  • nemo_user_sim

    • Its config gets skip_verification and skip_verification_reward. When it leaves them unset, it falls back
      to the assistant agent's values. Gym fills those from the global flags, which reach only agents.
    • With skipping on, the episode does not call /verify. It returns the fixed reward with
      verification_skipped: true, verification: null and empty reward_components.
    • It still closes both agent sessions and the Resources session.
    • A simulation that UserSim reports as failed does not earn the fixed reward. It scores 0.0 with the
      failure_kind and failure_reason that /verify gives it, masked unless the assistant model caused the
      failure. Both paths use one rule, usersim_failure(), which moves from the Resources Server's app.py into
      resources_servers/nemo_user_sim/episode_contracts.py.
    • /aggregate_metrics returns empty metrics with the same warning as single_agent_turn.
    • The agent's raw value is parsed as the agent's config parses it, so a string "false" stays false.
  • UserSimEpisodeResult

    • verification may be None, exactly when verification_skipped is true; a validator enforces that.
    • verification_skipped is left out of a verified result, so verified rows are unchanged.
  • READMEs

    • nemo_user_sim describes the setting.
    • harbor and swe_together say it does not apply. Both grade inside the Environment Server as part of the
      episode (a Harbor multi-step task even decides from each step's verifier whether the next step runs), and
      neither has a setting that skips its verifier.
    • legacy_agent says the agent's own /run keeps honoring it.
    • single_agent_turn_legacy says it inherits the setting from single_agent_turn.
  • One skip rule for both Environment Servers. skipped_verification_reward() in nemo_gym.config holds
    the rule: the server's own setting wins, otherwise the agent's, parsed as the agent parses it.
    single_agent_turn and nemo_user_sim both call it, and single_agent_turn's behavior is unchanged. The
    change to single_agent_turn/app.py touches only that method and its imports. It merges cleanly with fix(eval): aggregate execution metrics in the environment server #5455 and
    feat(agents): deliver per-task agent context to agent sessions #5703. The aggregate-metrics warning keeps its text in each server, because fix(eval): aggregate execution metrics in the environment server #5455 rewrites that block.

  • Run health. run.provenance.servers in the run-health summary now reports skip_verification for each
    Environment Server, as it already did for each agent. An Environment Server's own setting overrides its agent's,
    so before this change a run that skipped verification only on the Environment Server looked like a verified run.
    The response/trial health warning lists Environment Servers with that value.

Left for later

The agent-level skip_verification and skip_verification_reward fields on BaseResponsesAPIAgentConfig stay.
The legacy /run path reads them, and both single_agent_turn and now nemo_user_sim fall back to them.
Removing them waits until the legacy_agent relay is retired. At that point the global flag should be set on
Environment Servers instead.

Compatibility

  • Without skip_verification. Scores, status codes and defaults are unchanged.
  • With skip_verification on nemo_user_sim. Episodes score the fixed reward, except a simulation that
    UserSim reports as failed. That episode scores 0.0 with the failure fields /verify would give it, and is
    masked unless the assistant model caused the failure. single_agent_turn is unchanged.
  • Run-health summary. Each environment_servers entry under run.provenance.servers gains a
    skip_verification key: true or false when the config writes a boolean, otherwise null. Summaries written
    before this change lack the key, and readers treat that as unknown.
  • Response/trial health warning. The warning text changes from environment servers [names] to
    environment servers (skip_verification) {name: value}.

Issue

Follow-up of #4949, tracked internally. No public issue.

Validation

  • environment_servers/nemo_user_sim/tests in a venv built from that server's pyproject.toml (uv 0.13.7),
    with this worktree on the path: 41 passed.
  • New tests:
    • Skipping. For the server's own setting, the assistant agent's setting (the global flag) and the default
      reward: no /verify; both agent sessions and the Resources session closed, the last with its seeded cookie;
      the fixed reward with verification_skipped: true; the collected record carries both.
    • Not skipping. The server's own false overriding the agent's true, an agent string "false", and the
      unset case all still verify, and the result has no verification_skipped key.
    • Aggregate metrics. Skipping returns empty metrics without calling the Resources Server.
    • Result shape. A result carries a verification exactly when it was not skipped.
  • The five skipping tests fail against origin/main's nemo_user_sim. The three not-skipping tests pass on
    both, as regression guards.
  • Review fixes (head 0a309c6): environment_servers/nemo_user_sim/tests 49 passed and
    resources_servers/nemo_user_sim/tests 42 passed. The tests for a failed simulation under skip (user-model failure,
    checked against the real /verify, and an invalid assistant response) fail on f2deb2a and pass now.
    Further tests: a retryable assistant failure under skip, a terminal cleanup failure on both paths, the full
    verify-path call order, and the field-by-field setting fallback.
  • Second review round (shared skip helper, Environment Server skip_verification in run provenance):
    • environment_servers/nemo_user_sim/tests and resources_servers/nemo_user_sim/tests: 91 passed.

    • The nemo_user_sim README no longer says it skips exactly as single_agent_turn does.

    • environment_servers/single_agent_turn/tests, tests/unit_tests/config/test_global_config.py,
      tests/unit_tests/rollouts/test_rollout_health.py, tests/unit_tests/orchestration,
      tests/unit_tests/test_import_linter_coverage.py and tests/unit_tests/test_public_api_facades.py:
      passed, except 54 tests/unit_tests/orchestration tests that fail identically on the previous head 0a309c6 on this Mac (BSD sed, no setsid).

    • New tests: skipped_verification_reward (server setting wins, agent fallback, string values, and a value that
      is not a flag rejected), and Environment Server skip_verification in run provenance and in the trial-health
      warning.

    • Commands, from a scratch directory with this checkout on the path:

      PYTHONPATH=$WT NEMO_GYM_EXTRA_ROOTS=$WT <nemo_user_sim venv>/bin/python -m pytest --import-mode=importlib -o addopts= \
        $WT/environment_servers/nemo_user_sim/tests $WT/resources_servers/nemo_user_sim/tests
      PYTHONPATH=$WT NEMO_GYM_EXTRA_ROOTS=$WT .venv/bin/python -m pytest --import-mode=importlib -o addopts= \
        $WT/environment_servers/single_agent_turn/tests $WT/tests/unit_tests/config/test_global_config.py \
        $WT/tests/unit_tests/rollouts/test_rollout_health.py $WT/tests/unit_tests/orchestration \
        $WT/tests/unit_tests/test_import_linter_coverage.py $WT/tests/unit_tests/test_public_api_facades.py
  • pre-commit run --all-files: passed.

Rollout evidence

Scripted-model smoke (no real model).

  • Setup. gym env start --config environments/nemo_user_sim/config.yaml, then
    gym eval run --no-serve on the first committed example row (general_open_ended), with real
    nemo_user_sim Resources, Environment and agent servers. All model roles point at one scripted Chat Completions
    stub. The UserSim conversation runs for real: user, judge, assistant, judge.
  • Runs. Three: this branch and origin/main with the global ++skip_verification=true ++skip_verification_reward=0.5, and this branch without the flag.
origin/main + flag this branch + flag this branch, no flag
Resources /verify called not called called
Resources /close_session 1 1 1
Resources /aggregate_metrics called not called (empty metrics) called
reward 0.2 (measured) 0.5 (fixed) 0.2 (measured)
verification_skipped absent true absent
verification probe scorer's null probe scorer's
Failure rows 0 0 0

On main the global flag reaches the agents, but nothing reads it. With this branch the Environment Server reads
it from the assistant agent. Without the flag, the branch's result matches main's.

Real-model smoke: not run yet. This Mac has no model endpoint. To run it on a host with an
OpenAI-compatible endpoint (gym eval prepare writes the validation rows first; the embedding and support roles
default to the policy endpoint, and a failed embedding call falls back to lexical retrieval):

gym eval prepare --config environments/nemo_user_sim/config.yaml
gym eval run --environment nemo_user_sim --split validation --limit 3 \
  --output results/nemo_user_sim_verified.jsonl \
  +policy_base_url=$BASE_URL +policy_api_key=$API_KEY +policy_model_name=$POLICY_MODEL \
  +user_model_base_url=$BASE_URL +user_model_api_key=$API_KEY +user_model_name=$USER_MODEL \
  +user_model_uses_reasoning_parser=false +policy_uses_reasoning_parser=false \
  +support_model_uses_reasoning_parser=false
gym eval run --environment nemo_user_sim --split validation --limit 3 \
  --output results/nemo_user_sim_skipped.jsonl \
  +policy_base_url=$BASE_URL +policy_api_key=$API_KEY +policy_model_name=$POLICY_MODEL \
  +user_model_base_url=$BASE_URL +user_model_api_key=$API_KEY +user_model_name=$USER_MODEL \
  +user_model_uses_reasoning_parser=false +policy_uses_reasoning_parser=false \
  +support_model_uses_reasoning_parser=false \
  ++skip_verification=true ++skip_verification_reward=0.5

Expected: the second run has no Resources /verify call, reward 0.5 with verification_skipped: true on
completed simulations, 0.0 with failure_kind on failed ones, and skip_verification reported for the agents in
the run-health summary.

🤖 Generated with Claude Code

single_agent_turn skips /verify under skip_verification, but nemo_user_sim
always called it, so a run with the global flag still scored every UserSim
conversation.

- nemo_user_sim gets skip_verification and skip_verification_reward. Left
  unset, they fall back to the assistant agent's values, which Gym fills
  from the global flags. With skipping on, the episode returns the fixed
  reward with verification_skipped: true and no verification, still closes
  both agent sessions and the Resources session, and /aggregate_metrics
  returns empty metrics.
- UserSimEpisodeResult.verification is None exactly when
  verification_skipped is set; a verified result keeps its shape.
- The harbor and swe_together READMEs say skip_verification does not apply
  (both grade inside the episode and have no setting that skips it), and the
  legacy_agent README says the agent's own /run keeps honoring it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers area:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation labels Nov 8, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 8, 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.

@yaoyu-33

yaoyu-33 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f2deb2a

@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

RISK — Required real-model smoke evidence is missing

The PR reports three scripted-model runs and explicitly leaves a real-model smoke pending. Those runs provide useful plumbing evidence, but this changes environment behavior, and AGENTS.md requires representative real smoke rollouts with a model and inspection of agent and verifier behavior. This is a validation gap, not a demonstrated runtime defect.

Could you run representative real-model episodes through the UserSim environment composition, both with verification enabled and with global skip_verification=true and skip_verification_reward=0.5? Record the commands, model identifiers, selected rows, and inspected rollout/server evidence in the PR. No implementation patch is requested without a demonstrated failure.

Acceptance and preservation:

  • The skipped run completes a real conversation, makes no Resources /verify call, persists reward 0.5, verification_skipped: true, verification: null, and empty reward_components, closes both agent sessions and the Resources session, and returns empty aggregate metrics.
  • The enabled run still calls /verify, persists the measured reward and verification object without a verification_skipped key, and closes the same sessions.
  • Retain the explicit Environment Server false override and agent string "false" cases in the non-skipping regression test: both must continue verifying.

I inspected all seven changed files and the directly affected configuration, cleanup, serialization, collector, and aggregation paths. I found no confirmed implementation defect. One delegated report wasn't delivered; I independently covered its configuration and cleanup topic. This was a static review; I didn't execute tests or rollouts.

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

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 8, 2026
yaoyu-33 and others added 2 commits November 8, 2026 16:56
With skip_verification on, a simulation that UserSim reported as failed got the
fixed reward with no mask and no failure kind, so a user-model or judge outage
became an ordinary row and an invalid assistant response could earn the fixed
reward. /verify masks the first and scores the second 0.0.

- Move the outcome classification (who caused the failure, failure kind and
  reason) into resources_servers/nemo_user_sim/episode_contracts.py as
  usersim_failure(), used by both /verify and the skipped episode result.
- A skipped result for a failed simulation scores 0.0 with /verify's failure
  fields, masked unless the assistant model caused it.
- One Resources-close block for the verified and skipped paths.
- Tests: failure routing under skip (pinned against the real /verify),
  retryable assistant failure, terminal cleanup failure on both paths, full
  verify-path call order, field-by-field setting fallback.
- READMEs: nemo_user_sim describes failures under skip;
  single_agent_turn_legacy says it inherits skip_verification.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 0a309c6

…ent Servers

- Move the rule both Environment Servers use to decide whether to skip /verify into
  nemo_gym.config.skipped_verification_reward(): the server's own setting wins, otherwise its
  agent's, parsed as the agent parses it. single_agent_turn and nemo_user_sim call it; behavior
  is unchanged.
- Report each Environment Server's own skip_verification in the run-health provenance and the
  response/trial health warning, since it overrides the agent's setting.
- README: do not claim nemo_user_sim skips exactly as single_agent_turn does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test bcc5d75

@yaoyu-33 yaoyu-33 added area:config Hydra configuration, schemas, composition, and compatibility area:orchestration Job submission, deployment, services, and lifecycle management labels Nov 9, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 9, 2026 06:41

This branch was previously deployed

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

Labels

area:config Hydra configuration, schemas, composition, and compatibility area:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers area:orchestration Job submission, deployment, services, and lifecycle management 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.

2 participants