Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This was referenced Nov 3, 2026
ananthsub
force-pushed
the
ananthsub/token-capture-rename
branch
from
November 3, 2026 21:52
ac49fb6 to
91a62dc
Compare
ananthsub
marked this pull request as ready for review
November 3, 2026 21:58
Contributor
ananthsub
force-pushed
the
ananthsub/token-capture-rename
branch
from
November 4, 2026 00:58
91a62dc to
30182d5
Compare
ananthsub
force-pushed
the
ananthsub/token-capture-rename
branch
from
November 4, 2026 20:22
30182d5 to
847367b
Compare
ananthsub
force-pushed
the
ananthsub/token-capture-rename
branch
from
November 4, 2026 20:44
847367b to
40b850d
Compare
ananthsub
force-pushed
the
ananthsub/renamed-config-keys
branch
from
November 4, 2026 22:42
7f1cdc1 to
2b971d4
Compare
ananthsub
force-pushed
the
ananthsub/token-capture-rename
branch
from
November 4, 2026 23:06
40b850d to
d4286e3
Compare
ananthsub
force-pushed
the
ananthsub/renamed-config-keys
branch
from
November 5, 2026 06:15
2b971d4 to
8db168e
Compare
The token capture package and its classes were renamed, but the config keys, a field on each server config, and several messages still said token_id_capture. Rename the rest so one name covers the feature. - The run-wide block token_id_capture is now token_capture, the agent flag token_id_capture is now token_capture, and the model server's token_id_capture_non_generating_requests is now token_capture_non_generating_requests. - Old keys keep working until nemo_gym 0.10.0. The config parser moves each old key to its new name wherever it came from (a config file, the command line, or a framework's initial config), and the Pydantic configs accept the old names when built directly. Each moved key logs a warning and emits a DeprecationWarning that names the new key. Setting an old key and its new key to different values is an error. - The old field names stay readable as deprecated attributes on TokenCaptureConfig and on the agent and model server configs. - The resume identity of a run still spells these keys the old way, so a run saved before the rename resumes after it. - Saved and exported configs keep the token capture block's settings visible under either key; secret masking no longer hides the block because its new name contains "token". - The private agent helper _token_id_capture_enabled is now _token_capture_enabled. - Configs, docs, and tests use the new names. Signed-off-by: Ananth Subramaniam <[email protected]>
ananthsub
force-pushed
the
ananthsub/token-capture-rename
branch
from
November 5, 2026 06:17
d4286e3 to
dfa989e
Compare
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.
Stacked on #5628, which adds the renamed-key mechanism; its base is
ananthsub/renamed-config-keys, and it lands after #5628. Part of thenemo_gym/reorganization tracked in #5166.What changed and why
#5225 renamed the token capture package and its classes, but kept the config keys, a field on each server config, and many messages spelled
token_id_capture. That left one feature with two names. This PR renames the rest to "token capture", and keeps every old name working until nemo_gym 0.10.0.token_id_capturetoken_captureTokenCaptureConfigfield, andTOKEN_CAPTURE_BLOCK's valuetoken_id_capturetoken_captureBaseResponsesAPIAgentConfigtoken_id_capture_non_generating_requeststoken_capture_non_generating_requests_token_id_capture_enabled_token_capture_enabledConfigs under
benchmarks/andresponses_api_agents/, the current docs, and the tests use the new names. The frozenfern/versions/v*pages are unchanged. The external agent harnesses guide gains a note about the old names.Compatibility
Config keys
#5628 adds
nemo_gym/config/renamed_keys.py, which moves each old key to its new name. This PR registers the token capture keys there: the run-wide block inRENAMED_TOP_LEVEL_KEYS, and the agent flag and model declarations inRENAMED_SERVER_INSTANCE_KEYS. Two places use them:GlobalConfigDictParser.parse(through feat(config): accept renamed config keys and arguments under their old names #5628's rename step) renames the run-wide block, each agent instance's flag, and each model instance's declarations. This covers YAML configs, Hydra command line overrides, held agent overrides, and a framework'sinitial_global_config_dict(NeMo RL setstoken_id_capturethere). Server processes get the parsed config, so code that reads the config dict directly sees only the new keys.TokenCaptureConfig,BaseResponsesAPIAgentConfig, andBaseResponsesAPIModelConfigaccept the old keys when they are built directly. This matters most forTokenCaptureConfig, which ignores extra keys: without this, a block under its old name would silently turn capture off.token_capture_enabled_for_agentalso reads an agent flag under its old key, for frameworks that pass it an unparsed dict.Each moved key emits a
DeprecationWarningand logs a warning. Both name the new key and its full config path, for exampleConfig key 'policy_model.responses_api_models.vllm_model.token_id_capture_non_generating_requests' was renamed 'policy_model.responses_api_models.vllm_model.token_capture_non_generating_requests'. The log line is there because Python hidesDeprecationWarningoutside__main__, so a config author would not otherwise see it. The parser renames each config source before merging them, so when an old key and its new key come from different sources (say a config file and the command line), the usual precedence decides. If one source sets both to the same value, the config loads and still warns. If one source sets them to different values, loading fails withConflictingRenamedKeyError, which names both paths and says which one to remove.Saved and exported configs
Secret masking in saved and exported configs (
hide_secrets_in_container) treats any key containingtokenas a secret, but keeps the root token capture block's settings visible. It recognized onlytoken_id_capture, so after the rename it would have masked the wholetoken_captureblock, includingenabledandsink. It now recognizes the block under either key. Its secret-shaped children are still masked.Python names
The old field names stay readable as deprecated, read-only attributes on the three config classes, and each read warns.
TokenIdCaptureConfig,TokenIdCaptureSettings,token_id_capture_enabled_for_agent,token_id_capture_dirs_from_config,TOKEN_ID_CAPTURE_BLOCK, and thenemo_gym.token_id_capturemodule paths already resolve throughnemo_gym/_moved_paths.pyfrom #5225. This PR does not touch_moved_paths.pyorimport_surface.json, so it cannot conflict with the other renames that edit them.TOKEN_CAPTURE_BLOCK(and its old aliasTOKEN_ID_CAPTURE_BLOCK) now holds"token_capture". Code that writes a config with this constant writes the new key. Code that hard-codes the string"token_id_capture"still works and gets the warning.Data keys
No rollout output key changes. Rollout rows already use
_ng_token_capture.nemo_gym_token_id_captureswas only an example capture directory in docs, and it is nownemo_gym_token_captures. Neither NeMo RL (checked atacbf7ef) nor the rest of the repo reads a token capture output key under the old name.One stored format does depend on these keys: the config digest in a run's resume manifest. The digest covers server settings and the capture block, so renaming the keys would have changed it and refused
--resumefor every run saved before the upgrade. The resume identity still spells these keys the old way, so a config with the new keys gives the same digest that the code before this change gave for the old keys.For NeMo RL
Nothing breaks. When NeMo RL moves to the new key,
rollout_checkpoint.pyshould also excludeenv.**.token_capturefrom its identity, alongsideenv.**.token_id_capture.Validation
pre-commit runon every touched file passes.tests/unit_tests/test_moved_paths.py,tests/unit_tests/config/test_global_config.py, and the import-linter coverage test pass:pytest -n 16 <touched test files> tests/unit_tests/test_moved_paths.py tests/unit_tests/config/test_global_config.py tests/unit_tests/test_import_linter_coverage.py.tests/unit_tests/test_public_api_facades.pypasses after rebasing ontomain.lint-importskeeps its contract.vllm_model,claude_code_agent,anyterminal_agent,opencode_agent, andopencode_sandboxed_agentpass after the rebase. The other edited server tests are left to CI.New tests check that:
token_capture_enabled_for_agenthonors an old agent flag in an unparsed dict;Each compatibility path was checked by removing its shim and rerunning its tests. All removals made their tests fail: each of the three key registrations, the three validators, the three deprecated attributes, the raw agent flag read, and the two parts of the resume identity spelling. The pinned digest came from running the code before this change on the old-key config.
Rollout evidence
One real smoke rollout per spelling:
example_single_tool_callwithsimple_agentagainst Qwen2.5-0.5B-Instruct, served by vLLM 0.29.0 (Gym's pin). Five tasks, temperature 0, concurrency 1,return_token_id_information: true. Each config sets the run-wide block (enabled,dir,delta_records), the agent opt-in (notall_agents, so capture depended on the renamed agent flag), and a model server declaration. One config uses the old keys and the other the new ones.token_capturekeystoken_capturekeys2aa1522b…2aa1522b…On every task, the rebuilt responses'
prompt_token_ids,generation_token_ids, andgeneration_log_probsare identical between the two runs: one task with two model calls and four with one, 172 to 232 prompt tokens per call. An earlier pair at the default concurrency matched on every token ID, but log probabilities differed on two tasks, which fits vLLM batching noise. The serial runs above remove that variable.