Repository navigation
Conversation
…l URL Signed-off-by: jiwasawa <jiwasawa@nvidia.com>
jiwasawa
marked this pull request as ready for review
September 15, 2026 07:09
yaoyu-33
approved these changes
Sep 15, 2026
Contributor
|
/ok to test 4fb25ce |
yaoyu-33
enabled auto-merge
September 15, 2026 19:09
pthombre
added a commit
that referenced
this pull request
Sep 16, 2026
Under training token capture the model server only returns token metadata for calls made under /ng-rollout/<id>/training-token-capture/...; the SciCode agent posted to the bare /v1/responses (self-call and model call), so every sub-step failed NeMoGymChatCompletion validation with 'Token metadata must include all required fields' (HTTP 500 on /run). Mirror the simple_agent / anyterminal (#3397) pattern with url_path_for_run and url_path_for_request. Signed-off-by: Pranav Thombre <pthombre@nvidia.com>
linj-glitch
added a commit
to linj-glitch/Gym
that referenced
this pull request
Oct 8, 2026
…the inner harness in capture mode `_setup_params` built the in-sandbox model URL with `apply_rollout_prefix(url, rollout_id)` and no `token_capture=` keyword, so the harness only ever got the eval prefix `/ng-rollout/<id>`. With `token_id_capture.enabled: true` the run looks healthy, but every rollout reports `n_calls == 0` and is masked. NVIDIA-NeMo#3397 fixed the same bug in anyterminal_agent. Pass `self._token_id_capture_enabled()`. Two more gaps kept captured rollouts from being attributed: - The in-sandbox runner built the inner agent's global config without a `token_id_capture` block, so the inner agent ran in eval mode. When the model URL carries the training-token-capture segment, the runner now enables capture for the inner agent. - The outer response replaced the inner agent's id with `anyswe-<instance_id>`. Under capture, keep the inner id (the served id the inner agent reports) so terminal attribution can match it. Eval mode keeps the synthetic id. Signed-off-by: Lin Jia <linj@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
linj-glitch
added a commit
to linj-glitch/Gym
that referenced
this pull request
Oct 8, 2026
…the inner harness in capture mode `_setup_params` built the in-sandbox model URL with `apply_rollout_prefix(url, rollout_id)` and no `token_capture=` keyword, so the harness only ever got the eval prefix `/ng-rollout/<id>`. With `token_id_capture.enabled: true` the run looks healthy, but every rollout reports `n_calls == 0` and is masked. NVIDIA-NeMo#3397 fixed the same bug in anyterminal_agent. Pass `self._token_id_capture_enabled()`. Two more gaps kept captured rollouts from being attributed: - The in-sandbox runner built the inner agent's global config without a `token_id_capture` block, so the inner agent ran in eval mode. When the model URL carries the training-token-capture segment, the runner now enables capture for the inner agent. - The outer response replaced the inner agent's id with `anyswe-<instance_id>`. Under capture, keep the inner id (the served id the inner agent reports) so terminal attribution can match it. Eval mode keeps the synthetic id. Signed-off-by: Lin Jia <linj@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What does this PR do?
Passes
token_capture=self._token_id_capture_enabled()whereanyterminal_agentbuilds the model URL for the task container, so training-token capture records the rollout. Same class of silent failure asverifiers_agentin #3321.Training-token capture is keyed by the
/ng-rollout/<id>/training-token-captureURL prefix that an agent hands its model client, seerollout_path_prefixinnemo_gym/server_utils.pyand its callers innemo_gym/base_responses_api_agent.py.anyterminal_agent/app.py:_setup_paramsbuilds the model URL for the task container without it:apply_rollout_prefixinnemo_gym/server_utils.pytakes a keyword-onlytoken_capturethat defaults toFalse, so the container gets the evaluation prefix/ng-rollout/<id>and the model server records no training tokens for the rollout.With
token_id_capture.enabled: trueandtoken_id_capture: trueon the agent, the configuration validates and the run completes normally. Every rollout comes back with_ng_token_capture.n_calls == 0andmask_sample: true. No error, no warning. A run that captured nothing looks like a healthy one until the trainer masks every sample.The base class passes the keyword in
url_path_for_run,base_url_for_run, andresolve_model_base_url, andclaude_code_agentandswe_agentspass it since #2124. The anyterminal wrapper builds its URL on its own path, and that path did not get the keyword.With capture off,
_token_id_capture_enabled()isFalseand the URL is unchanged, so evaluation runs do not move.Tests
Two tests in
TestSetupParams. They call_setup_paramswith a real global config dict instead of patching the capture protocol.test_model_server_url_carries_the_training_capture_prefixhttp://policy:8000/ng-rollout/7-2/training-token-capturetest_model_server_url_keeps_the_plain_rollout_prefix_without_capturehttp://policy:8000/ng-rollout/7-2The first fails on
mainwith'http://policy:8000/ng-rollout/7-2' != '.../training-token-capture'. The second is a negative control.81 passed.
pre-commit run --all-filesclean.On real rollouts
gym eval runon three Terminal-Bench 2 tasks, Codex CLI 0.144.4 running inside the task container throughanyterminal_agent, Qwen3-8B served by vLLM on one GPU,token_id_capture.enabled: truewith the agent opted in. Both arms use the same overlay, the same task list, and the same vLLM process. The only difference is this keyword. Gym ismain@5b34fcdacin both arms.main)/training-token-captureprefix, perparams.json_ng_token_capture.n_calls > 0mask_sample: truefunction_callitems Codex producedThe last row shows Codex ran normally in both arms. The difference is only in what the model server recorded. On the unfixed arm
gym eval runalso printsRollout health: 3 checked, 0 healthy, 0 unhealthy, 3 unobserved.Both arms also carry local workarounds for #3312 and #3313, which Codex needs to complete a turn against a chat-backed model server. They touch the Responses converter and the streaming event, not the URL path.
Checklist
pre-commit run --all-files) (so CI lint/format/copyright pass).git commit -s) (so the DCO check passes).