Repository navigation
fix(conversational_tool_use_simulation): fall back to reason_for_contact when the opening user message fails - #4641
Merged
Conversation
…act when the opening user message fails When the user simulator raised while generating the first user message, or produced a first message that already carried ###STOP###/###TRANSFER###, the server ended the trajectory before the agent ever spoke. The agent then returned a response with an empty output list, which NeMo RL cannot represent (no trainable tokens) and turned into a whole-batch rollout failure. Fall back to the scenario's reason_for_contact (or a generic request when that is empty or itself carries a stop indicator) so the conversation always reaches the agent. Record each fallback under source_artifacts.first_user_message_fallbacks so the simulator failure rate stays observable. Later-turn failures keep the existing invalid/terminal behavior. Controlled by the new fallback_first_user_message config flag (default true). Signed-off-by: Yi-Fu Wu <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…r_message Add the flag introduced by the previous commit to the README's configuration table: what triggers the fallback, which text replaces the opening user message, where each fallback is recorded, and what disabling it does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Contributor
Author
|
/ok to test b594a36 |
Contributor
Author
|
/review |
svcnvidia-nemo-ci
left a comment
Contributor
There was a problem hiding this comment.
SHIP — one nonblocking configuration NOTE.
No BLOCKER or RISK findings. The opening-message fallback, opt-out behavior, later-turn failure handling, and artifact serialization are consistent with the inspected agent and verifier paths.
Static review only; tests were not executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex
…ault, retries and TRANSFER reason The existing fallback tests stopped at next_user_message, so masking fallback rows, labeling them user_failure, or flipping the code default to False all passed the suite. Add tests that: - verify a fallback row end to end: scored, not masked, no failure labels, and the fallback recorded in result.source_artifacts; - pin the fallback_first_user_message default by building the config directly (make_server always passes the flag); - check that a ###STOP### first message is retried before the fallback replaces it; - cover a reason_for_contact containing ###TRANSFER###, which would otherwise end the conversation before the policy speaks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…ssage fallback applies A ###STOP###/###TRANSFER### message only triggers the fallback when nothing precedes it in the conversation, the generic request also replaces a reason_for_contact containing ###TRANSFER###, and with the flag off the trajectory does not always end before the policy responds (the policy can speak first). Correct the README row accordingly, describe the fallback in docs/rollout.md (the session contract the README links), and reword the helper docstring: the fallback is recorded per row in the rollout result, not as an aggregate rate. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
…r_message in the canonical config The canonical YAML lists every other setting this server's config defines, and the README's "Canonical value" column follows it. Declare the new flag there too so resolved configs show it. The value matches the Python default, so behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
… enables fallback_first_user_message Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Contributor
Author
|
/ok to test c9152cd |
cmunley1
approved these changes
Oct 16, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38840110333 |
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.
What does this PR do?
Upstreams #3111 to
main. #3111 was merged only intosuper-v3.5-posttraining.When the user simulator fails on the opening user message, the conversational tool-use server now opens the
conversation with the scenario's
reason_for_contact. Before, it ended the trajectory before the policy spoke. Afailure here means the simulator raised an error, or its first message already contained
###STOP###or###TRANSFER###.Cause
In both failure cases the server marked the trajectory invalid or terminal at turn 0. The agent then returned a
response with an empty
outputlist. NeMo RLmaincannot represent a sample with no policy tokens. It raises beforeany mask is read, so one such row can fail the rollout batch.
Fix
customer_scenario.reason_for_contactas the first user message.If that is empty or contains
###STOP###or###TRANSFER###, it uses a generic request(
DEFAULT_FIRST_USER_MESSAGE). A###STOP###/###TRANSFER###message triggers the fallback only when nothingprecedes it in the conversation; a generation error triggers it whenever no user message exists yet.
result.source_artifacts.first_user_message_fallbacks, so each fallback stays visiblein the rollout result.
fallback_first_user_messagecontrols this. It defaults totrue, and the canonical YAMLdeclares it.
test_config.pyasserts the canonical value.docs/rollout.mddocument the flag.No issue is linked. The cause and fix are recorded in #3111, which this PR ports.
Validation
Ran on this branch (base
mainat974d1a921). #3111 cherry-picked cleanly. Sincesuper-v3.5-posttrainingsplit frommain,mainchanged these files in 3 commits. The closest is #4568 (judgetext.format, top-levelmask_sample). None of themtouch the opening-message path.
ng_test +entrypoint=resources_servers/conversational_tool_use_simulation +should_validate_data=true: 85 passed,and data validation passed.
The 3 new fallback tests fail against
main'sapp.pyand pass on this branch:test_first_user_stop_falls_back_to_reason_for_contacttest_first_user_generation_error_falls_back_to_reason_for_contacttest_first_user_fallback_uses_default_when_reason_for_contact_is_unusableThe 3 guard tests pass on both. They cover the flag turned off, for the stop and error cases, and an error on a
later turn.
3 more tests check that a fallback row is scored and not masked through
verify(), that the flag defaults totrue, and that a###STOP###first message is retried before the fallback replaces it. Each fails if the behaviorit covers is broken.
Parity with
super-v3.5-posttraining: the fallback code is identical to that branch at every Gym commit thetraining run below used (
e978899b7,34b99364,14317ecb5). A local run of the real agent and resource serverthrough
verify()on 23 cases (user simulator, policy and judge stubbed) matches that branch on reward, mask andmessages with the flag at its default,
trueorfalse. Withfalseit also matchesmainwithout this PR.pre-commit run --all-files: passed, no changes.DCO: every commit is signed off.
Rollout evidence
The fix ran in a Nemotron 3.5 Super RLVR training run,
super35-journey-rlvr-v43-yifuw-001(W&B). The run used NeMo RL
super-v3.5-posttraining, whose Gym pin has included #3111 since 2026-09-04. The run's data blend includesconversational_tool_use_simulation.logged
first user message fallback: message_generation_error(A response does not contain a message output).Without the fix, each of these rows would have produced an empty agent output. That branch's NeMo RL also has
RL docs(cli): document --environment selector and fix stale CLI samples #4001, which turns such rows into masked placeholders, so this run shows the fallback trains safely rather than
that it prevented a failure. NeMo RL
maindoesn't have docs(cli): document --environment selector and fix stale CLI samples #4001.dvp5tc0d, which went on tostep 38. The second happened during step 41 of
0g5thn9y, which went on to step 51. The run reached step 78.Compatibility
main, a first-turn simulator failure produces a row with an empty agent output,labeled
user_failureand masked. With this PR, that row becomes a normal conversation that starts from thescenario's own request, and it is scored and trained on. If the judge rejects that first message itself, the row is
masked as a user failure, as before. Set
fallback_first_user_message: falseto restore the oldbehavior.
🤖 Generated with Claude Code