Skip to content

feat(web): add fine-grained resource locks, native site replicas, and browser reuse - #6936

Draft
JeffPengCoder wants to merge 8 commits into
NVIDIA-NeMo:mainfrom
JeffPengCoder:feat/web-fine-grained-locks-and-site-replicas
Draft

JeffPengCoder wants to merge 8 commits into
NVIDIA-NeMo:mainfrom
JeffPengCoder:feat/web-fine-grained-locks-and-site-replicas

Conversation

@JeffPengCoder

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #6918 (fix/visualwebarena-scroll-auth-budget). Accelerates WebArena and VisualWebArena evaluation without weakening state isolation by decoupling logical conflict locking, per-replica concurrency caps, horizontal hot-site replicas, and browser process lifecycle:

  1. Fine-grained resource locking & per-site backpressure (nemo_gym/web/site_pool.py, nemo_gym/web/evaluation_collision.py, nemo_gym/web/resource_config.py):
    • derive_resource_site_locks derives conflict-scoped lock keys from collision plans (unifying shopping_orders and /checkout/cart onto shopping:cart, scoping shopping_reviews by SKU, and scoping program_html / page_image_query by target key) instead of serializing an entire site on a single coarse write lock.
    • LocalSiteLockPool enforces independent per-replica max_sessions_by_site and max_writers_by_site concurrency caps with async waiting, plus site-interleaved / lock-bucket-interleaved scheduling in benchmarks/visualwebarena/run.py (--lock-granularity {resource,site}).
  2. Native multi-replica site pool (site_replicas / WA_<SITE>_REPLICAS):
    • LocalSiteLockPool selects the least-loaded conflict-free replica per session (pinning shared_state protected epochs to replica 0), propagates per-session site_url_overrides through SessionManager -> site_auth.py, and binds per-session WA_<SITE> env vars via _scoped_site_env() in resources_servers/webarena_browser/evaluators.py so reference snapshots and evaluators always hit the leased replica.
  3. Browser runtime & evaluator hardening (nemo_gym/web/visual_browser.py, resources_servers/webarena_browser/backend.py, visualwebarena_evaluation.py):
    • Thread-affine reuse_browser_process (persistent Chromium per browser slot with fresh BrowserContext per episode and clean shutdown via close_reusable_browsers).
    • block_external_hosts in WebArenaBrowserDriver aborts unreachable external HTTP/HTTPS requests immediately instead of waiting on OS TCP SYN timeouts (fixing task 643, which previously hung for 108 minutes on dead external links).
    • Best-effort wait_for_load_state("networkidle", timeout=5000) in _after_start_navigation to prevent Magento async header hydration ("Welcome to One Stop Market") from shifting My Account onto Sign Out under high concurrency.
    • Treat missing-DOM TypeError: Cannot read properties of null/undefined inside VisualWebArena lambda: program_html locators (e.g. task 354 on non-product pages) as a valid 0.0 miss instead of raising EvaluatorInfrastructureError.
    • Align benchmarks/webarena/config.yaml with uncapped scroll (max_scroll_amount: null, nano_omni_max_scroll_amount: null) and reuse_browser_process: true.

No separate issue is required; this directly follows up on VisualWebArena/WebArena clean-state evaluation throughput and #6918.

Validation

Local unit tests & pre-commit (run against final commit d8b6725591f8f6f53dc819a29ee2720cbde6b53f)

  • pytest tests/unit_tests/web/ benchmarks/visualwebarena/tests/ benchmarks/webarena/tests/ responses_api_agents/web_agent/tests/ resources_servers/webarena_browser/tests/{test_site_auth,test_shared_state,test_contract,test_pooled_backend}.py: 582 passed, 2 skipped, 0 failed
  • pre-commit run --files <all changed files>: all hooks passed (ruff, ruff-format, guardwords-check, import-linter, update-environment-list)
  • All commits DCO-signed (Signed-off-by).

