Repository navigation
feat(osworld): isolate exact-trace and AgentENV environment support - #3592
bxyu-nvidia merged 2 commits into
Conversation
Extract the OSWorld-owned changes from JeffPengCoder/Gym 360b0df onto upstream main 6bbc05e. Shared runtime, sandbox-provider and vLLM-model changes are reviewed separately. Preserve canonical task/evaluator semantics and move environment-only dependency tests into the agent suite. Signed-off-by: Jeff Peng <jepeng@nvidia.com>
Signed-off-by: Jeff Peng <jepeng@nvidia.com>
|
/ok to test 1e0985e |
|
/claude review |
|
SHIP WITH CARE — large (65-file) additive PR: a decoupled Gym-native OSWorld Resources Server + remote-Docker worker, an AgentENV/E2B sandbox backend, deterministic history policies, and supporting tooling. The core scoring and async paths hold up; findings below are minor. Reviewed against the rubric (verifier/scorer correctness, async HTTP, public-API compat, config conventions, dependency hygiene, test coverage, operability). What I checked and found solid:
Findings: one inline NOTE on Per repo policy, behavior-changing agent/verifier work should land with real smoke-rollout evidence (a model run inspecting agent + verifier behavior), not green unit tests alone — please confirm that's in the PR description before merge. |
Signed-off-by: Jeff Peng <jepeng@nvidia.com>
## What does this PR do? Fix the OSWorld agent's Python 3.13 dependency-resolution failure by correcting the OSWorld package metadata at its source, rather than adding another NumPy override or changing Gym's shared installer. - Update both OSWorld consumers to [JeffPengCoder/OSWorld@f32ab2b7](JeffPengCoder/OSWorld@f32ab2b), now published on `nv-gym`. - Remove the redundant NumPy overrides from the agent and resources server. Their normal `numpy>=2.1,<2.5` requirements remain unchanged. - Update revision documentation and dependency-policy tests. No Gym Core, CI workflow, root dependency, or other-agent changes. The fork commit synchronizes `pyproject.toml`, `requirements.txt`, and `setup.py`: Python <3.13 retains NumPy 1.26/OpenCV 4.8; Python >=3.13 declares NumPy >=2.1,<3 with headless OpenCV >=4.10.0.84,<5. It adds 18 marker/ABI-pair regression cases. These are compatibility ranges, not experimental version locks. ## Why is this needed? The [scheduled server-suite failure](https://github.com/NVIDIA-NeMo/Gym/actions/runs/35816620013/job/107039403224) occurs before OSWorld tests run: ```text osworld==0.1.0 depends on numpy<2 the agent requires numpy>=2.1,<2.5 No solution found ``` #3592 introduced the agent's NumPy 2 requirement while its pinned OSWorld archive still declared `numpy<2`. `osworld==0.1.0` is the fork package's metadata version; CI already downloads our explicit GitHub archive, not an unrelated PyPI package. The later README-only #3631 did not introduce this regression. The role's `uv.toml` NumPy override depended on explicit config loading in the still-open #3591. Current main's generated requirements install does not load that role config in this checkout layout. Fixing the fork metadata removes this particular dependency on #3591. Its other runtime/embedded-Ray changes remain separate and are not claimed fixed here. ## Validation - Reproduced the original NumPy resolver conflict on the old archive. - Real Linux x86_64 / Python 3.13.14 dependency resolution passed for both agent and resources server using the published new archive, without NumPy overrides. - Gym's actual generated agent install command also passed with only `--dry-run` and a Linux target added, in a fresh temporary venv and including the parent's Ray 2.56.1/OpenAI 2.44.0 requirements: **350 packages resolved**. - OSWorld agent, resources-server, and benchmark regression suites: **353 passed**, run in the existing development venv. - Fork regression suite: **18 passed**; it failed against the old metadata. Built the fork wheel and inspected the emitted conditional `Requires-Dist` entries. - Isolated CPython 3.13.14 NumPy/OpenCV imports and PNG encode/decode passed for NumPy 2.1.0 and 2.4.6, both with OpenCV 4.10.0.84, on macOS ARM64. - `pre-commit run --all-files` and `git diff --check`: passed. The full eight-shard server suite and a fresh Linux managed-venv installation are left to CI; resolver checks are not a claim that those runs completed locally. ## Compatibility and benchmark impact The fork's `desktop_env`, `mm_agents`, and `evaluation_examples` Git tree IDs are byte-identical to the previous pinned revision. Tasks, evaluators, prompts, parser, history policy, and exact-trace behavior are unchanged. Existing Gym role runtime ranges are also unchanged; only their upstream metadata conflict is removed. Model rollout: **N/A for this metadata-only fix**. No new model score or training result is claimed. Other stale dependency overrides are intentionally retained; this is not a general OSWorld packaging migration. Signed-off-by: Jeff Peng <jepeng@nvidia.com>
## Summary Add an opt-in `sink_window` history policy to the OSWorld Nemotron adapter: retain the earliest screenshots alongside a recent-image window, with intervening turns represented as text in chronological order. This branch includes upstream `main` at `d4c0f86c7` through a normal merge, including the NumPy metadata fix #3649, CI preflight update #3658, and sandbox lifecycle telemetry #3633. The OSWorld foundation from #2554/#3140 was consolidated and merged through #3592, so this PR no longer carries the old exact-trace/Core stack or depends on #2554. It does not require #3591. No separate issue is needed for this follow-up policy extension. ## Changes - Add configurable sink, low-water and high-water counts. Both watermarks include the sink; equal watermarks slide, while unequal watermarks provide hysteresis. - Represent non-contiguous image selections with intervals and render folded text in chronological order. - Distinguish context overflow, transport failure, truncated output, empty output and unparseable output; retain `agent_outcome_family=model_response_invalid` for compatibility. - On context overflow, reduce the recent-image window within the existing retry budget, preserve the sink/current observation, record actual shrink events, and stop when further reduction is impossible. - Preserve main's immediate model-timeout propagation. Report the terminal attempt's completion fact so an earlier malformed sample cannot hide a subsequent transport failure. The latest synchronization also annotates six deterministic SHA-256 prompt goldens that the previous secrets-detector run falsely identified as credentials. Only those literal lines are annotated; the digest values, assertions, repository scanner configuration, and baseline are unchanged. ## Design and compatibility History policy selects image/text turns; the adapter owns model protocol rendering and parsing. The runner owns horizon and runtime failure handling, the evaluator owns reward, and runtime admission owns masking. This PR does not change those ownership boundaries or add a training/evaluation switch. Fixed-window and hysteresis policy IDs and normal-path rendered prompts remain covered by deterministic golden tests, including fixed-3 and 3-10-3. Sink-window is opt-in, not a new default or a claim of improved benchmark score. Context-overflow recovery and more precise failure outcomes are intentional behavioral changes and may affect failed-run outcomes. The legacy scalar `image_window_start` accessor rejects non-contiguous plans; consumers should use `image_intervals` or per-turn decisions. Scope relative to current main remains limited to `responses_api_agents/osworld_agent/`: two implementation files, documentation, and tests. No Gym Core, dependency, deployment, sandbox-provider or model-server changes are included in the PR diff. ## Validation Re-run on the final main-synchronized tree: - **440 passed, zero skipped** across OSWorld agent, resource-server and benchmark tests; one non-failing Starlette deprecation warning. - `pre-commit run --all-files`: passed. - `uv lock --check --offline`: passed. - `git diff --check`: passed. - The same `detect-secrets==1.5.0` hook and checked-in baseline used by CI passed on all nine PR-scoped files after the inline false-positive annotations. - Existing model-timeout propagation, runner admission, prompt-parity, sink selection, overflow recovery and policy-identity regressions passed. The unchanged-overflow retry and mixed parse/transport completion bugs had been reproduced before their earlier fixes. Test invocation, using an existing compatible development environment from this checkout: ```bash export PYTHONPATH="$PWD" export NEMO_GYM_EXTRA_ROOTS="$PWD" python -m pytest \ responses_api_agents/osworld_agent/tests \ resources_servers/osworld/tests \ benchmarks/osworld/tests \ --import-mode=importlib -o addopts='' -o log_cli=false -q pre-commit run --all-files ``` The explicit source root prevents an older editable checkout from shadowing the branch under test; importlib mode avoids the shared `osworld` test-package name collision. These checks are local evidence, not a claim that the upstream CI run has completed. ## Score reproduction OSWorld 361 tasks, Nemotron-3-Nano-Omni v3 (`24e67ea0`), fixed-3 history, 100 steps, one A/B run per arm. Control = main `d4c0f86c7` + #3591 (needed for the E2B `endpoint()` on AgentEnv); treatment = control + this PR. Raw SR 44.61% → 46.62% (Δ +2.01 pp, paired 95% CI [−2.12, +6.07] pp); binary 154 → 159 of 361 (McNemar p = 0.59); 0 masked and 0 missing in both arms; identical history-policy and agent-contract IDs. No degradation. The context-overflow shrink path was not triggered in either run. --------- Signed-off-by: Jeff Peng <jepeng@nvidia.com> Co-authored-by: Michał Bień <mbien@nvidia.com>
What does this PR do?
Extract the OSWorld-owned changes from #2554 and #3140 into one environment-focused PR. Both original PRs and their branches remain unchanged. This branch is based on upstream
6bbc05ed9; the implementation comes from the AgentENV benchmark source360b0df13.Changes are limited to
benchmarks/osworld, the relevantexamplesconfig,resources_servers/osworld, andresponses_api_agents/osworld_agent. OSWorld-specific dependency-policy tests move into the agent suite.Companion and merge dependency
The companion Gym Core runtime-contracts PR #3591 owns the generic installer, rollout collection, HTTP lifecycle, sandbox providers, and shared
vllm_modelchanges. E2B gateway/hostname endpoint resolution and SDK transport integration belong there because they serve any E2B consumer, not just OSWorld.The two diffs have no overlapping files and both target
main. This is review/scope separation, not a claim of runtime independence: the complete AgentENV path requires the companion Core PR, particularlyE2BProvider.endpoint(). The Core PR should land first for complete AgentENV enablement.Validation
pre-commit run --all-files,uv lock --check --offline, andgit diff --check: passed.An exhaustive Git-object reconstruction audit accounts for all 92 predecessor change paths: 80 byte-identical, six clean upstream/source merges, two E2B transport/test conflict adaptations, three dependency/test-organization updates, and one comment-only false-positive annotation on the golden-prompt SHA256. The hash and assertion are unchanged. No unaccounted paths; unrelated upstream files and original executable modes are preserved. Runtime-policy assertions for
vllm_modelremain in the companion PR rather than making the OSWorld test suite own them.Rollouts
The recorded predecessor completed 361/361 canonical OSWorld tasks on AgentENV: 46.9182% raw reward, 159/361 binary successes, no missing/duplicate/masked rows. It used Omni v3, fixed-three-image history, 100 steps, temperature 0.60, and top_p 0.95. Four model-format terminations were evaluator-scored; this is not a claim of zero format failures.
The actual CW-DFW run checkout was rechecked:
360b0df131de7671e2a6e243f21c8150a061c5ce, clean. Recipe and run evidence.No fresh GPU rollout or full 361-task evaluation was run for this split. These scores belong to the predecessor; they are not a new benchmark claim for the split on newer main. No new environment behavior was intentionally introduced by the split.
Compatibility and benchmark impact
The task definitions, evaluator, prompts, parser, history-policy implementation, and exact-trace implementation are unchanged from the tested source. Training's hysteresis policy remains configurable; the recorded benchmark's fixed-3 setting is not imposed on training. The obsolete
httpx-aiohttprequirement is removed because newer upstream ownsGymAiohttpTransport; Core preserves the no-config worker guard/fallback. Other agent implementations are not modified here.The automatic Claude review currently fails while obtaining its OIDC token (
ACTIONS_ID_TOKEN_REQUEST_URLis unavailable). This is an upstream workflow permission issue, not a code-review finding; no CI configuration is changed in this PR.