Repository navigation
Conversation
This was referenced Oct 8, 2026
jinglinglingling
force-pushed
the
linglinj/flashreinforce-agentenv-osworld
branch
from
October 8, 2026 01:54
80f12b7 to
959dcd5
Compare
jinglinglingling
force-pushed
the
linglinj/flashreinforce-agentenv-osworld
branch
from
October 14, 2026 15:21
d34091a to
3d5f308
Compare
Contributor
Author
|
Rebase/validation update:
|
jinglinglingling
force-pushed
the
linglinj/flashreinforce-agentenv-osworld
branch
6 times, most recently
from
October 20, 2026 02:44
35a5422 to
da4ead3
Compare
This was referenced Oct 22, 2026
jinglinglingling
force-pushed
the
linglinj/flashreinforce-agentenv-osworld
branch
from
October 29, 2026 05:03
6efe0e4 to
51eed0a
Compare
Signed-off-by: Linglin Jing <[email protected]>
Signed-off-by: Linglin Jing <[email protected]>
Signed-off-by: Linglin Jing <[email protected]>
added 8 commits
November 15, 2026 19:50
The exact per-call token-evidence path again exports all calls, including parser retries, as the README and NVIDIA-NeMo#4896 describe. Capture-on returned history is unchanged. Signed-off-by: Linglin Jing <[email protected]>
Ray logs a task's runtime_env env_vars at INFO, which exposed literal keys in the Gym config. Since NVIDIA-NeMo#5093 the child builds its HTTP client without parsing argv, so the dict is not needed. NEMO_GYM_CONFIG_PATH is still forwarded for sandbox attribution. Signed-off-by: Linglin Jing <[email protected]>
A row with no terminal action and an infrastructure_failure_reason (reset failure, policy transport failure, rollout timeout) now reports episode_end=aborted instead of unterminated. Signed-off-by: Linglin Jing <[email protected]>
With 0, a chunk re-base dropped the current screenshot from the prompt. Signed-off-by: Linglin Jing <[email protected]>
Without propagate_context_overflow_errors, vllm_model turns an engine context refusal into an empty length reply, so context_overflow_policy and mask_context_limit never see it. Signed-off-by: Linglin Jing <[email protected]>
The parser functions come from mm_agents/nvidia/nemotron_agent.py in terrykong/OSWorld at 5d8c93592be588ab8e9909bed82f3b480fd4f533 (Apache-2.0). Signed-off-by: Linglin Jing <[email protected]>
No OSWorld configuration sets endpoint_file; Gym NVIDIA-NeMo#3532 carries this fix with a test. Signed-off-by: Linglin Jing <[email protected]>
…ce-agentenv-osworld Resolve the import conflict in responses_api_agents/osworld_agent/app.py by keeping both imports. Signed-off-by: Linglin Jing <[email protected]>
yfw
previously approved these changes
Nov 19, 2026
Contributor
|
/ok to test f62867a |
yfw
enabled auto-merge
November 19, 2026 02:29
Signed-off-by: Linglin Jing <[email protected]> # Conflicts: # responses_api_agents/osworld_agent/adapter_agents.py
auto-merge was automatically disabled
November 20, 2026 00:46
Head branch was pushed to by a user without write access
yfw
approved these changes
Nov 20, 2026
yfw
enabled auto-merge
November 20, 2026 00:57
Contributor
|
/ok to test 7c44845 |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44651864995 |
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.
Summary
Adds opt-in options to
osworld_agentfor the Nemotron Nano Omni OSWorld training recipe, plus a NeMo RL training profile that sets them throughOSWORLD_*environment variables. Every new option defaults to the current behavior.history_layout: cc_chat(adapter_agents.py): chat-style history. Every turn stays a chat turn, the first screenshot is always kept, and older screenshots are replaced by an omission marker so the image count cycles betweencc_keep_last_groups + 1andcc_max_active_images. Options:cc_keep_last_groups(>= 1),cc_max_active_images,cc_actions_per_chunk,cc_chunk_turns_as_generated(continue a chunk from the generated tokens), andcc_prompt_token_guard(start a new chunk before a prompt would exceed this many tokens).assistant_history_replay(adapter_agents.py): fixes a training mismatch onmain.mainrebuilds every earlier assistant turn from the parsed fields (<think>{thought}</think>plus## Action:), which drops the## Codeblock and anything else the model wrote, so the replayed turn is not the model's own output. Under token capture the next prompt then no longer extends the previous prompt plus generation, and one rollout splits into many physical traces.raw_livereplays the served output, reasoning included, inside the live window;raw_fullalso keeps the model's original Code (before coordinate projection) in compacted turns.normalized(the current behavior) stays the default;cc_chatrequiresraw_full, and the NeMo RL profile sets it.legacy_response_parser(legacy_parser.py): the OSWorldmm_agentsNemotron response parser, including its Action header completion. Source below.validate_python_syntax,require_clean_finish, andtrain_invalid_terminal_call(train the rejected generation that ends an episode in FAIL, with the episode reward).unterminated_episode_policy=fail(execute FAIL when the policy never terminates, as the reference agent does),mask_unterminated,mask_context_limit, androllout_timeout_s(per-rollout agent-loop budget; reaching it ends the rollout as a timeout, which is not trained).reward_mode:binary(default) orraw(the evaluator's partial score).done,agent_fail,forced_fail,unterminatedoraborted(no terminal action and an infrastructure failure) asepisode_end_*scalars.loss_membermarks a rejected terminal call as accepted history whentrain_invalid_terminal_callis set.ng_trajectoryis a typedTrajectoryRecordwith one turn per accepted call andModelCallRef(model_ref, response_id), so the trainer can join accepted calls to capture records. A reply thatcontext_prompt_token_limitrejects is not named as the terminal; the last accepted call is.response_id. The exact-trace output itself is unchanged frommain.osworld_nemo_rl_opensandbox.yaml(NeMo RL profile; also setspropagate_context_overflow_errors: trueon the policy server so context refusals reach the agent as errors),osworld_nemo_rl_agentenv.yaml(NeMo RL profile for the AgentEnv provider), andtransport_backend: httpxinosworld_opensandbox.yaml.Source of copied code
parse_response_to_cot_and_actionandproject_coordinate_to_absolute_scaleinresponses_api_agents/osworld_agent/legacy_parser.pyare copied, with logging changed, frommm_agents/nvidia/nemotron_agent.pyin terrykong/OSWorld at commit5d8c93592be588ab8e9909bed82f3b480fd4f533(Apache-2.0, a fork of xlang-ai/OSWorld).Compatibility
main. New result fields are theepisode_end_*scalars on every row, andng_trajectorywhen token capture is on.osworld_opensandbox.yamlswitches the OpenSandbox transport to httpx for every OSWorld OpenSandbox run, because OSWorld's synchronous sandbox wrapper owns its own event loop.NEMO_GYM_CONFIG_DICT; it builds its HTTP client with default limits (see fix(http): build worker clients without parsing unrelated argv #5093).NEMO_GYM_CONFIG_PATHis still forwarded.chat_template_kwargs: {truncate_history_thinking: true}fromosworld_agent_nano_omni.yaml, which the tested inference recipe needs. That per-request value overrides the serving default, so the chat template strips the reasoning thatraw_fullreplays. Training callers set it tofalse; RL #4581 does so in its recipe.train_invalid_terminal_callis set. The recipe below sets it, and RL #4581 will pin this PR and set it in itsenv.example.Training recipe
The NeMo RL run below changes these keys from the NeMo RL profile defaults (the full set is in RL #4581
examples/nemo_gym/osworld_v2/env.example):OSWORLD_*variableHISTORY_LAYOUTcc_chatosworldCC_CHUNK_TURNS_AS_GENERATEDtruefalseCC_PROMPT_TOKEN_GUARD38000nullLEGACY_RESPONSE_PARSERtruefalsePARSE_RETRIES15VALIDATE_PYTHON_SYNTAXfalsetrueREQUIRE_CLEAN_FINISHfalsetrueTRAIN_INVALID_TERMINAL_CALLtruefalseREWARD_MODErawbinaryROLLOUT_TIMEOUT_S1200nullNeMo RL side: GRPO with 8 prompts x 8 generations per step and one step of prompts in flight (synchronous), 64 steps, 49152-token sequence length, 4 x 8 H100.
Training result
All rows use the same evaluation setup:
osworld_agentsettings above, except that evaluation uses the default response parser (legacy_response_parser=false), no prompt-token guard, andcc_chunk_turns_as_generated=false. An episode ends when the prompt no longer fits the 49152-token window.| Model | Step | Accuracy, all 361 | Accuracy, 332 feasible | Pass@4, all 361 |
|---|---:|---:|---:|---:|
| SFT (starting point) | — | 46.88% | 44.95% | 67.87% (245/361) |
| This PR, sync recipe | 64 | 53.81% | 51.58% | 67.87% (245/361) |
Paired per-task difference (this PR − SFT, ± standard error): +6.93 ± 1.39 points on all 361 tasks, +6.63 ± 1.45 points on the 332 feasible tasks.
Under
unterminated_episode_policy=fail, an adapter-forced FAIL scores 1.0 on an infeasible task, as in the reference agent. Both rows are evaluated the same way. In the episode logs (about 1% of rollouts lack an end line), forced FAILs solved 73 of SFT's 111 logged infeasible-task rollouts and 63 of this PR's 112, so the gain does not come from them.Verification
main.tests/unit_tests/test_public_api_facades.pypasses; ruff 0.9.9 check and format are clean./runresults: a trained invalid terminal call, a reply rejected bycontext_prompt_token_limit, and parser retries under capture all select the expected calls. A rejected terminal call withouttrain_invalid_terminal_callstill raises "Declared terminal differs from accepted history", as described under Compatibility.