Real-model rollout evidence (vwa-v10/iter_0001253/mcore_to_hf)

  • Representative 5-task smoke gate (83, 121, 559, 602, 718, H100 + 8x Shopping + 2x Reddit + 2x Classifieds): 4 / 5 (80.0%) (read-only: 3/3 incl. 559, epoch-6: 1/1 task 602 clean reset verified).
  • Full 908-task run (Accel-R1, commit a692e403b, 4x8 H100 TP8, 64 browsers, 8x Shopping + 2x Reddit + 2x Classifieds, max_sessions_by_site: {shopping: 6, reddit: 4, classifieds: 6}):
    • Score: 276 / 908 (30.40%), complete: true, 908/908 valid unique task IDs (+20 tasks / +2.21pp over single-stack Clean-R1 256 / 908 = 28.19%; invalid_tool_arguments: 22 -> 0; Shopping Wishlist recovered from 22/52 (42.3%) to 26/52 (50.0%) by sharding across 8 replicas below Magento's 50-item pagination limit).
    • Wall-clock speedup: 4h 19m end-to-end vs ~20h baseline (4.6x faster overall; mutating wave reduced from ~18-20h -> 105 min, ~11x faster).
  • Follow-up B200 runs (0fa5f5fca / fbe38260d, 4x8 B200 TP8, 64 browsers, 8x/16x Shopping + 4x Reddit + 4x Classifieds):
    • Verified block_external_hosts cut task 643 from 108 min / 99 steps (0.0) to 17 steps (1.0) and cut read-only wall time from 135 min to ~87 min; mutating reached 117 simultaneous fine-grained write locks and completed 397/407 tasks in 75 min (~15x faster than baseline).
    • Uncovered and fixed two real production edge cases captured in commits fbe38260d and d8b672559: (1) task 354 lambda: null-DOM TypeError false infrastructure failure, and (2) Magento async header hydration layout shift under 16x Shopping + 64-browser CPU saturation (login_retry rose 29 -> 274 and My Account shifted onto Sign Out on step 0, causing tasks 338/339/347 to sign out and degrading Shopping accuracy), motivating the networkidle start-page settle and keeping default max_sessions_by_site at the proven {shopping: 6, reddit: 4, classifieds: 6}.

Compatibility & Notes

  • All new features (site_replicas, block_external_hosts, reuse_browser_process, max_writers_by_site, --lock-granularity) remain backward-compatible with single-site deployments and --lock-granularity site.
  • CI classification: Full (touches nemo_gym/web/**, resources_servers/webarena_browser/**, and benchmarks/**). Kept as Draft pending fix(visualwebarena): uncap scroll, verify Reddit auth, and isolate task 602 #6918 merge/rebase and optional re-run on d8b672559.

Generated with Devin

JeffPengCoder and others added 6 commits November 29, 2026 14:42
…sk 602

Align VisualWebArena's runtime profile and clean-state isolation with
failure modes observed in the full 908-task Nano Omni specialist run
(256/908 on Gym 1893b3e):

- Uncap scroll_amount in benchmarks/visualwebarena/config.yaml
  (max_scroll_amount: null and nano_omni_max_scroll_amount: null), which
  routes >50-click scrolls through the existing timeout-bounded scroll
  subprocess, and restore the uncapped schema wording in
  nemo_gym/web/computer_use.py when max_scroll_amount is None. All 22
  invalid_tool_arguments truncations in the 908-task run were caused by
  scroll_amount values of 60, 80, or 100 hitting the default cap of 50.
- Explicitly enable nano_omni_stop_at_step_budget: true in
  benchmarks/visualwebarena/configs/nano_omni.yaml so the Nano Omni
  composition matches the PR NVIDIA-NeMo#6325 empty-answer step-budget contract
  without changing the shared web_agent default.
- Verify Postmill login in resources_servers/webarena_browser/site_auth.py
  (_verify_reddit_login) by loading /messages and confirming the
  authenticated .site-nav username before exposing a task to the policy.
- Move VisualWebArena task 602 (visualwebarena-604, which renames the
  shared Reddit fixture account) into protected clean-state Epoch 6
  alongside disjoint Shopping task 92 (("92", "602")) and observe the
  Reddit baseline profile/messages state in shared_state.py, preventing
  ordinary mutating Reddit tasks from losing authentication without adding
  an extra site reset.
- Document the nine protected tasks, uncapped scroll, step-budget setting,
  and site_pool_mode concurrency trade-off in benchmarks/visualwebarena/README.md.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: Jeff Peng <jepeng@nvidia.com>
…romium reuse

Accelerate stateful WebArena and VisualWebArena rollouts by separating
logical resource-level mutexes, per-site concurrency caps, and horizontal
site-replica pools:

- Extend LocalSiteLockPool (nemo_gym/web/site_pool.py) with optional
  per-site concurrency caps (max_sessions_by_site /
  local_locks_max_sessions_per_site) and multi-replica URL pools
  (site_replicas), balancing ordinary tasks across least-loaded replicas
  while pinning protected clean-state tasks (task_kwargs["shared_state"])
  to replica 0.
- Propagate leased replica URLs through WebSessionManager as immutable
  per-session task_kwargs["site_url_overrides"], consumed by
  resources_servers/webarena_browser/site_auth.py (configured_site_urls)
  so login, start URLs, collision snapshots, and evaluators all bind
  atomically to the leased replica. Also resolve WA_<SITE>_REPLICAS
  environment variables in WebArenaBrowserSessionManager.
- Add derive_resource_site_locks (nemo_gym/web/evaluation_collision.py)
  and --lock-granularity {resource,site} plus LPT priority ordering
  (cross-site -> shopping:orders -> remaining) in
  benchmarks/visualwebarena/run.py so independent writers run concurrently
  while shared carts/orders, same-SKU reviews, and identical fixed-URL
  targets remain serialized per replica.
- Add thread-affine reuse_browser_process option to VisualBrowserDriver
  with shutdown cleanup in browser_instance.py, and enable uncapped
  scroll_amount and browser reuse in VisualWebArena and WebArena configs.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: Jeff Peng <jepeng@nvidia.com>
…unify shopping cart/order locks

Signed-off-by: Jeff Peng <jepeng@nvidia.com>
…te limits, and interleave site queues

Signed-off-by: Jeff Peng <jepeng@nvidia.com>
…ml locators as valid miss

Signed-off-by: Jeff Peng <jepeng@nvidia.com>
…d restore safe per-replica defaults

Signed-off-by: Jeff Peng <jepeng@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 30, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:high Autobot PR risk: high feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 30, 2026
…ture evolution

Signed-off-by: Jeff Peng <jepeng@nvidia.com>
…ermaid diagrams

Signed-off-by: Jeff Peng <jepeng@nvidia.com>

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:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants