fix(responses): remove reasoning_item from the boundary set, and name the training-variant error - #2453
Merged
Merged
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. |
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 10, 2026 17:19
be76a12 to
f36e4be
Compare
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
3 times, most recently
from
August 10, 2026 23:05
bd2e33f to
bee2e6a
Compare
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
4 times, most recently
from
August 11, 2026 13:39
e36bd6b to
7a6cd14
Compare
ananthsub
marked this pull request as ready for review
August 11, 2026 13:39
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 11, 2026 18:38
7a6cd14 to
e36bd6b
Compare
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 11, 2026 18:43
e36bd6b to
b62bca8
Compare
cmunley1
previously approved these changes
Aug 11, 2026
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 11, 2026 19:11
b62bca8 to
5976c75
Compare
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
4 times, most recently
from
August 11, 2026 19:42
e36bd6b to
6f88d0b
Compare
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 11, 2026 20:34
6f88d0b to
5958694
Compare
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 11, 2026 22:11
5958694 to
6bd05e3
Compare
bxyu-nvidia
previously approved these changes
Aug 11, 2026
ffrujeri
previously approved these changes
Aug 12, 2026
… the training-variant error
Two corrections to the Responses item plumbing. Neither changes behaviour at the current openai pin.
`_RESPONSE_OUTPUT_BOUNDARY_TYPES` listed `"reasoning_item"`, which is not a Responses output item
type at any openai version. I checked 2.7.2, 2.25.0, 2.31.0 and 2.44.0 by reading the `type` Literal
of every model in `openai.types.responses` (192 to 269 models depending on version) and by searching
the installed source. The value does not appear at any of them.
The name looks like a transcription of the SDK's class and module name rather than its wire value:
- the class is `ResponseReasoningItem`, in `response_reasoning_item.py`
- its `type` tag is `"reasoning"`, which is what the responses converter emits
The entry predates this repo's git history and cannot match anything, so removing it and its test
parametrization is behaviour-preserving. It only made the set look more complete than it was.
The second change is the `RESPONSES_TO_TRAIN[item_cls]` lookup in the responses converter. It was a
bare dict access, so an unregistered class raised `KeyError` and reached the client as a 500 with no
explanation. `training_variant_of()` raises `NotImplementedError` naming the class and what to add.
Nothing reaches that path today. The lookup is passed `response_output[-1]` from
`postprocess_assistant_message_dict`, whose local list can only hold `NeMoGymResponseReasoningItem`,
`NeMoGymResponseOutputMessage` or `NeMoGymResponseFunctionToolCall`, and all three are registered.
The point is that the next converter to emit a new item type gets a message telling it what to add
rather than a stack trace.
`from None` is deliberate: the suppressed `KeyError` carries only the missing key, which the new
message already names. The call-site traceback is unaffected, and the `KeyError` is still reachable
as `__context__`.
Verified: 1795 unit tests pass at openai 2.7.2.
The third change is the `case _` in the responses converter, which handles an item type the
converter has no case for. It interpolated the whole item into `Unsupported message type: {...}`.
That reads as an omission in the converter. Usually it is not: the type has no Chat Completions
representation, and the rollout needs a model server that passes Responses through. The message now
names the type and says that. It no longer prints the item, because a compaction record carries an
opaque blob and the type tag is what identifies the problem.
The fourth change is the role shortcut in `split_responses_input_output_items`. It matched any item
carrying `role == "assistant"`, and it is checked before the boundary type set, so it decided the
split on its own. Every item type with a role is a message at the current pin, which makes this
behaviour-preserving here, but a later SDK adding a role to a non-message type would have that item
open the trained segment regardless of how it is classified. The check now requires the item to be
a message as well, so classification stays the thing that decides.
Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Keep the named training-variant lookup while using the validated token metadata bundle from main. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
ananthsub
force-pushed
the
ananthsub/responses-item-fixes
branch
from
August 12, 2026 06:14
6bd05e3 to
0e52093
Compare
reasoning_item from the boundary set, and name the training-variant error
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.
Part of #2452
Two corrections to the Responses item plumbing. Neither changes behaviour at the current openai pin.
_RESPONSE_OUTPUT_BOUNDARY_TYPESlisted"reasoning_item", which is not a Responses output item type at any openai version.The class is
ResponseReasoningItem. Itstypetag is"reasoning": https://github.com/openai/openai-python/blob/650be393dedf2a4550092817c2b82c1d04d6e9dc/src/openai/types/responses/response_reasoning_item.py#L34which is what the responses converter emits:
Gym/nemo_gym/responses_converter.py
Lines 412 to 418 in abc21eb
RESPONSES_TO_TRAIN[item_cls]directly looks up the dict in the responses converter. It was a bare dict access, so an unregistered class raisedKeyErrorand reached the client as a 500 with no explanation.training_variant_of()raisesNotImplementedErrornaming the class and what to add.Nothing reaches that path today. The lookup is passed
response_output[-1]frompostprocess_assistant_message_dict, whose local list can only holdNeMoGymResponseReasoningItem,NeMoGymResponseOutputMessageorNeMoGymResponseFunctionToolCall, and all three are registered. The point is that the next converter to emit a new item type gets a message telling it what to add rather than a stack trace.responses_to_chat_completion_create_paramsmatches on each item'stypeand has a case for four of them. Everything else falls tocase _, which raisedUnsupported message type: {the whole item}:Gym/nemo_gym/responses_converter.py
Lines 174 to 184 in a62c300
That message reads as a gap in the converter. It usually is not. Most types that reach it have no Chat Completions representation at all, so the transcript needs a model server that passes Responses through rather than a new case here.
openai_modeldoes;vllm_modelandinference_providerdownconvert and cannot.The message now names the type and says which of those two situations it is. It no longer prints the item, because the payload can be large or opaque, and the
typetag is the part that identifies the problem.