Skip to content

fix(model): refresh endpoint contents at the configured interval - #3532

Draft
yaoyu-33 wants to merge 1 commit into
mainfrom
sync/model-endpoint-refresh-20260918
Draft

yaoyu-33 wants to merge 1 commit into
mainfrom
sync/model-endpoint-refresh-20260918

Conversation

@yaoyu-33

Copy link
Copy Markdown
Contributor

What does this PR do?

An endpoint publisher can replace its URL without changing the file mtime or size. The model server then keeps routing to the old URL. Read the small endpoint file at the existing polling interval and rebuild clients only when the URL changes. Preserve the polling throttle, missing/empty-file grace period, retry bounds, and sticky-session reset introduced by #2383.

This focused fix includes a regression for equal-size endpoint URLs with an unchanged mtime. No separate issue is needed for this directly reproduced bug.

Validation

  • gym env test +entrypoint=responses_api_models/vllm_model +should_validate_data=true: 262 passed.
  • The new rotation test fails against the original implementation and passes with this change.
  • pre-commit run --all-files: passed.

Rollouts

An actual Qwen2.5-0.5B-Instruct CPU model served two local HTTP endpoints. Requests through Gym's model server returned the correct answer, 391, before and after replacing the endpoint URL while preserving its mtime and size. Verified client rebinding and routing to the second endpoint. This checks the HTTP endpoint-rotation contract; it does not exercise a GPU vLLM deployment.

Compatibility and benchmark impact

No configuration or schema migration. At most one small file read per configured check interval replaces the stat-only check; unchanged URLs retain their clients. No benchmark scoring changes.

Checklist

  • Contributing guidelines read; focused scope.
  • Relevant tests and all-file pre-commit passed.
  • No new source files; existing SPDX headers retained.
  • DCO sign-off included.
  • Documentation N/A: existing behavior or test infrastructure repair.

@copy-pr-bot

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

@yaoyu-33 yaoyu-33 added the internal_sync Public PR created by internal-to-public sync automation label Sep 18, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:model Model servers, inference providers, and model adapters bug Something isn't working labels Oct 20, 2026
jinglinglingling pushed a commit to jinglinglingling/Gym that referenced this pull request Nov 16, 2026
No OSWorld configuration sets endpoint_file; Gym NVIDIA-NeMo#3532 carries this fix with a test.

Signed-off-by: Linglin Jing <[email protected]>
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Nov 20, 2026
* feat(osworld): add NeMo RL runtime profiles

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): forward Gym config to Ray rollout task

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): sanitize setup cleanup commands

Signed-off-by: Linglin Jing <[email protected]>

* fix(model): re-read endpoint file after polling interval

Signed-off-by: Linglin Jing <[email protected]>

* feat(osworld): restore 3-10-3 training compaction

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): replace fixed compaction params

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): align sandbox create budget with readiness

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): isolate OpenSandbox transport loop

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): replay accepted served calls and keep Code in history

Replay the served completion inside the live window so prefixes stay
continuous, keep the policy's original Code in compacted turns (raw_full),
expose only accepted calls as loss membership, and carry served
response_id through exact traces.

Signed-off-by: Linglin Jing <[email protected]>

* feat(osworld): optional stop-on-context-overflow policy with prompt token limit

Under the shrink policy a trajectory near the window overflows on every
later turn, and each shrink re-prefills the prompt and starts a new
captured row. The stop policy ends the rollout at the first overflow and
scores it as a policy stop, so the evaluated trajectory stays trainable.
context_prompt_token_limit rejects served calls whose prompt left less
than the reserved output room, since the server clamps max_tokens.

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): fail unterminated episodes like the reference agent

The adapter scored an episode on its final state when the policy never
returned computer.terminate: at the step horizon, after exhausting parse
retries, or at the context-limit stop. Training under that rule stopped
rewarding termination, and the policy drifted to printing a completion
message instead, which the reference Nemotron evaluator scores 0.

