Skip to content

fix(capture): accept capture key names from before the rename - #5317

Merged
ananthsub merged 2 commits into
mainfrom
ananthsub/capture-rename-compat
Oct 29, 2026
Merged

ananthsub merged 2 commits into
mainfrom
ananthsub/capture-rename-compat

Conversation

@ananthsub

@ananthsub ananthsub commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

#4128 renamed rollout_id to capture_key on the token capture wire models, and renamed the old CallRecord.capture_key to source_capture_key. These models forbid unknown fields, so a framework still on the old names fails right away. NeMo RL main has not moved to the new names yet; that move is NVIDIA-NeMo/RL#4124, which is still open. Training runs that pick up current Gym with NeMo RL main fail every rollout with AttributeError: 'StagedCallRecord' object has no attribute 'rollout_id'.

This change makes the rename backward compatible on the Gym side:

  • CaptureAdmission, StagedCallBaseSnapshot (and so StagedCallRecord and StagedCallSnapshot), CommitCoords, CaptureLedgerCommit, RolloutManifest and RolloutReceipt accept rollout_id as an input name for capture_key, and expose a read-only rollout_id property.
  • CallRecord accepts the old capture_key as an input name for source_capture_key, and exposes a read-only capture_key property.
  • ActiveCall exposes rollout_id again.
  • The first time a process passes or reads an old name, it gets a FutureWarning that names the field to use instead. Later uses stay quiet, so a framework on the old names sees one warning per renamed field rather than one per rollout.

Serialization still writes only the new names, so the wire format and digests do not change. A payload that carries both the old and the new name is rejected rather than resolved silently. The two renames do not collide: the old capture_key existed only on CallRecord, which has no field under that name now.

NeMo RL can move to the new names on its own schedule. The aliases and warnings can be removed once it has.

Issue

No issue filed. This fixes a downstream break reported against #4128.

Validation

  • The rename test now checks the opposite of what it used to check: an old-name payload validates to a record equal to the new-name one, reads back under the old name, and serializes with only the new names; a payload with both names is rejected. It also builds StagedCallBaseSnapshot with rollout_id= as a keyword, the way the NeMo RL token sink does. The worker test checks ActiveCall.rollout_id and its warning.
  • A warning test checks that the new names never warn, that the first use of each old name, whether passed in or read, warns with the replacement name, and that later uses do not warn again.
  • The capture test selection below also ran with these warnings promoted to errors and passed, so Gym itself never uses the old names.
  • The compatibility tests fail on main without this change, and the warning tests fail without the second commit.
  • pytest -n 16 tests/unit_tests/ -k "capture or checkpoint or rollout_collection or lineage or completion" passes. Three exporter test files fail to import in my venv because the telemetry package is not installed; this change does not touch them.
  • pre-commit run --files on the changed files passes.

Rollout evidence

N/A. The change only widens model validation, adds read aliases and warnings, and leaves the serialized output unchanged. Running NeMo RL main against this branch was not possible locally because its test environment needs Megatron.

#4128 renamed rollout_id to capture_key on the capture wire models and
the old CallRecord.capture_key to source_capture_key. Frameworks still
on the old names, including NeMo RL main, now fail every rollout with
AttributeError or a rejected extra field.

Accept the old names as validation aliases and expose them as read-only
properties. Serialization still writes only the new names, and a payload
that carries both names is rejected.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub ananthsub added bug Something isn't working area:training Training framework integrations and training-data interfaces labels Oct 29, 2026
@ananthsub
ananthsub requested a review from pthombre October 29, 2026 15:32
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 29, 2026 15:35
Emit a FutureWarning the first time a process passes or reads
rollout_id or CallRecord.capture_key, naming the field that replaced
it, so frameworks still on the old names learn to migrate without
flooding their logs.

Signed-off-by: Ananth Subramaniam <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Oct 29, 2026
@ananthsub
ananthsub enabled auto-merge October 29, 2026 16:46
@ananthsub
ananthsub disabled auto-merge October 29, 2026 16:46
@ananthsub
ananthsub merged commit 5911d62 into main Oct 29, 2026
52 of 58 checks passed
@ananthsub
ananthsub deleted the ananthsub/capture-rename-compat branch October 29, 2026 16:46
dylanelu pushed a commit that referenced this pull request Oct 29, 2026
* fix(capture): accept capture key names from before the rename

the old CallRecord.capture_key to source_capture_key. Frameworks still
on the old names, including NeMo RL main, now fail every rollout with
AttributeError or a rejected extra field.

Accept the old names as validation aliases and expose them as read-only
properties. Serialization still writes only the new names, and a payload
that carries both names is rejected.

Signed-off-by: Ananth Subramaniam <[email protected]>

* fix(capture): warn once when pre-rename capture names are used

Emit a FutureWarning the first time a process passes or reads
rollout_id or CallRecord.capture_key, naming the field that replaced
it, so frameworks still on the old names learn to migrate without
flooding their logs.

Signed-off-by: Ananth Subramaniam <[email protected]>

---------

Signed-off-by: Ananth Subramaniam <[email protected]>
(cherry picked from commit 5911d62)

This branch was previously deployed

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

Labels

area:training Training framework integrations and training-data interfaces bug Something isn't working 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.

3 participants