Repository navigation
feat(hle_diamond): run opencode_hle_tools on the HLE reference image, upstream fidelity audit, full 1000-row preset - #6362
Conversation
The upstream web-tools preset ran on the offline science image (Python 3.13, SageMath, Lean/Mathlib) and told the model so, while upstream's docs/evaluation-with-tools.md (centerforaisafety/hle 22ed3074) prescribes Python 3.11.16 with the twelve pinned packages and nothing else. The reference image and environment note already existed for opencode_reference.yaml; the two presets were built in parallel and never joined. opencode_hle_tools.yaml now extends opencode_reference.yaml instead of opencode.yaml: it keeps the reference agent (hle_diamond_opencode_reference_agent, reference image, network_access model_and_tools, MCP timeout, address exposure), removes the Tavily resource (`tavily: null`) and swaps in the hle_tools server as the only tool server. The note is the reference note with the two tools named as OpenCode shows them to the model (hle_tools_web_search, hle_tools_web_fetch). Because the agent name is the reference agent's, sandbox_docker_local.yaml now refuses to compose with this preset unless HLE_DIAMOND_ACK_UNRESTRICTED_EGRESS=egress-not-restricted is exported, so a Docker run of the upstream-tools preset can no longer lift the egress policy silently. Tests: the #5176 parity test now holds the agent equal to the reference agent apart from tool_servers and system_prompt and asserts the image and the model-visible tool names; the reference-note (twelve packages, no SageMath/Lean//opt/science/Tavily) and Docker-refusal tests run over both reference-image presets; the Docker override's unconditional-inherit list drops the preset. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…the judge off the sandbox's reach Three fidelity gaps against hle_eval/run_judge_results.py and section 1 of docs/evaluation-with-tools.md (centerforaisafety/hle 22ed3074), on the opencode_hle_tools preset: - [question]: upstream's judge sees question['question']; here the judge read the whole last user message, which on the opencode prompt is the question plus the folded answer-format instruction. The preset sets question_extract_regex to cut the instruction off (first capture group); a bare question, as the default prompt sends it, matches nothing and passes through unchanged. - Judge output: upstream caps the judge at max_completion_tokens=4096; the preset's judge call now carries max_output_tokens: 4096. A verdict cut off by the cap scores 0 as no_verdict, as it would upstream. - Reach: absolute_ip_server_types moves every Resources server to the routable address so the sandbox can reach hle_tools, and the egress policy opens each allowed host on every port, so the judge resources server (and with judge_openai.yaml the o3-mini judge model) was reachable from the sandbox. A server's own host wins over the type-scoped address (TestAbsoluteIpServerTypes), so both pin host: 127.0.0.1; only the judge resources server calls the judge model, from the same host. The sandbox now reaches exactly the model server and hle_tools. Tests: a full (non-offline) parse of the preset with judge_openai.yaml, hostname resolution patched, asserts the per-server hosts; the judge test renders both prompt files and asserts the extracted question, the cap and that the other presets keep the judge's defaults. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…lts at WARNING, bound the cap Three section-3 gaps against docs/evaluation-with-tools.md (centerforaisafety/hle 22ed3074): - Oversized pages. The protocol caps web_fetch at 60,000 characters with a truncation indicator and checks "the title and Markdown" of the response; it never refuses a page for its length. The server checked the provider's whole page before the cut and refused anything over max_page_chars (1,000,000) unread as the Gym-only family oversized_page, so long PDFs came back refused where upstream serves their start. The page is now sanitized, cut at max_fetch_chars and checked as served, title included, fresh and from the cache; the cut is what the cache holds. That bounds the content scan at the cap (0.25 s for 60,000 adversarial characters, measured) without a size refusal, so max_page_chars, oversized_page and the now-moot max_cached_page_chars are removed. The page-check pool stays: the scan still holds the GIL for its whole run. - Audit log. "Log blocked calls and the matching rule" held for refusals (WARNING) but dropped search results went out at INFO, which Gym's server processes never emit (no root logger is configured outside --verbose). Dropped results are logged at WARNING too, same line shape. - Cap bound. max_fetch_chars accepted any value above the protocol's 60,000; it is now bounded le=60,000, as max_results already was. Tests, written first and failing on the old code: the domains test reads the dropped-result lines at WARNING and asserts their level; a 1.5 M-char page is served cut with the indicator, a blocked span inside the served Markdown or in the title refuses, the cached cut page is rechecked; the cap above 60,000 is rejected. The event-loop stall test's gap bound drops to 0.1 s, under the bounded scan, and was checked to fail with the page check run inline. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ream 22ed3074 The Upstream web tools section of the Diamond README now describes the preset as it is (opencode_reference's agent, image and egress with the Tavily tools replaced by hle_web_tools) and replaces its departures list with a fidelity table: one row per requirement of docs/evaluation-with-tools.md sections 1 to 4 and of hle_eval/ at centerforaisafety/hle 22ed3074, each marked matched or cannot match with where and why, plus a harness mapping for section 4 (Claude Code, Codex CLI, Gemini CLI, Muse Code against the agents Gym has). The two residuals (Tavily backend, unauthenticated seed, Gym#5845) stay; the oversized-page residual is gone with the server change. The documented run line adds ++count_missing_rollouts_as_zero=true (upstream's denominator) and the OpenSandbox dns+nft preflight is stated. The preset still has no with-tools number: the one pilot ran the previous harness on the science image with open egress. Scope row, the sandboxed-agents departures list, the Reference preset paragraph (the follow-up is done), the Docker-override refusal note and the Scoring judge-request paragraph (this preset's cap and bare-question regex) follow. The reference image README names both presets and says that pip is neutralised by the network policy, not removed. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…age rows included The published HLE-Diamond with-tools numbers divide by all 1000 questions; the agent-session presets ran only the 728 text rows, so no comparable denominator existed. opencode_hle_tools_full composes opencode_hle_tools and swaps only the reference agent's dataset for the full set that prepare_opencode_legacy.py writes (one user message with the folded HLE instruction and, on the 272 image rows, an input_image block). The opencode_agent session stages each image into the sandbox and attaches it with `opencode run --file`; the dataset's `detail: high` is never read, so the request carries image_url with no detail, as upstream's does. Same agent, image, tool server, egress policy, note and judge; a test holds the two compositions equal apart from the dataset. Docs follow: preset table and coverage paragraph, fidelity row for the 1000/272 requirement (harness analogue: OpenCode's Read tool places two synthetic text parts and the image ahead of the question), prepare docstrings, the Docker override's header (three reference-image presets), and the removal of "no session preset covers the image rows yet" everywhere it appeared. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…_tools over all 1000 questions GPT-6 Astra, reasoning high, judge o3-mini, local Docker with open egress (comparison infrastructure only): 624/728 = 85.7 % on the text rows, 203/272 = 74.6 % on the image rows through the same composition with the dataset swapped (what opencode_hle_tools_full declares), 827/1000 = 82.7 % composed against the published 82.9 %. Every first policy call of the 272 image rows carried the image as a data URI with no detail. Replaces the "unrun / no run exists yet" wording of the README and the preset header; the OpenSandbox gate stays open. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
The judge changes need a controlled before/after score comparison. I also found one documented override that still targets the tools preset's former agent.
I inspected all 16 changed files and traced the affected configuration, dataset/media and web-fetch paths. This was a source-only review; I did not execute tests or verify live OpenSandbox behavior. I inspected the web-tool changes directly because that separate review report was unavailable.
Inline comments (escaped v1):
-
benchmarks/hle_diamond/opencode_hle_tools.yamlline 59: RISK: Add a controlled before/after comparison for the judge changesThese settings change scoring for every with-tools row: the judge now receives the bare question and has a 4,096-token output cap. The documented earlier judge sweep used an uncapped judge, while the new pilot reports only the new composition. Neither isolates whether this fixed benchmark's reward distribution shifted unintentionally. The pinned review rubric requires that comparison for verifier/reward changes.
Could you regrade the same frozen completions and row IDs with the base and head judge settings, using the same judge model? Record evaluated counts, both
mean/rewardvalues, partition scores and parsing/truncation counts, then inspect and explain changed verdicts. This is a validation gap, not a demonstrated incorrect grade.Keep the intended bare-question extraction and 4,096-token cap. Retain the assertions in the judge-config test: folded, bare and multimodal prompts extract the same question, while the reference preset stays uncapped. Acceptance is a paired comparison with scoring changes accounted for, not identical accuracy at any cost. I could not execute that comparison here.
-
benchmarks/hle_diamond/README.mdline 441: NOTE: Update the override target for both tools presetsThe compaction and step-limit commands above target
hle_diamond_opencode_agentand name onlyopencode_referenceas the exception. This PR moves the tools preset tohle_diamond_opencode_reference_agent, which the full preset also uses. Following these instructions for either tools preset therefore does not change the running session's controls.Suggested replacement for this line:
(`hle_diamond_opencode_reference_agent` on `opencode_reference`, `opencode_hle_tools` and `opencode_hle_tools_full`). Either can move scores. TheKeep
hle_diamond_opencode_agentforopencodeandopencode_search. Proposed acceptance: resolve each preset with the documented compaction and step overrides and assertcompaction.auto: falseandagent.build.steps: 400on its active agent. Check both receiver groups rather than replacing the agent name globally. This suggestion is based on source inspection, not an executed check.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
…verride target Address review on #6362. Record a paired regrade of the 2026-11-18 pilot's 1,000 saved rollouts (gym eval reverify, same completions, same judge) under this preset's judge settings and the earlier ones. Earlier settings: 824/1000 with 18 no_verdict calls where the judge copied the folded answer-format instruction, 6 of them on answers it called correct. This preset's settings: 826 and 827 over two passes, 0 no_verdict, no call near the 4096-token cap. The compaction and step-limit overrides named the wrong agent for opencode_hle_tools and opencode_hle_tools_full, which run hle_diamond_opencode_reference_agent. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Both review points are addressed in 5d1b780. Judge changes: paired before/after comparison. I regraded the pilot's 1,000 saved rollouts with
Each pass made 999 judge calls; one row has an empty final answer and scores 0 without a call.
The README records this under "Judge settings, paired regrade, 2026-11-18". The judge-config test assertions are unchanged. Override target. Fixed as suggested: the README now names One thing outside this PR: every other OpenCode and Pi preset leaves 🤖 Generated with Claude Code |
…mes do not name the benchmark Review on #6362: OpenCode shows MCP tools as <server>_<tool>, so the model saw hle_tools_web_search and hle_tools_web_fetch. The server instance is now web_tools (web_tools_web_search, web_tools_web_fetch), and the refusal text returned to the model no longer says "HLE". The 2026-11-18 pilot ran under the old names and was not rerun; the README says so. A one-row run after the rename offered the new names in every policy request, with no "hle" string in any of them. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
/ok to test 20eb332 |
|
Reviewing |
| | §2 (implicit) The model is told nothing beyond what the harness says | cannot match exactly | A two-sentence environment note is appended to OpenCode's instructions: internet disabled, the two tools by the names OpenCode shows (`web_tools_web_search`, `web_tools_web_fetch`), Python 3.11 and the twelve packages. It names nothing the image lacks (tested); state it next to every number. | | ||
| | §3 Expose only `web_search(query)` and `web_fetch(url)` | matched | The MCP token lists exactly the two; the server refuses to start with any other set. OpenCode shows them as `<grant>_<tool>` (`web_tools_web_search`, `web_tools_web_fetch`); upstream states no naming requirement for its wrapper. | | ||
| | §3 `web_search`: URLs, titles, snippets; at most 20 results per call before filtering | matched | Tavily `/search` with `max_results` 20 (bounded `le=20`), no answer, no page bodies, no images; survivors at most 20. | | ||
| | §3 `web_fetch`: main content of a page or PDF as Markdown, capped at 60,000 characters with a truncation indicator; no image, audio or video payloads | matched | Tavily `/extract` in Markdown; cut at 60,000 with `[Content truncated at 60,000 characters; N characters omitted]`; a page of any length is served cut (no size refusal); `data:` URIs removed, `include_images: false`; `max_fetch_chars` cannot exceed 60,000. Unverified: PDF rendering is Tavily's and no live PDF fetch is recorded. | |
There was a problem hiding this comment.
Non-blocking: every page cut at 60,000 characters reaches the model as an empty preview, not as the page.
Gym sends each web_fetch reply as a JSON object (MCP structured content, mcp_auto_exposure.py#L786-L800), and OpenCode 1.17.11 turns that object into one line of JSON (catalog.ts#L75-L79). OpenCode keeps only whole lines up to 50 KiB (truncate.ts#L102-L111), and every cut page is longer than that. So the model gets an empty preview and the path of a saved file. Read and Grep show only the first 2,000 characters of that one-line file. Could you relabel the row, and say how many pilot fetches hit this?
| | §3 `web_fetch`: main content of a page or PDF as Markdown, capped at 60,000 characters with a truncation indicator; no image, audio or video payloads | matched | Tavily `/extract` in Markdown; cut at 60,000 with `[Content truncated at 60,000 characters; N characters omitted]`; a page of any length is served cut (no size refusal); `data:` URIs removed, `include_images: false`; `max_fetch_chars` cannot exceed 60,000. Unverified: PDF rendering is Tavily's and no live PDF fetch is recorded. | | |
| | §3 `web_fetch`: main content of a page or PDF as Markdown, capped at 60,000 characters with a truncation indicator; no image, audio or video payloads | matched (server) / harness analogue (what the model sees) | Tavily `/extract` in Markdown; cut at 60,000 with `[Content truncated at 60,000 characters; N characters omitted]`; a page of any length is served cut (no size refusal); `data:` URIs removed, `include_images: false`; `max_fetch_chars` cannot exceed 60,000. Unverified: PDF rendering is Tavily's and no live PDF fetch is recorded. OpenCode 1.17.11 receives the reply as one line of JSON (MCP structured content) and shows the model an empty preview for any reply over 50 KiB, so every cut page stays in a saved file, of which Read and Grep show the first 2,000 characters. | |
There was a problem hiding this comment.
Confirmed and relabelled in 865b54b. The mechanism holds end to end at OpenCode 1.17.11, and it is wider than cut pages: any reply over 50 KiB is hidden, including uncut pages above about 51,000 bytes.
Pilot counts, from the saved tool outputs: 356 of 2,115 web_fetch replies, in 210 rows, reached the model as an empty preview and a file path. That is every page the server cut at 60,000 characters and at least 46 shorter ones. The model recovered more than the first 2,000 characters of 39 of them, through bash. 52 of 7,521 web_search replies in 26 rows were hidden the same way, so I relabelled that row too. Rows with a hidden fetch scored 166/210 against 661/790 for the rest.
I only documented it here. Returning the reply as plain text, or raising OpenCode's tool_output.max_bytes, would fix what the model sees but changes behaviour relative to the pilot, so I left that as a separate decision.
🤖 Generated with Claude Code
| | Judge call: `max_completion_tokens=4096`, one user message, no system message; `[question]` is `question['question']` | matched (this preset) | `judge_responses_create_params.max_output_tokens: 4096`, `judge_system_message: ""`, and `question_extract_regex` cuts the folded instruction so the judge sees the bare question. A verdict cut off by the cap scores 0 as `no_verdict`, as upstream. | | ||
| | `[response]` is the model's whole completion | harness analogue | The last assistant message of the OpenCode session (upstream does not say what text was judged for the CLI harnesses). | | ||
| | Confidence extracted by the judge; calibration error reported | cannot match | Not computed; `reward` is the accuracy only. | | ||
| | Accuracy over every question (`n` = all rows; a failed call counts as wrong); Wald 95 % half-width | matched (denominator) / own interval | The documented run line passes `++count_missing_rollouts_as_zero=true` (add `'++count_failure_classes_as_zero=[agent_run_error]'` with `++route_failures_to_sidecar=true`) and reports `coverage/imputed`; Gym's reward profile emits its own confidence interval, not upstream's Wald half-width. | |
There was a problem hiding this comment.
Non-blocking: with the documented flags, a failed row is left out of mean/reward instead of counting as wrong.
count_missing_rollouts_as_zero skips any rollout whose latest attempt failed (rollout_collection.py#L1609-L1611). A failed agent-session rollout's failure class is the agent's failure kind or environment_server_failed (single_agent_turn_legacy/app.py#L121), never agent_run_error. So the row's count_failure_classes_as_zero=[agent_run_error] counts none of them either. Upstream counts those rows as wrong, while here each one raises the reported accuracy. The same wording is at L1121-L1123.
| | Accuracy over every question (`n` = all rows; a failed call counts as wrong); Wald 95 % half-width | matched (denominator) / own interval | The documented run line passes `++count_missing_rollouts_as_zero=true` (add `'++count_failure_classes_as_zero=[agent_run_error]'` with `++route_failures_to_sidecar=true`) and reports `coverage/imputed`; Gym's reward profile emits its own confidence interval, not upstream's Wald half-width. | | |
| | Accuracy over every question (`n` = all rows; a failed call counts as wrong); Wald 95 % half-width | matched when every row is scored / own interval | Upstream reruns failed calls and divides by all questions; here resume the run until every row is scored and report `coverage/scored` / 1000. `++count_missing_rollouts_as_zero=true` imputes only rollouts that left no row: a failed session rollout is a failures-sidecar row (`environment_server_failed` or the agent's failure kind, never `agent_run_error`), stays out of `mean/reward` and shows under `coverage/failed/<class>`. Gym's reward profile emits its own confidence interval, not upstream's Wald half-width. | |
There was a problem hiding this comment.
Confirmed, and the row is changed as suggested in 865b54b (with "not agent_run_error"). The same claim was in two more places, the Agent session paragraph and the Scoring coverage bullet, and both are corrected. The pilot number was not affected: both runs ended with 0 failed and 0 imputed, after one --resume for the image row whose OpenCode process exited.
🤖 Generated with Claude Code
| `hle_tools_web_search` and `hle_tools_web_fetch` plus OpenCode's native tools, no other web tool; the | ||
| reference note was in every request, SageMath, Lean and `/opt/science` in none. 48 of the 1,000 rows end |
There was a problem hiding this comment.
Non-blocking: the 82.7 % pilot told the model its internet access was not restricted, and bash could reach the web.
The pilot's note came from sandbox_docker_local.yaml: "Direct internet access from this machine is NOT restricted" (sandbox_docker_local.yaml#L125-L127). Earlier pilots used requests in bash to fetch blocked hosts (L986-L990), so a row could have used the web without the two tools. The pilot also used 2,400 s and 120 steps per row instead of this preset's settings, so "as it now is" (L1249) overstates it. Could you add how many rows made HTTP calls from bash, and how many reached blocked hosts?
| `hle_tools_web_search` and `hle_tools_web_fetch` plus OpenCode's native tools, no other web tool; the | |
| reference note was in every request, SageMath, Lean and `/opt/science` in none. 48 of the 1,000 rows end | |
| `hle_tools_web_search` and `hle_tools_web_fetch` plus OpenCode's native tools (bash included, with `requests` | |
| and open egress, so a row could reach the web without the tools; not audited); every request carried the | |
| local-Docker note, which tells the model internet access is NOT restricted, and SageMath, Lean and | |
| `/opt/science` were in none. 48 of the 1,000 rows end |
There was a problem hiding this comment.
Confirmed on every point, fixed in 865b54b. All 7,164 agent turns carried the local-Docker note, not the preset's own, and "as it now is" is replaced by the two actual differences (the note, and 2,400 s with 120 steps against 14,400 s and no step cap).
I ran two independent audits of the saved tool calls, then a third pass over the raw commands. The pilot is not a result of the two tools alone:
- 134 to 137 of 1,000 rows attempted a network call from
bash. - 102 rows fetched web content directly with
requestsorurllib. They scored 68/102 against 759/898 for the rest. - 57 rows installed packages with
piporapt. - 10 rows fetched a chess engine, one GNU Go and one a Lean toolchain.
- At least 12 rows reached blocklisted hosts, all
github.comorgithubusercontent.com(engine releases, word lists, fonts, one README, and the Lean archive through a redirect). No URL or command matched a benchmark-leak rule. Redirects were not otherwise tracked, so 12 is a lower bound.
The README now states this next to the number, in a paragraph titled "What the open egress let through".
🤖 Generated with Claude Code
| # Loopback even where absolute_ip_server_types moves the model servers to the routable address (the | ||
| # sandboxed presets): only the judge resources server calls this model, from the same host, and the | ||
| # sandbox must not reach a second model endpoint. |
There was a problem hiding this comment.
Non-blocking: on the other sandboxed presets, the sandbox can still reach the judge model through the judge resources server.
With this file composed, opencode_reference, opencode_search, pi_search, both full presets and the legacy-agent presets leave the judge resources server on the routable address. Its /verify returns the judge model's whole reply (app.py#L270, #L293), so the sandbox still reaches a second model endpoint there. Pinning the judge resources server once in config.yaml covers every preset; test_hle_diamond.py still passes (117). The file is outside the diff, so here is a plain block:
# benchmarks/hle_diamond/config.yaml
hle_diamond_equivalence_llm_judge_resources_server:
resources_servers:
equivalence_llm_judge:
host: 127.0.0.1There was a problem hiding this comment.
Applied in 865b54b: config.yaml pins the judge resources server to loopback for every preset, and the now redundant pin in opencode_hle_tools.yaml is removed. I composed every preset under benchmarks/hle_diamond with and without judge_openai.yaml, sandbox_docker_local.yaml and an explicit default_host; the judge resources server is on loopback in all of them and nothing that calls it is off-host. One caveat I did not change: on the full and legacy-agent presets the head, Environment Server and agent server still take the routable address, so this covers the judge server only.
🤖 Generated with Claude Code
| question_extract_regex: '^(.*?)\n\nYour response should be in the following format:' | ||
| judge_responses_create_params: | ||
| input: [] | ||
| max_output_tokens: 4096 |
There was a problem hiding this comment.
Non-blocking: with an explicit default_host, the sandbox can also reach the Environment Server.
An explicit default_host applies to every server without its own host (global_config.py#L1864-L1867). Gym's own error for a hostname that resolves to loopback tells users to set it (#L1848-L1851). With default_host=10.1.2.3, the Environment Server, whose /run starts episodes, moves to that address. That breaks the claim at L49-L51 that the sandbox reaches only the model server and web_tools. Pinning its host here keeps the claim with or without default_host; test_hle_diamond.py still passes (117).
| max_output_tokens: 4096 | |
| max_output_tokens: 4096 | |
| # The Environment Server stays on loopback too: an explicit default_host moves every server that sets no host of | |
| # its own to that address, and the sandbox must reach only the model server and web_tools. | |
| hle_diamond_equivalence_llm_judge_environment_server: | |
| environment_servers: | |
| single_agent_turn_legacy: | |
| host: 127.0.0.1 |
There was a problem hiding this comment.
Applied as suggested in 865b54b. With default_host set, the routable servers on this preset are now exactly the model server and web_tools. The pin is on this preset only: the other session presets still move the Environment Server under an explicit default_host. I did not move the pin into config.yaml, since that would also change the default non-sandboxed preset.
🤖 Generated with Claude Code
| | `run_model_predictions.py`: `SYSTEM_PROMPT` verbatim | matched (text) / cannot match (placement) | The text is byte-exact (tested). Upstream sends it as the system message with the bare question as the user message; here it follows the question in one user message behind OpenCode's native prompt. Upstream's with-tools runs went through vendor CLIs whose prompt delivery is undocumented, so no placement is provably theirs; this one is stated. | | ||
| | `run_judge_results.py`: `JUDGE_PROMPT`, structured `correct: yes\|no` | matched (criteria) / cannot match (parse) | `benchmarks/hle/prompts/judge.txt` carries the same criteria with three label renames (`Judgement:`, `Reasoning:`, `Confidence:`), upstream's `0|\%|` / `100|\%|` spelled `0%` / `100%`, and one blank line fewer; the verdict is the last `Judgement: yes\|no` label in free text, case-insensitive, not a schema-enforced field. | | ||
| | Judge model `o3-mini-2025-01-31` | cannot match (snapshot) | Compose `judge_openai.yaml` (every documented run line does); `HLE_DIAMOND_JUDGE_MODEL` defaults to the gateway alias `azure/openai/o3-mini`, whose served snapshot is neither pinned nor echoed. Record alias and run date. Without the override the policy grades itself. | | ||
| | Judge call: `max_completion_tokens=4096`, one user message, no system message; `[question]` is `question['question']` | matched (this preset) | `judge_responses_create_params.max_output_tokens: 4096`, `judge_system_message: ""`, and `question_extract_regex` cuts the folded instruction so the judge sees the bare question. A verdict cut off by the cap scores 0 as `no_verdict`, as upstream. | |
There was a problem hiding this comment.
Non-blocking: a cut-off judge reply is scored here, while upstream leaves the row unjudged until a rerun.
Upstream's parse into a fixed schema raises an error when the reply stops at the token limit, and its script then asks for a judge rerun (run_judge_results.py#L62-L64, #L138). Here the reply is not retried: with no label it scores 0 (unparseable_judge_output when the cut falls in the reasoning), and a label written before the cut counts. The same wording is at opencode_hle_tools.yaml L47-L48.
| | Judge call: `max_completion_tokens=4096`, one user message, no system message; `[question]` is `question['question']` | matched (this preset) | `judge_responses_create_params.max_output_tokens: 4096`, `judge_system_message: ""`, and `question_extract_regex` cuts the folded instruction so the judge sees the bare question. A verdict cut off by the cap scores 0 as `no_verdict`, as upstream. | | |
| | Judge call: `max_completion_tokens=4096`, one user message, no system message; `[question]` is `question['question']` | matched (this preset) | `judge_responses_create_params.max_output_tokens: 4096`, `judge_system_message: ""`, and `question_extract_regex` cuts the folded instruction so the judge sees the bare question. A reply cut off by the cap is not retried: with no label it scores 0 (`truncated_judge_output`, plus `no_verdict`, or `unparseable_judge_output` when the cut falls in the reasoning), and a label written before the cut counts. Upstream's structured parse raises on a length finish, so the row stays unjudged (wrong in that pass) until the judge is rerun. | |
There was a problem hiding this comment.
Confirmed against app.py and upstream's script, and the row is changed as suggested in 865b54b. The same wording in opencode_hle_tools.yaml and in the regrade paragraph is corrected too. No judge call in the pilot or the regrade ended incomplete under the cap.
🤖 Generated with Claude Code
| | HLE-Diamond: 1,000 questions, 272 with an image | harness analogue (`opencode_hle_tools_full`, run 2026-11-18 on local Docker) / cannot match (`opencode_hle_tools`) | `opencode_hle_tools_full` runs all 1000 rows on this agent with the dataset's bytes and no `detail`, but not with upstream's `[text, image_url]` content: OpenCode routes the staged file through its Read tool, so the model's first message carries two synthetic text parts, the image and the staged path ahead of the question text (Image questions through OpenCode). A vision-capable policy model is required. `opencode_hle_tools` runs the 728 text rows: report 728/1000 next to every number from it. | | ||
| | No temperature sent | matched | The preset and its chain set none; OpenCode forwards one only when the request carries it. On `vllm_model`, confirm `sampling_overrides` carry none. | | ||
| | Output budget (no with-tools figure; `>= 8192` recommended for reasoning models) | matched where stated | 32,768 output tokens per call in a 229,376 context, 14,400 s run budget, OpenCode's default step cap and compaction. | | ||
| | "All models are evaluated with reasoning high" | matched (OpenAI-style) / cannot assert (Claude via gateway) | `++policy_model.responses_api_models.<model>.extra_body.reasoning_effort=high` on the run line, verified in the model-call capture; Claude models through this gateway ignore the parameter. | |
There was a problem hiding this comment.
Non-blocking: on session presets, the model-call capture can't show this effort.
The capture records OpenCode's request before the model server adds extra_body, as README.md#L748-L752 already says, so it shows no effort even when one is sent. The resolved config is the place to check it.
| | "All models are evaluated with reasoning high" | matched (OpenAI-style) / cannot assert (Claude via gateway) | `++policy_model.responses_api_models.<model>.extra_body.reasoning_effort=high` on the run line, verified in the model-call capture; Claude models through this gateway ignore the parameter. | | |
| | "All models are evaluated with reasoning high" | matched (OpenAI-style) / cannot assert (Claude via gateway) | `++policy_model.responses_api_models.<model>.extra_body.reasoning_effort=high` on the run line; check it in `rollouts_resolved_config.yaml`, not in the model-call capture, which records OpenCode's request before the model server adds `extra_body` (Reading sandboxed results > Confirm effort); Claude models through this gateway ignore the parameter. | |
There was a problem hiding this comment.
Applied in 865b54b. I wrote the file as the run's *_resolved_config.yaml, since the name follows the output stem.
🤖 Generated with Claude Code
| and "blocked pattern" in refused.text | ||
| and "https://example.com/inside" not in server._page_cache | ||
| ) | ||
| stub_backend(server, page="# HLE answers\n\n" + "z" * 70_000) | ||
| assert (await fetch(server, "https://example.com/title")).refused # the title is checked whatever the length | ||
| # The cut page is what the cache holds and what the cache-hit recheck sees. | ||
| backend = stub_backend(server, page="w" * 70_000) | ||
| first = await fetch(server, "https://example.com/cached") | ||
| second = await fetch(server, "https://example.com/cached") | ||
| assert backend.extract.await_count == 1 and first.text == second.text and second.truncated | ||
| server._blocklist.patterns_case_sensitive.append(re.compile(r"w{60000}")) | ||
| assert (await fetch(server, "https://example.com/cached")).refused |
There was a problem hiding this comment.
Non-blocking: three behaviors in this test can break without failing it.
Removing the title check, caching the uncut page, or putting "HLE" back in the refusal text each leaves the file at 111 passed. The page in the current title assertion starts with # HLE answers, so the Markdown check refuses it anyway, and w{60000} matches the cut and the uncut page alike. This version fails on each of those, and passes as is and with the build_page change suggested in app.py.
| and "blocked pattern" in refused.text | |
| and "https://example.com/inside" not in server._page_cache | |
| ) | |
| stub_backend(server, page="# HLE answers\n\n" + "z" * 70_000) | |
| assert (await fetch(server, "https://example.com/title")).refused # the title is checked whatever the length | |
| # The cut page is what the cache holds and what the cache-hit recheck sees. | |
| backend = stub_backend(server, page="w" * 70_000) | |
| first = await fetch(server, "https://example.com/cached") | |
| second = await fetch(server, "https://example.com/cached") | |
| assert backend.extract.await_count == 1 and first.text == second.text and second.truncated | |
| server._blocklist.patterns_case_sensitive.append(re.compile(r"w{60000}")) | |
| assert (await fetch(server, "https://example.com/cached")).refused | |
| and "blocked pattern" in refused.text | |
| and "HLE" not in refused.text # the model is not told the benchmark's name | |
| and "https://example.com/inside" not in server._page_cache | |
| ) | |
| # The provider's title is checked on its own: it refuses a page whose served Markdown is clean. | |
| titled = {"url": "https://example.com/title", "title": "HLE answers", "raw_content": "z" * 70_000} | |
| stub_backend(server).extract = AsyncMock(return_value={"results": [titled]}) | |
| assert (await fetch(server, "https://example.com/title")).refused | |
| # The cut page is what the cache holds and what the cache-hit recheck sees. | |
| backend = stub_backend(server, page="w" * 70_000) | |
| first = await fetch(server, "https://example.com/cached") | |
| second = await fetch(server, "https://example.com/cached") | |
| assert backend.extract.await_count == 1 and first.text == second.text and second.truncated | |
| server._blocklist.patterns_case_sensitive.append(re.compile(r"w{60001}")) | |
| assert (await fetch(server, "https://example.com/cached")).text == first.text # past the cut: never served | |
| server._blocklist.patterns_case_sensitive.append(re.compile(r"w{60000}")) | |
| assert (await fetch(server, "https://example.com/cached")).refused |
There was a problem hiding this comment.
Adopted as written in 865b54b. I confirmed each of the three mutations passes the old test and fails this one.
🤖 Generated with Claude Code
| def test_the_fetch_cap_cannot_exceed_the_protocols(): | ||
| """max_fetch_chars is a deployment knob below the protocol's 60,000, never above it (as max_results is).""" | ||
| assert make_server(max_fetch_chars=1_000).config.max_fetch_chars == 1_000 | ||
| with pytest.raises(ValidationError): | ||
| make_server(max_fetch_chars=module.PROTOCOL_MAX_FETCH_CHARS + 1) |
There was a problem hiding this comment.
Non-blocking: no test serves a page under a lowered max_fetch_chars.
The cap now travels into the page-check worker, but a server that cut at 60,000 regardless would still pass all 111 tests. This version fails on that, and when the le= bound is missing.
| def test_the_fetch_cap_cannot_exceed_the_protocols(): | |
| """max_fetch_chars is a deployment knob below the protocol's 60,000, never above it (as max_results is).""" | |
| assert make_server(max_fetch_chars=1_000).config.max_fetch_chars == 1_000 | |
| with pytest.raises(ValidationError): | |
| make_server(max_fetch_chars=module.PROTOCOL_MAX_FETCH_CHARS + 1) | |
| async def test_the_fetch_cap_cannot_exceed_the_protocols(): | |
| """max_fetch_chars is a deployment knob below the protocol's 60,000, never above it (as max_results is).""" | |
| lowered = make_server(max_fetch_chars=1_000) | |
| stub_backend(lowered, page="x" * 1_500) | |
| served = await fetch(lowered, "https://example.com/long") | |
| assert served.truncated and "x" * 1_000 in served.text and "x" * 1_001 not in served.text | |
| assert served.text.endswith("[Content truncated at 1,000 characters; 500 characters omitted]") | |
| with pytest.raises(ValidationError): | |
| make_server(max_fetch_chars=module.PROTOCOL_MAX_FETCH_CHARS + 1) |
There was a problem hiding this comment.
Adopted as written in 865b54b. The lowered cap being honoured in the cut and in the marker was untested, as you say. One small note: the missing le= bound was already caught by the old test.
🤖 Generated with Claude Code
| hosts = { | ||
| name: get_first_server_config_dict(config, name)["host"] | ||
| for name in ("policy_model", "web_tools", JUDGE_SERVER, "hle_diamond_judge_model", REFERENCE_AGENT) | ||
| } | ||
| assert hosts == { | ||
| "policy_model": "192.0.2.20", | ||
| "web_tools": "192.0.2.20", | ||
| JUDGE_SERVER: "127.0.0.1", | ||
| "hle_diamond_judge_model": "127.0.0.1", | ||
| REFERENCE_AGENT: "127.0.0.1", | ||
| } |
There was a problem hiding this comment.
Non-blocking: this test checks five named servers, not every server the run starts.
A server added to the composition later could take the routable address, and the test would still pass. Listing every started server catches that: this version fails without either judge server's host: 127.0.0.1, with the tavily server left in, or with an extra resources server. Separately, the judge["host"] assertion at L592 can't fail, because the offline listing parse that _resolve uses keeps every server on loopback.
| hosts = { | |
| name: get_first_server_config_dict(config, name)["host"] | |
| for name in ("policy_model", "web_tools", JUDGE_SERVER, "hle_diamond_judge_model", REFERENCE_AGENT) | |
| } | |
| assert hosts == { | |
| "policy_model": "192.0.2.20", | |
| "web_tools": "192.0.2.20", | |
| JUDGE_SERVER: "127.0.0.1", | |
| "hle_diamond_judge_model": "127.0.0.1", | |
| REFERENCE_AGENT: "127.0.0.1", | |
| } | |
| # Every started server, not a list of names: a server added to the composition must not take the routable | |
| # address unnoticed. | |
| hosts = { | |
| instance.name: instance.get_inner_run_server_config_dict()["host"] | |
| for instance in GlobalConfigDictParser().filter_for_server_instance_configs(config) | |
| } | |
| assert {name for name, host in hosts.items() if host != "127.0.0.1"} == {"policy_model", "web_tools"} | |
| assert hosts["policy_model"] == hosts["web_tools"] == "192.0.2.20" | |
| assert {JUDGE_SERVER, "hle_diamond_judge_model", REFERENCE_AGENT} <= set(hosts) |
There was a problem hiding this comment.
Adopted in 865b54b, with one addition: the test is parametrized over an explicit default_host, so the Environment Server pin is guarded as well. The vacuous judge["host"] assertion is removed. Removing the config.yaml pin, the judge-model pin or tavily: null fails both cases; removing the Environment Server pin fails the default_host case.
🤖 Generated with Claude Code
…tch title, audits, docs) Review on #6362. Behaviour: - config.yaml pins the judge resources server to loopback on every preset; opencode_hle_tools pins the Environment Server too, so an explicit default_host leaves only the model server and web_tools reachable from the sandbox. - hle_web_tools: the title fallback reads the first heading of the cut Markdown, so text past the 60,000-character cut is neither served nor checked; dropped search results are logged at INFO, refusals stay at WARNING. Tests: the host test lists every started server and covers an explicit default_host; the fetch tests fail on an unchecked provider title, an uncut cached page, "HLE" in a refusal and an ignored max_fetch_chars. Docs: audit of the 2026-11-18 pilot's saved tool calls. The pilot told the model egress was open; about 135 rows made network calls from bash (102 fetched web content, 57 installed packages, 10 fetched a chess engine, at least 12 reached blocklisted GitHub hosts), and OpenCode hid 356 of 2,115 web_fetch replies behind its 50 KiB tool-output limit. Fidelity rows corrected for web_fetch, web_search, the judge cap, the denominator, effort verification and logging. Signed-off-by: Rima Shahbazyan <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
/ok to test 865b54b |
athitten
left a comment
There was a problem hiding this comment.
Thanks for addressing the review comments!
|
@Kipok If this looks good to you, we can merge |
|
/ok to test c3f747f |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45274009788 |
What
Follow-up to #5176 and #5177, which were built in parallel and never joined: the with-tools preset
hle_diamond/opencode_hle_toolsinherited the HLE-Diamond "science image" profile (Python 3.13, SageMath, Lean/Mathlib and a note saying so), while upstream'sdocs/requirements-tools.txtallows Python 3.11.16 with twelve packages and nothing else (flagged by Igor Gitman on 2026-11-18). This PR moves the preset onto the reference image and audits every point of upstream's with-tools protocol (centerforaisafety/hle22ed3074):opencode_hle_toolsnow extendsopencode_reference(reference imagegym-opencode-hle-reference, enforced egress on OpenSandbox, reference environment note) and swaps only the tool server forhle_web_tools(upstream'sweb_search/web_fetchbehinddocs/blocklist.json).question_extract_regex),max_output_tokens: 4096, judge on loopback.hle_web_tools: long pages are served cut at the 60,000-char cap instead of refused; dropped results logged at WARNING with their rule; cap bounded.hle_diamond/opencode_hle_tools_full: the same preset over all 1000 questions, the 272 image rows included (the published numbers divide by 1000). Theopencode_agentsession attaches each image withopencode run --file;detailis never sent, as upstream.Pilot (label: local Docker; egress NOT restricted; comparison infrastructure only)
GPT-6 Astra, reasoning high, judge o3-mini, one repeat, concurrency 16, 2,400 s / 120 steps per row.
opencode_hle_tools)opencode_hle_tools_full's dataset)All 272 image captures show the image reaching the first policy call as a data URI with no
detail. Captured tool calls:hle_tools_web_search,hle_tools_web_fetchand OpenCode's native tools only; the reference note in every request, SageMath/Lean in none. 48/1000 rows end with the agent asking the user a question instead of anAnswer:line (upstream adds no nudge; neither does this preset). Not a reproduction: open host egress, OpenCode harness, Tavily backend. The OpenSandbox gate stays open.Tests
resources_servers/equivalence_llm_judge/tests/test_hle_diamond.pyandresources_servers/hle_web_tools/tests(228 passed): composition parity of the three reference-image presets, Docker-override refusal without the acknowledgement, judge regex on multimodal rows, page-truncation and logging behaviour ofhle_web_tools.🤖 Generated with Claude Code