Skip to content

feat(browsecomp): run BrowseComp rows with OpenCode over MCP - #6255

Open
yaoyu-33 wants to merge 3 commits into
mainfrom
claude/browsecomp-harness-neutral
Open

yaoyu-33 wants to merge 3 commits into
mainfrom
claude/browsecomp-harness-neutral

Conversation

@yaoyu-33

Copy link
Copy Markdown
Contributor

What and why

BrowseComp could run only with browsecomp_agent. Three things kept other harnesses out:

  • every row carried responses_create_params.tools, which OpenCode and Pi reject with 422;
  • the Resources Server granted its tools only as direct_http, which OpenCode refuses;
  • allowed_agents named only browsecomp_agent.

This PR follows the GDPVal pattern (benchmarks/gdpval/opencode.yaml): keep single_agent_turn_legacy, serve the Resources Server's tools over MCP, and swap the agent in a pairing config. It was raised as an optional recommendation in the NeMo RL review of #6088. That PR stayed limited to the RL port, so this change is separate. No issue is filed for it.

  • resources_servers/browsecomp_advanced_harness/tool_definitions.py holds the tools as the model sees them. WORKSPACE_TOOLS is moved verbatim from benchmarks/browsecomp/prepare.py (checked equal by AST), so browsecomp_agent's rows do not change. INLINE_TOOLS is the search/browse pair the example rows carry.
  • mcp_tools on the Resources Server advertises those definitions in place of the request models' schemas. The request models also accept max_total_length, which the rows never offer the model. Without a workspace, bash_command has no pages to read, so it is not offered. The search keys stay on the Resources Server. bash_command still runs in the Resources Server's read-only shell sandbox, where the saved pages are.
  • benchmarks/browsecomp/prepare_harness_neutral.py writes the same rows without the tool list. prepare.py gained a tools argument through write_benchmark, and its output is unchanged.
  • benchmarks/browsecomp/opencode.yaml (--benchmark browsecomp/opencode) drops browsecomp_agent and runs opencode_agent (OpenCode 1.17.11). It sets expose_tools_over_mcp: true, resources_tool_transports: [mcp] and allowed_agents: [opencode_agent]. OpenCode runs in a sandbox it creates. Its permission rules are "*": deny plus browsecomp_benchmark_resources_server_*: allow, so the model gets only search, browse and bash_command. OpenCode's own shell and file tools would run in its sandbox, which holds none of the saved pages, and its web tools would skip the domain exclusions. timeout: 3600 matches browsecomp_agent's activation cap.
  • README: a "Run another harness" section with the run command and how the pairing differs from browsecomp_agent.

The base config.yaml and the Resources Server's own example config are unchanged: they still pair browsecomp_agent over direct_http.

Validation

  • gym env validate --config benchmarks/browsecomp/opencode.yaml: valid. The only warning is the unset policy_model_name, which is supplied at run time.
  • gym list benchmarks lists browsecomp/opencode.
  • New tests in resources_servers/browsecomp_advanced_harness/tests/test_mcp_tools.py:
    • MCP tools/list returns exactly the row definitions in workspace and inline mode;
    • an MCP search call runs in the seeded session with the configured budget;
    • the inline definitions equal the example rows' tools.
  • New tests in benchmarks/browsecomp/tests/test_prepare.py: the default rows carry WORKSPACE_TOOLS, and the harness-neutral rows keep the same prompt with no tools key.
  • Reverting the mcp_tools override fails both tools/list cases.
  • browsecomp_advanced_harness and benchmarks/browsecomp tests: 287 passed.
  • Core tests/unit_tests/{environment,config,benchmarks,cli}, tooling/test_add_legacy_agent_environment_servers.py and test_session_contract_repo.py: the same 41 failures and errors as on origin/main in the same venv. They come from missing optional packages in that venv; none are new.
  • pre-commit run on the changed files passes.

Real-model smoke

Setup: a Linux workstation with Docker. benchmarks/browsecomp/opencode.yaml was composed with a scratch overlay that:

  • sets the policy and judge to nvidia/nemotron-3.5-super-vl-120b-a12b on the hosted NVIDIA API;
  • sets search_provider: tavily (no Exa key was at hand);
  • sets agent.build.steps: 25 and timeout: 1800 as a smoke bound;
  • turns on model-call capture.

The run used the first 2 rows from prepare_harness_neutral.py (the seed-42 subset), gym env start and then gym eval run --no-serve --concurrency 1.

Row Ground truth Answer Reward Tool calls
0 Russell David Lyons Russell David Lyons 1.0 10 (search, browse, bash_command)
1 Ethernity Networks Ethernity Networks Ltd 1.0 3 (search)
  • The captured requests offer exactly browsecomp_benchmark_resources_server_{bash_command,browse,search}, with the row descriptions and parameters and none of OpenCode's built-in tools.
  • browse saved pages to the workspace. bash_command read them back in the Resources sandbox, and the guard blocked awk with [exit_code=-3] as it does for browsecomp_agent.
  • Coverage: 2/2 completed and measured, 0 failed. gym eval health-check: 2 healthy, 0 unhealthy, 0 unobserved; 0/15 model responses faulted. Row 1 recorded one HTTP 429 from the shared model key, which the model server retried.
  • Both OpenCode sandboxes and both Resources shell sandboxes were removed, and the per-session workspaces were deleted.
  • scripts/inspect_harness_conformance.py --require-sandbox:
    • TE-1 to TE-5 and TE-7 to TE-9 are fulfilled 2/2.
    • TE-6 is not fulfilled. BrowseComp's /verify does not emit evaluation_completed. That comes from the Resources Server, not the harness, so browsecomp_agent rollouts lack it too. It is left for a separate change.

Compatibility

  • browsecomp_agent runs are unchanged: same rows, same tools, same config.
  • The OpenCode pairing is a different harness, with OpenCode's own system prompt followed by the row's prompt as instructions. It compacts its context instead of using browsecomp_agent's context resets and progress board, so its scores are not comparable to browsecomp_agent's.
  • Docker has no network policy, so the OpenCode sandbox keeps the default network. With OpenSandbox, set network_access: model_and_tools. OpenCode's web and shell tools are denied either way.
  • Harness conformance probes: this PR adds a pairing, not a harness, so they were not rerun.

🤖 Generated with Claude Code

BrowseComp ran only with browsecomp_agent: every row carried a tool list, which
session harnesses such as OpenCode reject, and the Resources Server granted its
tools only over direct HTTP.

- tool_definitions.py holds the model-facing search/browse/bash_command
  definitions (moved verbatim from prepare.py, plus the inline-mode pair the
  example rows carry).
- The Resources Server's mcp_tools advertises those definitions over MCP instead
  of the request models' schemas, and leaves out bash_command without a
  workspace.
- prepare_harness_neutral.py writes the benchmark rows without the tool list.
- benchmarks/browsecomp/opencode.yaml swaps opencode_agent in under
  single_agent_turn_legacy with resources_tool_transports: [mcp], and denies
  OpenCode's own tools so the model gets only the BrowseComp ones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@copy-pr-bot

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

Copy link
Copy Markdown
Contributor Author

/ok to test 491d9a1

@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 16, 2026
@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 16, 2026 23:44

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIP WITH CARE

The restricted-network instructions omit prerequisites needed to start OpenCode. The new pairing also needs a short entry in the Fern benchmark guide.

I inspected all eight changed files and traced dataset preparation, MCP dispatch and Environment Server session wiring. One parallel review report was unavailable, so I independently covered its preparation topic. This was a static review; I did not execute tests or reproduce the reported model-smoke runs.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread benchmarks/browsecomp/README.md Outdated
each episode, from GitHub. Its permission rules deny every tool but the BrowseComp ones: its own shell and file tools
would run in its sandbox, which holds none of the saved pages, and its web tools would skip the domain exclusions.
With Docker the sandbox keeps the default network; with a provider that has network policies, such as OpenSandbox,
set `network_access: model_and_tools` on the agent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK: Document the offline prerequisites before recommending restricted networking.

Switching to OpenSandbox and following this instruction with the shipped python:3.13-slim image prevents episodes from starting. restrict_sandbox_network restricts egress before setup. The installer then downloads OpenCode from GitHub, which that policy blocks. Supplying only the binary is insufficient: the adapter always enables a plugin, and its offline-runtime instructions explain the separate npm dependency bundle.

Could you replace lines 89–90 with the warning below and update the matching config comment? The invariant is that restricted execution must have its bootstrap inputs available without external downloads.

Suggested change
set `network_access: model_and_tools` on the agent.
With Docker the sandbox keeps the default network. Before setting `network_access: model_and_tools` on OpenSandbox,
use an image with the runtime prerequisites and pinned offline runtime bundle, then configure the binary and
plugin-dependency paths and SHA-256 values described in
[OpenCode's offline runtime instructions](../../responses_api_agents/opencode_agent/README.md#pinned-offline-runtime-bundle).
The stock `python:3.13-slim` image needs download access and cannot bootstrap under that restricted policy.

Keep Docker's online-install default unchanged and retain access to both the model and required MCP endpoint under the restricted policy. Proposed acceptance: one episode using OpenSandbox and the documented prepared image completes setup without GitHub/npm egress and successfully calls search; the existing Docker recipe still starts with online installation. These checks were not executed in this review.


The [BrowseComp adapter README](../../responses_api_agents/browsecomp_agent/README.md) documents Evaluation capability, explicit evidence gaps, sandbox ownership and unsupported controls. For a hosted model without `/tokenize`, set `save_model_call_using_vllm_tokenize_endpoint: false` explicitly. The research agent and read-only shell each run in an independently owned sandbox; the Resources Server keeps search credentials and verification on the host.

## Run another harness

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE, suggestion: Expose the pairing from the Fern benchmark guide.

This adds the user-facing --benchmark browsecomp/opencode workflow, but its usage is documented only here. The pinned rubric requires Fern documentation for notable user-facing features. The current benchmark guide mentions BrowseComp without pointing readers to this preset.

Could you add this paragraph after the Agentic / Tool Use overview?

BrowseComp also provides an OpenCode pairing. Prepare it with `gym eval prepare --benchmark browsecomp/opencode`, then follow the [OpenCode run instructions](https://github.com/NVIDIA-NeMo/Gym/blob/main/benchmarks/browsecomp/README.md#run-another-harness). It uses the same tasks and judge, but OpenCode's system prompt and context management differ from `browsecomp_agent`, so the scores measure different harness configurations.

Keep the default BrowseComp recipe and existing MM-BrowseComp guidance intact. Static acceptance: the rendered guide names the new preset, links to its working run instructions and retains that compatibility distinction. I did not build the documentation.

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 needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants