Repository navigation
Conversation
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Contributor
|
🌿 Preview your docs: https://nvidia-preview-codex-opencode-benchmark-workflow.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Signed-off-by: Igor Gitman <[email protected]>
Kipok
marked this pull request as ready for review
September 21, 2026 18:58
Contributor
Author
|
Superseded by #3575, which carries the OpenCode/Pi evaluation workflow and fixes into the dedicated sandboxed adapters. Closing this shared-harness implementation in favor of that PR; please continue review there. |
gwarmstrong
pushed a commit
to gwarmstrong/Gym
that referenced
this pull request
Oct 2, 2026
…IA-NeMo#3575) ## What does this PR do? Run APEX Shortlist and HLE with native OpenCode or Pi inside provider-managed sandboxes, using preinstalled scientific tools and optional Gym-hosted Tavily search. Extends `opencode_sandboxed_agent` and adds `pi_sandboxed_agent`; the existing `harness_agent` is unchanged. This carries the OpenCode/Pi benchmark features and later fixes from NVIDIA-NeMo#3570 into dedicated adapters. No separate issue: this is the architectural alternative discussed during review of that PR, which this PR supersedes. ## Design - Gym provisions, parses, exports, and grades on the host. Native CLIs execute inside the sandbox; no Gym installation, uploaded Gym source, or runtime method replacement is needed there. Pi reuses its existing host adapter's model configuration, response parsing, and observations. - Python-only permits model-host egress; search additionally permits the Gym tool host. Restricted policies require OpenSandbox and fail closed for other providers or resource-owned sandboxes. API credentials stay on the host; MCP uses per-session authentication. These are whole-host allowlists: every port/path on an allowed host is reachable, including colocated Gym APIs. A separately deployed isolated gateway is outside this PR. - Six benchmark presets preserve standard preparation, grading, and answer-format instructions. Native prompt additions describe network availability and preinstalled tools. Defaults: four-hour execution budgets, 262,144-token context, remaining-context output requests, no compaction, OpenCode 400 steps with titles disabled, Pi 120s Bash cap. - Adds reproducible `offline_science_image/` build contexts. Python/Sage Python 3.13.14, Sage 10.8, Lean/Mathlib 4.34.0, and OpenCode 1.17.11 are pinned; a small separate layer adds Node 22.23.2/Pi 0.85.1. OpenCode's plugin dependency is preinstalled. Locks, provenance, and build instructions are included. - Preserves OpenCode native trajectory export, Pi native/timestamped events, generation receipts, failure accounting, and cancellation cleanup. Ports the model streaming and benchmark discovery fixes needed by the workflow. ## Compatibility and behavior changes - Terminal token-limit stops score zero in both benchmark presets, retain the partial answer, and set response status `incomplete` with reason `max_output_tokens`. OpenCode previously graded these partial answers; Pi now enforces this even with observations disabled. General configurations still control zero scoring through `execution_failure_reward_zero`. Sandbox timeouts are recorded as `timeout`, including exit code 124 when no provider error type is present. - Existing OpenCode configuration defaults to inherited networking and runtime installation. Benchmark-only restrictions and zero-reward execution-failure handling are opt-in presets. Native OpenCode overrides are now deep merged. Existing `tools`/`permission` configurations remain accepted; presets use only `permission` to avoid native precedence surprises. - OpenCode transcript export/download failures now propagate instead of yielding an empty or stale result. Setup/export/judge failures stay request failures, including required MCP initialization failures. Explicit completed execution failures may score zero through empty-output verification, retaining native score fields and the original generation. The verifier must score empty output as unmasked zero. This fixes failed attempts disappearing from native APEX symbolic metrics. Use failure sidecars and report missing-row coverage. - Remote benchmark presets now set `use_absolute_ip: true` so Gym actually binds to the advertised host IP. Restricted modes reject loopback/wildcard endpoints instead of rewriting URLs; inherited host-network deployments preserve loopback. Explicit hosts must remain reachable from the sandbox. - Pi sandbox execution uses `/run`; an unseeded `/v1/responses` call is rejected. OpenCode also requires a seeded run when tool servers are configured. Pi's JSONL parser preserves Unicode paragraph separators inside event content. - Pi logs sandbox cleanup exceptions without overwriting a completed grade or masking the original execution/verification error. - OpenCode retains main’s configurable model-call timeout and seeded sandbox working directory; benchmark presets retain their four-hour execution budget. - Tavily now supports key pools, bounded HTTP/connection/timeout retries and page caching, filters requested and returned URLs, and returns source excerpts without aggregate direct answers. Only public HLE exclusions are committed. Invalid keys (401) and exhausted quotas (432/433) fall back to another key within the same HTTP attempt budget; keys rejected in the current call are skipped until the next call. These shared changes need Tavily maintainer review. - Buffered chat streaming preserves early HTTP errors and sends keepalives during long generation; late backend failures become terminal SSE errors with status-bearing messages recognizable by native retry handling. Responses-API streaming behavior is unchanged. ## Validation - Latest scoring/CI follow-up: 342 targeted tests passed, including Vibench, OpenCode/Pi, Tavily, shared verification, and observability. Full pre-commit and diff checks passed. Two hosted-model Docker runs hit a real 32-token output cap; both retained the partial answer, marked it incomplete, and scored zero. Two additional native-agent runs exercised provider timeout handling. All four containers were removed. These fixes did not require rebuilding images; Kubernetes and full benchmarks were not rerun. - After merging main `fd2a1484b`: 172 focused OpenCode/Pi/Tavily/sandbox-tool tests and 440 shared agent/model/sandbox/HTTP/correlation tests passed (14 shared tests skipped), using Python 3.13.14, Tavily 0.7.21, and imports pinned to this checkout. Full `pre-commit run --all-files` and `git diff --check origin/main` passed. - Two fresh hosted-model Docker search rollouts passed verification on the merged code. A synthetic public NASA query exercised actual Tavily HTTP 401 → alternate-key HTTP 200, and an excluded example.com URL was blocked. Pi preserved its grade after an injected cleanup exception following actual container deletion. All test containers were confirmed removed. No new image build, Kubernetes run, or full benchmark rerun was needed for these host-side fixes. - Earlier validation: 415 targeted Python tests and 16 JavaScript tests passed, covering adapters, Tavily policy, streaming/capture, discovery, Bash deadlines, remaining-context requests, and MCP. Python imports were explicitly pinned to this checkout. - All six benchmark configurations resolved and were checked for preparation, prompts, repeats, agent selection, and limits. A fresh isolated Pi installation also verified its sandbox dependencies. - Both images built and were pushed to the deployment registry. Offline scientific computations and interpreter/CLI versions were verified. Real Kubernetes canaries exercised Python, Tavily MCP, URL exclusions, network isolation, transcript export, grading, and sandbox cleanup. - Full APEX and HLE Python/search runs completed for both dedicated adapters. Failed judges were regraded without regenerating policy answers; remaining infrastructure failures and unwritten answers counted as zero. These runs validate the workflow, but do not establish score equivalence for every configuration. Some export failures, sandbox OOMs, and allocation timeouts remain. - Full `pre-commit run --all-files` and `git diff --check` passed. Fern check: zero errors, one redirect-validation warning. Broader global-config testing exposed one unrelated Hydra `LazyCompletionHelp` incompatibility with local Python 3.14; its test and Gym implementation are unchanged from main. The focused host-IP binding test passes. - After the review fixes, four hosted-model Docker rollouts (OpenCode/Pi × Python/search) scored 1.0, with real Tavily calls, HLE URL blocking, native exports, and verified container deletion. Native CLI fault injection showed old OpenCode continuing after MCP failure, the fixed version stopping before inference, and Pi exiting with the setup-failure code. Kubernetes and full benchmarks were not rerun for these fixes. Runtime extensions are uploaded; existing images were reused. - Regression coverage also checks failed APEX attempts in the symbolic denominator, empty-output verifier compatibility, partial Pi capture tails, connection/body retries, and plugins uploaded into resource-owned sandboxes. --------- Signed-off-by: Igor Gitman <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Run APEX Shortlist and HLE through the shared sandbox harness with OpenCode or Pi, using offline scientific tools and optional Gym-hosted Tavily search. Benchmark preparation, answer-format requirements, repeat counts, and verifiers are preserved; HLE's format instructions move into the user message for native harnesses.
No separate issue: this extends the existing shared harness and Tavily resource. The PR remains a draft for design and implementation review.
Compatibility and limits
Existing no-tools benchmark configurations retain their behavior. These changes also affect users outside the new presets:
Search Answeroutput is removed because its source provenance cannot be filtered. Search returns source results only. Requested and returned URLs, including reported extraction redirects, are filtered; finite exclusions cannot guarantee no answer exposure. Invalid policy domains prevent startup with file/domain diagnostics.max_http_attemptsdefaults to 3 total attempts, replacing indefinite 429 retries; delays begin at 1 second and keys rotate. Exhaustion raises a tool-service error.http_timeout_sdefaults to 60 seconds per attempt, andmax_cached_pagesto 128. Zero disables caching and its optional character cap;max_scroll_wordsremains independent. Concurrent cache misses are not coalesced.interleavedvalues now take precedence over the old forced overwrite. The benchmark preset omits the generated setting withinterleaved_reasoning: false. Simultaneous legacytoolsandpermissionare rejected; migrate rules topermission.execution_failure_reward_zero=truerequires invocation observations (Hermes, OpenClaw, OpenCode, Pi); unsupported adapters reject it at startup. Completed empty answers still go to the verifier. Explicit harness failures get zero without verifier-specific fields; setup, runner, export and judge exceptions still propagate.tool_servers, call/run; direct/v1/responsesreturns HTTP 400 before provisioning. OpenCode and Pi are supported. Pi's extension supports Gym's stateless JSON MCP endpoint, not arbitrary transports. The runner rejects non-model URL lookups instead of silently routing them to the model proxy.Model/tool hosts must be reachable from the assigned sandbox cell; loopback rewriting does not create routing. The inference server must support the intended context window and must not impose a smaller output cap. Tool timeouts do not prevent OOMs. Prompt placement, tool access, exclusions and token/timeout policies affect benchmark comparability.
See the harness guide, Tavily guide, and image build instructions.
Validation
pytest -q --tb=short --import-mode=importlib. Covers discovery/benchmark composition, model dispatch and capture, rollout collection/trajectory export, shared harness, Claude Code URL routing, OpenCode/Pi, and Tavily. Seven recent regression cases also fail against their pre-fix snapshot.pre-commit run --all-filesandgit diff --check: passed. Fern validation: zero errors; remote redirect checking skipped because the local CLI is unauthenticated.LazyCompletionHelpincompatibility; it is not included in the passing suite above. Full repository core/server coverage remains pending. All commits have DCO sign-offs.Rollout evidence