Skip to content

fix(responses): validate token metadata as a bundle - #2488

Merged
ananthsub merged 1 commit into
mainfrom
ananthsub/fix-responses-token-metadata
Aug 11, 2026
Merged

ananthsub merged 1 commit into
mainfrom
ananthsub/fix-responses-token-metadata

Conversation

@ananthsub

@ananthsub ananthsub commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Responses training metadata consists of prompt_token_ids, generation_token_ids, and generation_log_probs. Partial payloads can currently match a plain union member. Empty prompt_token_ids are also mistaken for missing metadata.

The schema now validates these fields as one bundle. Empty arrays remain valid, while partial or malformed bundles fail validation. ResponsesConverterState.flush_assistant() clears the bundle after every assistant turn so metadata cannot leak into the next turn. routed_experts remains optional.

flowchart LR
    ITEM["Assistant item"] --> CHECK{"Any token field present?"}
    CHECK -->|"No"| PLAIN["Plain assistant message"]
    CHECK -->|"Yes"| COMPLETE{"Required bundle complete?"}
    COMPLETE -->|"No"| ERROR["Reject payload"]
    COMPLETE -->|"Yes"| TRAIN["Training assistant message"]
    PLAIN --> FLUSH["Flush assistant turn"]
    TRAIN --> FLUSH
    FLUSH --> RESET["Clear token metadata"]
Loading

@copy-pr-bot

copy-pr-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

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.

@ananthsub
ananthsub force-pushed the ananthsub/fix-responses-token-metadata branch from d0529c6 to 2007c90 Compare August 11, 2026 22:15
@ananthsub ananthsub changed the title fix(responses): keep token metadata atomic fix(responses): validate token metadata as a bundle Aug 11, 2026
@ananthsub
ananthsub marked this pull request as ready for review August 11, 2026 22:55
Validate token IDs and log probabilities as one payload.
Preserve empty arrays and clear metadata after each assistant turn.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub
ananthsub force-pushed the ananthsub/fix-responses-token-metadata branch from 2007c90 to 2298268 Compare August 11, 2026 23:01
@copy-pr-bot

copy-pr-bot Bot commented Aug 11, 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.

@ananthsub
ananthsub enabled auto-merge (squash) August 11, 2026 23:01
@ananthsub
ananthsub merged commit bb13047 into main Aug 11, 2026
15 checks passed
@ananthsub
ananthsub deleted the ananthsub/fix-responses-token-metadata branch August 11, 2026 23:04
Comment thread nemo_gym/openai_utils.py Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants