Skip to content

fix(experience): carry terminal truncation metadata via Gym receipts - #5399

Open
four1er wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
four1er:fix/receipt-terminal-truncation-4737
Open

four1er wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
four1er:fix/receipt-terminal-truncation-4737

Conversation

@four1er

@four1er four1er commented Nov 23, 2026

Copy link
Copy Markdown
  • I, the PR author, have personally reviewed every line of this PR.

What and why

The token-capture receipt path marked a row truncated only when the assembled sequence length equalled max_seq_len, so a terminal response ending with incomplete_details.reason=max_output_tokens below that limit escaped overlong_filtering and undercounted truncation metrics. This carries Gym's LinearizedRow.incomplete_reason through finalize_rollout into FinalizedRollout.terminal_incomplete_reason and treats the #4491 length-exhaustion verdicts (max_output_tokens, length, max_tokens) as truncation in _truncated_flags, alongside the existing length check. Completed, content-filtered, and legacy receipts without the verdict stay non-truncated. A zero-token context-exhausted final turn is still rejected by Gym (empty_generation) and published as a masked placeholder, never a trainable row.

Issues

Fixes #4737

Convergence / perf / functionality proof

New regression test test_finalize_group_marks_terminal_length_truncation drives RolloutReassembler.finalize_group over five rollouts (zero-token context-exhausted final turn, terminal length exhaustion below the limit, ordinary completed, content-filtered, legacy receipt) and checks the published TRUNCATED column, finalize/truncated_count, and the downstream overlong filter. Verified locally: the test fails on the base commit (truncated_count 0.0) and passes with the fix. Note: the full pytest suite could not run on this machine (no GPU; the local Ray/gRPC stack cannot start a cluster here), so CI is the end-to-end check.

Needs upstream changes

None

PR commands and CI
  • CI label, exactly one:
    • CI:Lfast: the default for most PRs. Runs a fast test subset.
    • CI:L1: dependency or container changes (pyproject.toml, uv.lock, Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.
    • CI:docs: docs-only changes. Runs doc tests only.
  • /ok to test <full-commit-sha>: start CI for that commit. Post again after each push.
  • /review: automated review comments. Add mode=strict for a stricter review, reset=true for a fresh full review.
  • /resolve-conflict: Autobot merges main into this PR and resolves the conflicts. PRs from forks must allow edits by maintainers.
  • Locally: /review-pr-team <pr-number> for a team review before you ask for human review.
  • Contributor guidelines

…-capture receipts

The token-capture receipt path marked a row truncated only when the
assembled sequence length equalled max_seq_len, so a terminal response
ending with incomplete_details.reason=max_output_tokens below that limit
escaped overlong_filtering and undercounted truncation metrics. Carry
Gym's LinearizedRow.incomplete_reason through finalize_rollout into
FinalizedRollout.terminal_incomplete_reason and treat the NVIDIA-NeMo#4491 length
exhaustion verdicts (max_output_tokens, length, max_tokens) as truncation
in _truncated_flags, alongside the existing length check. Completed,
content-filtered, and legacy receipts without the verdict stay
non-truncated.

Fixes NVIDIA-NeMo#4737

Signed-off-by: Muse <[email protected]>
@four1er

four1er commented Nov 23, 2026

Copy link
Copy Markdown
Author

/ok to test 67b4717

@copy-pr-bot

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

@github-actions github-actions Bot added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Nov 23, 2026
@four1er four1er changed the title fix(experience): carry terminal truncation metadata through Gym token-capture receipts fix(experience): carry terminal truncation metadata via Gym receipts Nov 23, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) community-request waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Carry terminal truncation metadata through Gym token-capture receipts

2 participants