Skip to content

fix(conversational_tool_use_simulation): fall back to reason_for_contact when the opening user message fails - #3111

Merged
yfw merged 1 commit into
super-v3.5-posttrainingfrom
yifu/fix-conversational-tool-first-message-super35
Sep 5, 2026
Merged

yfw merged 1 commit into
super-v3.5-posttrainingfrom
yifu/fix-conversational-tool-first-message-super35

Conversation

@yfw

@yfw yfw commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

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).

What does this PR do?

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format/copyright pass).
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

…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]>
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 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.

@yfw yfw changed the title fix(conversational_tool_use_simulation): fall back to reason_for_cont… fix(conversational_tool_use_simulation): fall back to reason_for_contact when the opening user message fails Sep 5, 2026
@yfw
yfw merged commit 54e9bf0 into super-v3.5-posttraining Sep 5, 2026
11 checks passed
@yfw
yfw deleted the yifu/fix-conversational-tool-first-message-super35 branch September 5, 2026 01:01
linj-glitch pushed a commit to linj-glitch/Gym that referenced this pull request Oct 16, 2026
…act when the opening user message fails (NVIDIA-NeMo#4641)

## What does this PR do?

Upstreams NVIDIA-NeMo#3111 to `main`. NVIDIA-NeMo#3111 was merged only into
`super-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. A
failure 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 `output` list. NeMo RL `main` cannot represent a
sample with no policy tokens. It raises before
any mask is read, so one such row can fail the rollout batch.

### Fix

- When no user message exists yet, the server uses
`customer_scenario.reason_for_contact` as 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 nothing
precedes it in the conversation; a generation error triggers it whenever
no user message exists yet.
- Each fallback is appended to
`result.source_artifacts.first_user_message_fallbacks`, so each fallback
stays visible
  in the rollout result.
- Failures on later user turns keep the existing invalid/terminal
behavior.
- The new config flag `fallback_first_user_message` controls this. It
defaults to `true`, and the canonical YAML
  declares it. `test_config.py` asserts the canonical value.
- The README configuration table and `docs/rollout.md` document the
flag.

No issue is linked. The cause and fix are recorded in NVIDIA-NeMo#3111, which this
PR ports.

## Validation

Ran on this branch (base `main` at `974d1a921`). NVIDIA-NeMo#3111 cherry-picked
cleanly. Since `super-v3.5-posttraining` split from `main`,
`main` changed these files in 3 commits. The closest is NVIDIA-NeMo#4568 (judge
`text.format`, top-level `mask_sample`). None of them
touch 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`'s `app.py` and pass on
this branch:
  - `test_first_user_stop_falls_back_to_reason_for_contact`
  - `test_first_user_generation_error_falls_back_to_reason_for_contact`
-
`test_first_user_fallback_uses_default_when_reason_for_contact_is_unusable`

The 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 to
`true`, and that a `###STOP###` first message is retried before the
fallback replaces it. Each fails if the behavior
  it covers is broken.
- Parity with `super-v3.5-posttraining`: the fallback code is identical
to that branch at every Gym commit the
training run below used (`e978899b7`, `34b99364`, `14317ecb5`). A local
run of the real agent and resource server
through `verify()` on 23 cases (user simulator, policy and judge
stubbed) matches that branch on reward, mask and
messages with the flag at its default, `true` or `false`. With `false`
it also matches `main` without 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](https://forge.coreweave.com/wandb/nvidia/super-v3p5-posttraining?nw=j0nn1gshftc)).
The run used NeMo RL
`super-v3.5-posttraining`, whose Gym pin has included NVIDIA-NeMo#3111 since
2026-09-04. The run's data blend includes
`conversational_tool_use_simulation`.

- The fallback fired twice. Each time, the user simulator returned only
a reasoning item and no message, so the server
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 NVIDIA-NeMo#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 `main` doesn't have NVIDIA-NeMo#4001.
- Training kept going after both. The first fallback happened during
step 35 of W&B run `dvp5tc0d`, which went on to
step 38. The second happened during step 41 of `0g5thn9y`, which went on
to step 51. The run reached step 78.

## Compatibility

- This changes default behavior. On `main`, a first-turn simulator
failure produces a row with an empty agent output,
labeled `user_failure` and masked. With this PR, that row becomes a
normal conversation that starts from the
scenario'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:
false` to restore the old
  behavior.
- Rows whose prefilled history already contains a user message never
fall back.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Yi-Fu Wu <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.

1 participant