unterminated_episode_policy=fail executes FAIL in those three cases, as
the reference agent does. Transport failures remain runtime facts for
admission. The default keeps the published contract unchanged; the NeMo
RL OpenSandbox profile opts in.

Signed-off-by: Linglin Jing <[email protected]>

* feat(osworld): report how each episode ended

Classify every evaluated episode as done, agent_fail, forced_fail or
unterminated, print one OSWORLD_EPISODE_END line per episode, and expose
one-hot episode_end_* scalars on the verify response so trainers can log
them per step.

Signed-off-by: Linglin Jing <[email protected]>

* feat(osworld): opt-in options that reproduce pre-rebase cc_app training

Each option defaults to the current behavior and is enabled through an
OSWORLD_* environment variable in osworld_nemo_rl_opensandbox.yaml.

- cc_chunk_turns_as_generated / cc_prompt_token_guard: inside a context
  chunk, continue from the tokens the model generated and start a new
  chunk before the prompt exceeds the guard, as cc_app did.
- legacy_response_parser: parse actions with the pre-rebase OSWorld
  parser, including its Action header completion.
- rollout_timeout_s: agent-loop budget counted from the first step;
  reaching it ends the rollout as a timeout, which is not trained.
  cc_app trained with 1200s and evaluated with 7200s.
- mask_unterminated / mask_context_limit: do not train rollouts that end
  without a terminal action or at the context limit.
- Loss membership follows a loss_member flag so a rejected terminal call
  can be trained when train_invalid_terminal_call is set.

Signed-off-by: Linglin Jing <[email protected]>

* feat(osworld): let training keep partial OSWorld scores

Expose reward_mode through OSWORLD_REWARD_MODE (default binary). The
pre-rebase resources server trained on the raw evaluator score.

Signed-off-by: Linglin Jing <[email protected]>

* style(osworld): apply ruff format after rebase onto main

Signed-off-by: Linglin Jing <[email protected]>

* docs(osworld): name the legacy nemotron_osworld agent instead of pre-rebase

Signed-off-by: Linglin Jing <[email protected]>

* docs(osworld): describe training options by behavior

Signed-off-by: Linglin Jing <[email protected]>

* test(osworld): import ChatCompletionsConverter from the public API

The core public-API facade test rejects imports from nemo_gym.models submodules.

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): emit ng_trajectory as a typed TrajectoryRecord

Gym's collector validates ng_trajectory as a TrajectoryRecord and drops a hand-built dict.
Build one TrajectoryTurn per accepted call with ModelCallRef(model_ref, response_id), and
pass the policy server reference into _build_response.

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): name the last accepted call when the prompt-token guard stops a rollout

A reply that context_prompt_token_limit rejects was named as terminal_response_id while
accepted history excluded it, so returned-history selection raised. Skip it, as the
server's local overflow reply is skipped, so a context-limit stop names the last accepted
call like a step-horizon FAIL.

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): restore exact-trace output of every model call

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]>

* fix(osworld): stop forwarding NEMO_GYM_CONFIG_DICT to Ray rollout tasks

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]>

* feat(osworld): report infrastructure-stopped episodes as aborted

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]>

* fix(osworld): require cc_keep_last_groups >= 1

With 0, a chunk re-base dropped the current screenshot from the prompt.

Signed-off-by: Linglin Jing <[email protected]>

* fix(osworld): propagate context-overflow errors in the NeMo RL profile

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]>

* docs(osworld): cite the source of the copied OSWorld parser

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]>

* revert(vllm_model): drop the endpoint_file polling change

No OSWorld configuration sets endpoint_file; Gym NVIDIA-NeMo#3532 carries this fix with a test.

Signed-off-by: Linglin Jing <[email protected]>

---------

Signed-off-by: Linglin Jing <[email protected]>
Signed-off-by: Linglin Jing <[email protected]>
Co-authored-by: Linglin Jing <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:model Model servers, inference providers, and model adapters bug Something isn't working internal_sync Public PR created by internal-to-public sync automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants