Repository navigation
fix(web): allocate browser pool displays independently - #6326
JeffPengCoder merged 2 commits into
Conversation
Extract the shared browser display allocator from VisualWebArena PR NVIDIA-NeMo#2918 for independent Gym maintainer review. Headed browser pools without an explicit display now use Xvfb -displayfd; fixed DISPLAY reservations remain supported and retain their ownership checks. Startup failures and late completion release only this allocator's processes and display sockets. This commit is byte-identical to the shared display implementation and tests at b026af9. This PR targets main independently of the Nano budget PR; this diff changes exactly three display files. There are no VisualWebArena-specific files or evaluator changes. Validation: NEMO_GYM_EXTRA_ROOTS=$PWD .venv/bin/python -m pytest tests/unit_tests/web/test_display_allocation.py tests/unit_tests/web/test_browser_instance.py -q --no-cov -o log_cli=false --tb=short 18 passed; one native Xvfb test skipped on macOS (Xvfb unavailable). PRE_COMMIT_HOME=/tmp/vwa-pr2918-query-precommit-20261117 PATH=/tmp/vwa-pr2918-checkin-uv-cache/archive-v0/iB5P_KDaZXSbMV8R/uv-0.13.4.data/scripts:$PATH .venv/bin/pre-commit run --all-files All hooks passed without unrelated changes. git diff --check passed. Prior same-source Linux native two-X-server test passed on GPU allocation 22188405; headed Chromium 140.0.7339.16, Pillow desktop capture, xclip and SSIM probes passed in the pinned browser image. The allocation subsequently ended by its two-hour time limit. Fresh integrated qualification is pending, so the extracted PR remains draft; no new VWA benchmark score is claimed. Review: NVIDIA-NeMo#2918 (review) The user confirmed all three PRs must target main independently. Fresh same-source Linux native two-X-server ownership test passed on dl345g11-1665 with zero skips (native admission bb5f9d9, test count1). The extended desktop admission is separately tracked; no new score is claimed. Signed-off-by: Jeff Peng <[email protected]>
f8a8239 to
b38f235
Compare
Follow the user's explicit decision: NVIDIA-NeMo#2918, NVIDIA-NeMo#6325 and NVIDIA-NeMo#6326 each target main. Remove the Nano step-budget agent and automatic X display allocator from VWA's ancestry and diff. The VWA config uses main's existing agent and 100-step budget and no longer enables an unmerged option. Move the native N/A agent-loop regression to independent NVIDIA-NeMo#6325, using the WebArena predicate already on main. NVIDIA-NeMo#6326 owns display allocation only. Neither independent PR is a prerequisite for the VWA integration. All other VWA correctness repairs remain: reset must observe ongoing then ready; ordinary waves reset under exclusive ownership before collection; shared-lease conversion rechecks its ownership receipt; native literal must_include semantics and the full-context fuzzy branch are explicit. Final independent VWA validation:2185 passed, zero skipped,5 warnings. The raw JUnit tests counter is2209; pytest's own summary is retained verbatim. All-files pre-commit passed. Resource/evaluator source and its12 new literal/ fuzzy cases are unchanged from the recorded1248-pass resource run plus the same-source two-case successful retry after Chromium startup timeouts. New real-model smoke on this main-only runtime: protected-profile state changed555-0111 -> +82 555-0111, score1 in2 policy turns. A one-action hard budget also achieved that actual DOM mutation and legitimately scored1; its final answer was None and the native N/A answer predicate scored0. The budget does not invent an unachievable answer or erase earned DOM credit. Exactly3 real GPT-4.1 policy calls,0 judge calls. The control HTTP service returned stale ready -> Reset ongoing -> Ready for duty for both epochs. These are synthetic headless browser fixtures, not a new benchmark score. Exact test command from this checkout: env -u NEMO_GYM_EXTRA_ROOTS .venv/bin/python -m pytest tests/unit_tests/web tests/unit_tests/test_public_api.py tests/unit_tests/test_public_api_facades.py tests/unit_tests/test_import_linter_coverage.py tests/unit_tests/data/test_task_data.py tests/unit_tests/tooling/test_migrate_imports.py tests/unit_tests/test_fern_docs_links.py benchmarks/visualwebarena/tests benchmarks/webarena/tests responses_api_agents/web_agent/tests environment_servers/legacy_agent/tests -q --no-cov -o log_cli=false --tb=short --junitxml=/Users/jepeng/workspace/rl/my-rl/webarena/visualwebarena/runs/2026-11-18-pr2918-review-followup/vwa-independent-core.xml The previous combined-source qualification is retained in earlier commit metadata; the full new outcomes and configurations follow, superseding its proposed stacked dependency. The next checkpoint benchmark will deliberately combine the three separately pinned PRs in an evaluation-only checkout, as requested by the user, while every review PR continues targeting main. { "scope": "Synthetic browser/controller fixture; real model and native WebAgent/verifier. Collector subprocess transport alone replaced. No production reset or canonical 908 measurement.", "policy_model": "us/azure/openai/gpt-4.1", "model_endpoint": "https://inference-api.nvidia.com/v1", "browser_preflight": { "output": "/Users/jepeng/workspace/rl/my-rl/webarena/visualwebarena/runs/2026-11-18-pr2918-review-followup/model-smoke-independent/coordinator-preflight/rollouts.jsonl", "model_cases": [] }, "coordinated_model": { "output": "/Users/jepeng/workspace/rl/my-rl/webarena/visualwebarena/runs/2026-11-18-pr2918-review-followup/model-smoke-independent/coordinator-model/rollouts.jsonl", "model_cases": [ { "scenario": "protected-profile", "before": "555-0111", "after": "+82 555-0111", "reward": 1, "actual_reward": 1.0, "mask_sample": false, "failure_kind": null, "policy_calls": 2, "judge_calls": 0, "model_turns": 2, "environment_steps": 2 } ] }, "budget_model": { "scenario": "hard-budget-limit", "before": "555-0111", "after": "+82 555-0111", "reward": 1, "actual_reward": 1.0, "mask_sample": false, "failure_kind": null, "policy_calls": 1, "judge_calls": 0, "model_turns": 1, "environment_steps": 1 }, "controller_events": [ { "path": "/reset", "lease": { "run_id": "e2a8612daea34ac18c5f1ee646bf0385", "epoch": 2, "phase": "resetting", "reset_verified": false } }, { "path": "/status", "body": "Ready for duty!" }, { "path": "/status", "body": "Reset ongoing" }, { "path": "/status", "body": "Ready for duty!" }, { "path": "/reset", "lease": { "run_id": "1002579cd734421f8bc5cd4b1299e3c6", "epoch": 2, "phase": "resetting", "reset_verified": false } }, { "path": "/status", "body": "Ready for duty!" }, { "path": "/status", "body": "Reset ongoing" }, { "path": "/status", "body": "Ready for duty!" } ], "policy_calls": 3, "judge_calls": 0 } Complete protected-profile configuration: scope: closed-world protected-state / step-budget smoke; canonical intent retained, fixture URL/evaluator substituted; not canonical task accuracy endpoint: https://inference-api.nvidia.com/v1 model: us/azure/openai/gpt-4.1 tokenizer: provider managed chat_template: provider managed policy_protocol: nano_omni_toolcall tool_parser: parse_nano_omni_tool_calls reasoning_parser: null judge: called: false reason: native exact_match target sampling: temperature: 0 max_output_tokens: 1024 top_p: not sent seed: not sent stop: not sent agent: host: localhost port: 8001 num_workers: null uvicorn_reuse_port: null entrypoint: app.py domain: null name: web_agent session_close_timeout_seconds: 60.0 session_close_retry_window_seconds: 300.0 skip_verification: false skip_verification_reward: 0.0 tool_servers: [] token_id_capture: false tool_accesses: [] resources_server: type: resources_servers name: browser environment_server: null model_server: type: responses_api_models name: policy policy_protocol: nano_omni_toolcall max_steps: 5 max_parse_retries: 0 nano_omni_max_tool_calls: 8 nano_omni_max_computer_actions: 20 nano_omni_max_scroll_amount: 50 nano_omni_retry_invalid_tool_calls: true nano_omni_parse_retry_feedback: false nano_omni_parse_retry_temperature: null nano_omni_parse_retry_delay_secs: 0.0 repeated_action_warning_threshold: 0 repeated_action_window: 5 max_consecutive_execution_failures: 3 model_turn_max_retries: 0 model_retry_delay_secs: 1.0 max_image_history: 3 qwen_fold_size: 10 qwen_history_n: 100 qwen_coordinate_type: relative qwen_thinking: true judge_max_screenshots: 3 task_image_root: null max_task_image_bytes: 26214400 visual_observation_text: full_axtree redact_old_visual_observations: false resources_request_timeout_secs: 180.0 seed_request_timeout_secs: 1800.0 seed_retry_initial_delay_secs: 2.0 seed_retry_max_delay_secs: 30.0 model_request_timeout_secs: 600.0 judge_request_timeout_secs: 300.0 close_request_timeout_secs: 30.0 run_timeout_secs: 1800.0 task: benchmark: visualwebarena task_id: '345' intent: Prepend the country code of South Korea to the phone number of my account profile. start_urls: - http://127.0.0.1:60684/item sites: - shopping input_images: [] runtime_profile: visual_browser observation_profile: screenshot action_profile: computer_use verifier_profile: visualwebarena_classic auth_profile: null seed: 0 task_kwargs: collision_plan: snapshot_adapters: program_html: targets: - key: f91b3a122bf3d4fe target: url: http://127.0.0.1:60684/item locator: document.querySelector('#status').textContent required_contents: exact_match: +82 555-0111 target_overrides: {} shared_state: run_id: 1002579cd734421f8bc5cd4b1299e3c6 epoch: 2 original_metadata: id: semantic-protected-profile-0 ques: Prepend the country code of South Korea to the phone number of my account profile. web: - http://127.0.0.1:60684/item eval: eval_types: - program_html program_html: - url: http://127.0.0.1:60684/item locator: document.querySelector('#status').textContent required_contents: exact_match: +82 555-0111 resource_verifier_config: host: localhost port: 8010 num_workers: 1 uvicorn_reuse_port: null entrypoint: app.py domain: agent name: webarena expose_tools_over_mcp: false session_close_retry_window_seconds: 300.0 max_sessions: 1 artifact_dir: cache/webarena-browser/artifacts inline_screenshots: true max_evidence_screenshots: 200 session_ttl_seconds: 3600 reaper_interval_seconds: 60 browser_session_provider: local_process: {} browser_session_options: {} browser_lease_ttl_seconds: 900 browser_acquire_timeout_seconds: 300.0 browser_release_timeout_seconds: 60.0 browser_heartbeat_interval_seconds: 60.0 browser_heartbeat_timeout_seconds: 30.0 browser_heartbeat_failure_limit: 3 require_auth: false auth_token_env: VISUAL_BROWSER_RESOURCES_TOKEN site_pool_mode: unmanaged max_sessions_per_site: 4 allowed_benchmarks: - webarena - visualwebarena browser_auto_install: true headless: false viewport_width: 1920 viewport_height: 1080 action_delay_seconds: 2.0 default_timeout_ms: 45000 terminate_on_action_error: true max_tool_calls: 8 max_computer_actions: 20 max_scroll_amount: 50 scroll_timeout_seconds: 30.0 action_limits: max_wait_seconds: 30.0 max_step_wait_seconds: null record_video: false browser_channel: null task_image_root: null max_task_image_bytes: 26214400 visualwebarena_require_clean_state: true visualwebarena_state_root: /Users/jepeng/workspace/rl/my-rl/webarena/visualwebarena/runs/2026-11-18-pr2918-review-followup/model-smoke-independent/fixture-state browser: headless: true viewport: - 640 - 480 device_scale_factor: 1 history_bridge: explicit Azure tool acknowledgements; no argument rewriting transport: existing remote credential used in place Complete hard-budget-limit configuration: scope: closed-world protected-state / step-budget smoke; canonical intent retained, fixture URL/evaluator substituted; not canonical task accuracy endpoint: https://inference-api.nvidia.com/v1 model: us/azure/openai/gpt-4.1 tokenizer: provider managed chat_template: provider managed policy_protocol: nano_omni_toolcall tool_parser: parse_nano_omni_tool_calls reasoning_parser: null judge: called: false reason: native exact_match target sampling: temperature: 0 max_output_tokens: 1024 top_p: not sent seed: not sent stop: not sent agent: host: localhost port: 8001 num_workers: null uvicorn_reuse_port: null entrypoint: app.py domain: null name: web_agent session_close_timeout_seconds: 60.0 session_close_retry_window_seconds: 300.0 skip_verification: false skip_verification_reward: 0.0 tool_servers: [] token_id_capture: false tool_accesses: [] resources_server: type: resources_servers name: browser environment_server: null model_server: type: responses_api_models name: policy policy_protocol: nano_omni_toolcall max_steps: 1 max_parse_retries: 0 nano_omni_max_tool_calls: 8 nano_omni_max_computer_actions: 20 nano_omni_max_scroll_amount: 50 nano_omni_retry_invalid_tool_calls: true nano_omni_parse_retry_feedback: false nano_omni_parse_retry_temperature: null nano_omni_parse_retry_delay_secs: 0.0 repeated_action_warning_threshold: 0 repeated_action_window: 5 max_consecutive_execution_failures: 3 model_turn_max_retries: 0 model_retry_delay_secs: 1.0 max_image_history: 3 qwen_fold_size: 10 qwen_history_n: 100 qwen_coordinate_type: relative qwen_thinking: true judge_max_screenshots: 3 task_image_root: null max_task_image_bytes: 26214400 visual_observation_text: full_axtree redact_old_visual_observations: false resources_request_timeout_secs: 180.0 seed_request_timeout_secs: 1800.0 seed_retry_initial_delay_secs: 2.0 seed_retry_max_delay_secs: 30.0 model_request_timeout_secs: 600.0 judge_request_timeout_secs: 300.0 close_request_timeout_secs: 30.0 run_timeout_secs: 1800.0 task: benchmark: visualwebarena task_id: budget-probe intent: Prepend the country code of South Korea to the phone number of my account profile. start_urls: - http://127.0.0.1:60741/item sites: - shopping input_images: [] runtime_profile: visual_browser observation_profile: screenshot action_profile: computer_use verifier_profile: visualwebarena_classic auth_profile: null seed: 0 task_kwargs: collision_plan: snapshot_adapters: program_html: targets: - key: 8296d9e8e5de5518 target: url: http://127.0.0.1:60741/item locator: document.querySelector('#status').textContent required_contents: exact_match: +82 555-0111 target_overrides: {} original_metadata: id: semantic-hard-budget-limit-0 ques: Prepend the country code of South Korea to the phone number of my account profile. web: - http://127.0.0.1:60741/item eval: eval_types: - program_html program_html: - url: http://127.0.0.1:60741/item locator: document.querySelector('#status').textContent required_contents: exact_match: +82 555-0111 resource_verifier_config: host: localhost port: 8010 num_workers: 1 uvicorn_reuse_port: null entrypoint: app.py domain: agent name: webarena expose_tools_over_mcp: false session_close_retry_window_seconds: 300.0 max_sessions: 1 artifact_dir: cache/webarena-browser/artifacts inline_screenshots: true max_evidence_screenshots: 200 session_ttl_seconds: 3600 reaper_interval_seconds: 60 browser_session_provider: local_process: {} browser_session_options: {} browser_lease_ttl_seconds: 900 browser_acquire_timeout_seconds: 300.0 browser_release_timeout_seconds: 60.0 browser_heartbeat_interval_seconds: 60.0 browser_heartbeat_timeout_seconds: 30.0 browser_heartbeat_failure_limit: 3 require_auth: false auth_token_env: VISUAL_BROWSER_RESOURCES_TOKEN site_pool_mode: unmanaged max_sessions_per_site: 4 allowed_benchmarks: - webarena - visualwebarena browser_auto_install: true headless: false viewport_width: 1920 viewport_height: 1080 action_delay_seconds: 2.0 default_timeout_ms: 45000 terminate_on_action_error: true max_tool_calls: 8 max_computer_actions: 20 max_scroll_amount: 50 scroll_timeout_seconds: 30.0 action_limits: max_wait_seconds: 30.0 max_step_wait_seconds: null record_video: false browser_channel: null task_image_root: null max_task_image_bytes: 26214400 visualwebarena_require_clean_state: true visualwebarena_state_root: /Users/jepeng/workspace/rl/my-rl/webarena/visualwebarena/runs/2026-11-18-pr2918-review-followup/model-smoke-independent/fixture-state browser: headless: true viewport: - 640 - 480 device_scale_factor: 1 history_bridge: explicit Azure tool acknowledgements; no argument rewriting transport: existing remote credential used in place Signed-off-by: Jeff Peng <[email protected]>
The real32-instance CPU gate found HTTP500 during seed: the Arena backend factory always constructed a local PyAutoGUI driver, which correctly rejected transport=browser_instance. Use the existing public RemoteWebBackend for that transport and name this same Arena factory as the worker-side composition. The instance then creates the normal local driver and evaluator in the process owning its DISPLAY. Preserve the local lease PID/DISPLAY/transport checks. This uses an API already on main, so NVIDIA-NeMo#2918 remains independent of NVIDIA-NeMo#6325 and NVIDIA-NeMo#6326. The global per-site locks remain in the one resource-server process. Site login, page actions and native VWA evaluation stay in the leased worker; there is no CDP-input fallback and no process-wide DISPLAY mutation. The new factory regression fails twice before the fix and passes after it; the local composition control passes before and after. Focused tests: .venv/bin/python -m pytest resources_servers/webarena_browser/tests/test_pooled_backend.py resources_servers/webarena_browser/tests/test_contract.py tests/unit_tests/web/test_browser_session.py tests/unit_tests/web/test_visual_browser.py -q --no-cov -o log_cli=false --tb=short 82 passed,1 existing optional-environment skip. All-files pre-commit passed following Ruff formatting of the new test. The earlier32-worker readiness was only pool/HTTP readiness, not successful task setup; its failed native seed gate remains archived. GPU allocation and formal benchmark have not started for this correction. Real pooled browser/model qualification will be recorded in the PR once completed; this commit does not claim it already ran. Signed-off-by: Jeff Peng <[email protected]>
laszkiewiczp
left a comment
There was a problem hiding this comment.
Review of #6326 at b38f235: no blocker or major.
Headed pools now let Xvfb pick a free display through -displayfd. An explicit display_base first checks that each display is free. The pipe descriptors close on every path, and the existing rollback stops Xvfb when startup fails. No foreign X11 files are deleted.
For the maintainers: display_base now defaults to None, and no config sets it. So every headed pool, including WebArena and WebVoyager, moves from fixed displays starting at :100 to automatic allocation. That is the point of the fix, but it is a default change in nemo_gym/web.
Checked: test_display_allocation.py and test_browser_instance.py at b38f235, 18 passed and 1 skipped (the real-Xvfb test, because Xvfb is not installed here).
|
/ok to test b38f235 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM. No concerns found.
I reviewed all three changed files and traced the allocator through startup rollback and slot recycling. I also checked that the selected display reaches the browser process and its display-dependent operations.
This was a static review. I did not run tests or independently verify the reported Linux validation.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44508812517 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44530343857 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44537292192 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44538090412 |
|
/ok to test 050b9bc |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44555409034 |
Separate headed browser pools can collide when they derive the same X display. Use Xvfb -displayfd unless a fixed display is explicitly reserved, retaining owned cleanup on startup failure and late completion.
This is independent PR #6326, targeting main. It changes exactly three display implementation/test files and has no dependency on #6325 or #2918. It is extracted in response to #2918 (review); no separate issue is needed. The default affects all shared headed-browser pools, including WebArena and WebVoyager.
Validation:18 standalone tests passed; one native Xvfb case is skipped on macOS. All-files hooks passed. A fresh same-source Linux test on dl345g11-1665 launched two real X servers, verified distinct display allocation/owned cleanup, and passed with0 skips. All three tested files are byte-identical to this independent head. The extended CPU desktop probe is tracked separately; the same implementation previously passed headed Chromium140.0.7339.16, Pillow explicit-display capture, xclip and SSIM admission in the pinned Linux browser image. No new benchmark score is claimed.
Head:
b38f2358131fc3ce4c10c99d575959377306e723.Related VWA main-runtime integration smoke uses the full configurations below. It covers the shared agent/verifier behavior with real GPT-4.1 and headless Chromium; the display allocator itself is covered by the native Linux test above.
Complete independent VWA protected-profile configuration
Complete independent VWA hard-budget-limit configuration