Skip to content

Rshahbazyan/opencode image attachments - #5175

Merged
weijiac0619 merged 6 commits into
mainfrom
rshahbazyan/opencode-image-attachments
Nov 2, 2026
Merged

weijiac0619 merged 6 commits into
mainfrom
rshahbazyan/opencode-image-attachments

Conversation

@rimashahbazyan

@rimashahbazyan rimashahbazyan commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Lets the OpenCode sandboxed agent carry image questions, and adds HLE-Diamond presets that use it over the full 1000-row set.

Shared component changed: responses_api_agents/opencode_sandboxed_agent (the OpenCode sandboxed agent). Per the maintainer's note on #4727, please give the adapter diff a closer look than the benchmark files; it is used by every benchmark that composes the OpenCode presets. The text-only path is meant to be byte-for-byte unchanged (same generated config, same opencode run command), and the tests assert that.

Origin: cmunley1 asked for image support inside the harness, so the HLE-Diamond image rows (272/1000) stop being excluded from the with-tools presets.

Adapter (app.py, 3 commits):

  • The user turn may now be a string, or one input_text part plus any number of input_image parts. Each input_image data URI is decoded on the host, written to /tmp/nemo-gym-attachments/image-<n>.<ext> in the sandbox (outside the task workdir, so it cannot enter a patch), and passed to opencode run -f. OpenCode's Read tool sniffs the bytes and attaches them as an image part of the first model call. Rows report opencode_attachment_count.
  • The model's modalities.input is declared as ["text", "image"] in the generated OpenCode config only on turns that carry images. Without it OpenCode substitutes ERROR: Cannot read ... (this model does not support image input) text for the image (the first smoke hit this: 0/5). Text-only turns do not get the declaration, so a text-only model is never sent images the agent's Read tool opens mid-run.
  • Images are sent unresized: OpenCode 1.17.11 otherwise downscales anything over 2000 px on a side or 5 MiB of base64 and re-encodes it (PNG, else JPEG q80..40). On image turns the adapter lifts attachment.image.max_width/max_height/max_base64_bytes to 2^31 - 1 so the model receives the dataset's bytes, as upstream HLE's run_model_predictions.py sends them. Any limit can be restored through opencode_config.attachment.image.*. (auto_resize: false is not that knob; it fails the turn instead.)
  • No detail field is transmitted: OpenCode builds its own chat-completions request with URL-only image_url, which matches upstream (the default HLE-Diamond set sends detail: high through the gateway).
  • Explicit, pre-run failures (nothing uploaded, nothing launched) for remote image_urls (the sandbox has no internet), file_id inputs, non-base64 data URIs, invalid base64, and media types other than PNG/JPEG/GIF/WebP (the set OpenCode's Read tool recognises).

Benchmark (benchmarks/hle_diamond):

  • prepare.py --prompt opencode / prepare_opencode.py materialize all 1000 rows with prompts/opencode.yaml (HLE instruction folded into the single user turn; image rows keep their input_image block) into hle_diamond_benchmark_opencode_full.jsonl. The default set's file cannot serve the adapter because it carries the instruction as a system message, which the adapter does not forward.
  • New presets hle_diamond/opencode_full and hle_diamond/opencode_search_full (same agent, tools and network policy as opencode / opencode_search, dataset swapped). Need a vision-capable policy model. The existing 728-row text presets are untouched; Pi still accepts text parts only.
  • README: scope table, prompting notes, a new "Image questions through OpenCode" section (how OpenCode routes -f files, the modality declaration, the resizer and its limits, format coverage: 186 PNG / 81 JPEG / 4 WebP / 1 GIF; 26 rows exceed 2000 px), smoke records, and the test command.

Update after review and CI (new head):

  • responses_api_agents/vibench_agent/app.py: VibenchAgent._create_opencode_config now accepts and forwards image_input. Without it every ViBench rollout raised TypeError (caught by its signature-parity test in the server suite). This is the only subclass that overrides the method.
  • Merged current main (signed merge commit); conflicts with Rshahbazyan/hle reference sandbox image #5177 resolved by keeping both sides.
  • README: the lifted-limit capture is recorded from the 272-image-row run, and the "every image reaches the model" claims are corrected (one 41.6 Mpx image is rejected by the provider and scores 0). sandbox_docker_local.yaml header lists the full and reference presets.

Validation

Against the final diff (39993e3):

pytest responses_api_agents/opencode_sandboxed_agent/tests/test_app.py     # 81 passed, 2 skipped (after merging main)
pytest responses_api_agents/vibench_agent/tests/test_app.py                # 17 passed
pytest resources_servers/equivalence_llm_judge/tests/test_hle_diamond.py   # pass
pre-commit run --all-files

Adapter tests added cover: string / single-text / text+images turn parsing; each rejection path (remote URL, file_id, non-base64 URI, invalid base64, unsupported media type) raises before any upload; the generated config declares the image modality and the lifted attachment.image limits only when the turn has images; the -f arguments and upload paths on the launch command; and that a text-only turn yields exactly the pre-change config and command. Benchmark tests cover the --prompt opencode output (one user turn per row, image block kept, written to the _opencode_full file), the CLI surface, and that the _full presets change only the agent's dataset.

Dataset preparation:

gym eval prepare --benchmark hle_diamond/opencode_full   # Wrote 1000 problems ... (272 with an image)
gym list benchmarks | grep hle_diamond                   # ... hle_diamond/opencode_full ...

Rollouts

All runs below used the local-Docker recipe from the README (gym-opencode-science:local, host networking), GPT-6 Astra as policy with reasoning.effort: high, o3-mini as judge. Label for every number: local Docker; egress not restricted; comparison infrastructure only. These support a comparison with the HLE-Diamond blog column, not a reproduction (the README's "Sandboxed agents (with tools)" section lists the remaining departures: harness system prompt, instruction as user text, synthetic Read-tool parts ahead of the image, leakage blocklist coverage).

5-row image smoke (3 PNG, 1 JPEG, 1 WebP; row ids in the README): 5/5 scored reward 1.0, opencode_attachment_count = 1 and opencode_failed = 0 on every row, no adapter or model error. Model-call capture confirmed one image_url part per row whose data URI equals the dataset's byte for byte, with no detail key. The same smoke before the modality declaration scored 0/5 with every image replaced by OpenCode's "does not support image input" text.

Resizer control (one 14950x2780 PNG row, OpenCode's default limits restored via opencode_config): the captured image_url was a 2000x372 PNG of 105,698 bytes, not the dataset's 743,849 bytes, i.e. the resizer is active in the science image and the lift is needed for unresized delivery.

272-row image-only run, hle_diamond/opencode_full:

Rows Setting Accuracy
272 image rows OpenCode with tools (this PR) 73.2 % (199/272)
same 272 rows no tools (default preset, image_url with detail: high) 58.1 %
all 1000, combined with tools (728 text via opencode + 272 image via opencode_full) 81.9 %
all 1000 HLE-Diamond blog, GPT-6 Astra with tools 82.9 %

One row failed with a provider-side rejection of a 41.6 Mpx image. That is the cost of sending the dataset's bytes unresized rather than letting OpenCode downscale; it is documented, and an opt-in downscale (or restoring attachment.image.* limits for a run) is the follow-up rather than a silent default resize.

Compatibility and benchmark impact

  • Text-only turns through the OpenCode adapter are unchanged: no modality declaration, no attachment block, identical opencode run command. Existing hle/opencode* and hle_diamond/opencode* (728-row) results are unaffected.
  • New verify field opencode_attachment_count (default 0) on every row; additive.
  • Turns with more than one input_text part, or with parts other than input_text / input_image, still fail the assertion they always did. Image inputs that OpenCode cannot show now fail explicitly before the run instead of being accepted and mangled.
  • New files: benchmarks/hle_diamond/opencode_full.yaml, opencode_search_full.yaml, prepare_opencode.py, and the _opencode_full data file (prepared, not committed; cais/hle-diamond is gated).
  • Pi adapter: no change; no Pi preset covers the image rows.
  • Known limitation: very large images (tens of Mpx) can be rejected by the provider when sent unresized; configurable through opencode_config.attachment.image.*, opt-in downscale tracked as follow-up.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

rimashahbazyan and others added 3 commits October 26, 2026 15:29
…ode run

The adapter forwarded only a single text user turn, so image questions
could not be sent through the sandboxed harness. It now decodes each
input_image data URI of the user turn on the host, uploads the bytes to
/tmp/nemo-gym-attachments/image-<n>.<ext> in the sandbox and passes each
path with -f to `opencode run`; the input_text part stays the query, and
a text-only turn produces exactly the launch command and OpenCode config
it always did.

OpenCode 1.17.11 labels a local `-f` file text/plain and routes it
through its Read tool, which sniffs PNG, JPEG, GIF and WebP by magic
bytes and attaches a data: file part that the openai-compatible provider
sends as an image_url part (no `detail`). It forwards that part only to
a model whose config declares image input (unsupportedParts in
provider/transform.ts substitutes an ERROR text otherwise), so for a
turn with images the generated config declares modalities.input as text
and image. Anything else, a remote URL (the sandbox has no internet) or
a file_id input fails the row before an upload or a run, with the reason
in the error. Each row records the number of attached images in
opencode_attachment_count.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Rima Shahbazyan <[email protected]>
…th images

opencode_full.yaml and opencode_search_full.yaml run the OpenCode
sandboxed agent of opencode.yaml and opencode_search.yaml on all 1000
HLE-Diamond questions, the 272 image questions included, now that the
adapter attaches input_image parts with `opencode run -f`. The default
set's file cannot serve them because it bakes the HLE instruction as a
system message, which the adapter does not forward, so prepare.py gains
`prompt="opencode"` (CLI `--prompt opencode`) and the thin
prepare_opencode.py wrapper writes hle_diamond_benchmark_opencode_full.jsonl
with prompts/opencode.yaml: one user message per row, the instruction
folded after the question, image rows carrying the same input_image
block.

The README states the image path and its limits (formats, the synthetic
Read-tool parts ahead of the question, no `detail` transmitted, which
matches upstream, OpenCode's size normalisation, the model-modality
declaration) and records the 5-row image smoke on local Docker: 5/5 rows
scored, an image_url part on the first model call of every row, no
adapter or model error.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Rima Shahbazyan <[email protected]>
… dataset holds them

OpenCode v1.17.11 (image/image.ts) downscales any image over 2000 px on a
side or 5 MiB of base64 with its bundled photon resizer and re-encodes it
(PNG, else JPEG q80..40); a one-row control smoke on the 14950x2780 PNG of
HLE-Diamond row 66f1b940f8bb4425f74e4299 confirmed the resizer runs inside
gym-opencode-science:local (the model received a 2000x372 PNG). 26 of the
272 Diamond image rows (12 PNG, 14 JPEG) exceed that threshold; upstream
sends the original bytes. `auto_resize: false` is not the fix: it raises
SizeError and fails the turn. Lift `attachment.image.max_width`,
`max_height` and `max_base64_bytes` in the generated config whenever the
turn carries images (schema: packages/core/src/v1/config/attachment.ts),
so `normalize` returns the part untouched; `opencode_config` overrides
still win. Extend the modality test to assert the keys, and state the
affected row count, the control-smoke evidence and the open capture step
in the HLE-Diamond README's departures and image sections.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Rima Shahbazyan <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 28, 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 area:agent Agent harnesses and Responses API agent behavior feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 28, 2026

@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

LGTM — no concerns found.

Reviewed all 10 changed files and traced the affected input, sandbox-transfer, configuration, preparation, and verification paths. The text-only launch/configuration behavior is preserved, and the full HLE-Diamond presets retain the existing tool and network settings.

Validation was static: tests and reported model rollouts were not rerun. Two delegated reports were unavailable, so their adapter scopes were independently inspected.

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.

@yaoyu-33 yaoyu-33 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. Thanks for this. Running the image rows through OpenCode closes the 272-row gap in the with-tools presets, and the adapter's claims hold up against OpenCode v1.17.11 source: -f goes through the Read tool, modalities.input drives the image capability, and attachment.image sets the normalize limits.

What we checked and found fine:

  • Text-only turns produce a byte-identical OpenCode config and opencode run command compared with the merge base. We checked this independently for string and single-input_text turns, with debug, remaining_context, and user opencode_config settings.
  • The 728-row opencode, opencode_search, pi, and pi_search presets resolve identically to main. opencode_full and opencode_search_full differ from them only in the agent's dataset; tools, network policy, and effort carry over.
  • The judge sees the question with the folded instruction and no image, the same as the existing OpenCode presets, and opencode_attachment_count is additive.

No blockers or risks; 7 inline notes. The two we'd most like settled before merge are the README/evidence mismatch (benchmarks/hle_diamond/README.md:528) and the rejected-image path (app.py:895).

PR hygiene

  • The title isn't Conventional Commit style. Suggested: feat(opencode_sandboxed_agent): attach input_image parts and add HLE-Diamond full-set presets.
  • No linked issue, and the body doesn't say why none is needed. It cites cmunley1's request and #4727.
  • The 73.2% / 58.1% / 81.9% figures are author-reported only, with no rollout artifacts. The README comment lists what would back them.
  • Merge order: #5176 and #5177 also edit benchmarks/hle_diamond/README.md and resources_servers/equivalence_llm_judge/tests/test_hle_diamond.py, so whichever lands later will need a rebase.

Validation on the review side

  • responses_api_agents/opencode_sandboxed_agent/tests/test_app.py: 72 passed.
  • test_hle_diamond.py: 65 passed. 25 config tests need hostname resolution the review host lacks; they pass with a test-only host shim and fail the same way on main.
  • We also ran mutation testing and the suggested tests locally.
  • Not rerun: model rollouts, GPU, or a real sandbox.

query = input_item.content[0]["text"]

assert query, body.input
# Fails before anything is uploaded or run, so an unsupported image fails the row explicitly.

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.

app.py:895

A rejected image doesn't fail just the row. _parse_user_turn runs here, after _run has already seeded the session and started the sandbox (L1244). The error comes back as a 500 from /run, and with the default route_failures_to_sidecar=False that ends the whole collection.

Could you:

  • parse the turn at the top of _run, before seed_session;
  • replace the assert ..., input_items checks (L153, L159, L163) with a ValueError that reports part-type counts (today those messages put the full base64 data URIs into the server log and the 500 body);
  • reword this comment and the agent README's "fail the row before anything runs" to match?

Comment on lines +135 to +139
try:
content = base64.b64decode(payload, validate=True)
except (binascii.Error, ValueError) as exc:
raise ValueError(f"input_image part {index} carries invalid base64") from exc
return _ImageAttachment(remote_path=f"{_REMOTE_ATTACHMENTS_DIR}/image-{index}.{extension}", content=content)

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.

app.py:135-139

Only the declared media type is checked, never the decoded bytes:

  • data:image/png;base64, uploads a 0-byte file, which OpenCode then fails on after launch.
  • BMP bytes labelled image/png sniff as image/bmp in OpenCode's Read tool (media.ts, read.ts). The run continues without the image, and the row is scored with opencode_failed=False.

Rejecting empty content (below) would fix the first case. Optionally, checking the four magic signatures OpenCode sniffs would make "fail before upload" hold for the bytes too.

Suggested change
try:
content = base64.b64decode(payload, validate=True)
except (binascii.Error, ValueError) as exc:
raise ValueError(f"input_image part {index} carries invalid base64") from exc
return _ImageAttachment(remote_path=f"{_REMOTE_ATTACHMENTS_DIR}/image-{index}.{extension}", content=content)
try:
content = base64.b64decode(payload, validate=True)
except (binascii.Error, ValueError) as exc:
raise ValueError(f"input_image part {index} carries invalid base64") from exc
if not content:
raise ValueError(f"input_image part {index} is empty")
return _ImageAttachment(remote_path=f"{_REMOTE_ATTACHMENTS_DIR}/image-{index}.{extension}", content=content)

# OpenCode's `attachment.image` limits (config schema packages/core/src/v1/config/attachment.ts at v1.17.11):
# an image within all three is forwarded unchanged. 2**31 - 1 is the largest value its PositiveInt accepts
# without a JSON precision caveat and is far above any image a chat-completions request can carry.
OPENCODE_IMAGE_LIMITS_UNRESTRICTED = {

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.

app.py:505

Lifting the limits here (applied at L780) has three effects:

  • It becomes a default of the shared adapter, for every benchmark that sends images.
  • It covers every image in an image session, including images the agent's own Read tool opens mid-run; OpenCode normalizes those with the same limits (processor.ts:575).
  • It is also what produced the one provider rejection in the 272-row run (14950x2780), and that row then scores as a wrong answer.

Would you consider keeping OpenCode's defaults in the adapter and setting opencode_config.attachment.image.* in benchmarks/hle_diamond/opencode_full.yaml instead?

Separately, the comment's rationale is off: OpenCode's PositiveInt is Schema.Int.check(Schema.isGreaterThan(0)), with no 2^31 bound (schema.ts:3).


command = sandbox_mock.exec.await_args_list[0].kwargs["command"]
# The f-string's line continuations fold the launch line into one; the query follows `--` directly.
assert "--thinking -- hello " in command and "nemo-gym-attachments" not in command

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.

test_app.py:715

These tests don't pin what the PR body says they do:

  • _mock_sandbox replaces _create_opencode_config with {} (L568).
  • This check is a substring match.
  • The config test compares vision["attachment"] to the module constant itself (L662).

These mutants pass all 72 tests:

  • max_width set to 2000;
  • the lift applied after the user opencode_config merge, so the override both READMEs document stops working;
  • image/webp dropped;
  • GIF written as .png;
  • chmod(0o644) removed;
  • a staging dir that is never cleaned up.

Could you add:

  • a golden test of the real text-only config and run tokens;
  • an image-turn test with literal limits, plus an opencode_config.attachment.image.max_width=2000 override case;
  • GIF and WebP extension cases;
  • in test_hle_diamond.py, a test that feeds a prepared opencode_full row through _parse_user_turn?

The behaviour is right today: text-only output is byte-identical to the merge base.

Comment thread benchmarks/hle_diamond/README.md Outdated
`++...opencode_config.attachment.image.max_width=2000 ...max_height=2000 ...max_base64_bytes=5242880`:
every captured `image_url` carried a 2000x372 PNG of 105,698 bytes, not the dataset's bytes, which
shows the resizer loads and runs in the science image.
- As committed (limits lifted by the adapter): NOT YET CAPTURED. The adapter's unit test asserts the

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.

README.md:528

The README and the PR body disagree:

  • This line still says the lifted-limits capture is NOT YET CAPTURED.
  • L712-716 and L793-797 say all 272 images reach the model as the dataset's bytes.
  • The PR body says the 272-row run lost this very row (14950x2780 = 41.6 Mpx) to a provider rejection. Neither README mentions that.
  • The 73.2% / 58.1% / 81.9% figures aren't recorded anywhere in the README.

Could you add a run record like the existing ones, with:

  • date and Gym commit;
  • scored rows out of 272, sidecar count, and mean/opencode_failed;
  • the rejected row's uuid and error;
  • links to the rollouts and the resolved config;
  • where 58.1% comes from (158/272 of the 946/1000 no-tools run, which predates judge_labels_case_insensitive?);
  • the 728-row opencode result (620/728) behind the 81.9%?

[
("opencode.yaml", "hle_diamond_opencode_agent", "hle_diamond_pi_agent"),
("opencode_search.yaml", "hle_diamond_opencode_agent", "hle_diamond_pi_agent"),
("opencode_full.yaml", "hle_diamond_opencode_agent", "hle_diamond_pi_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.

test_hle_diamond.py:578

These new cases compose sandbox_docker_local.yaml with the two _full presets, but its header (sandbox_docker_local.yaml:4-5) still lists only opencode, opencode_search, pi, pi_search. Its warning about search presets keeping network_access applies to opencode_search_full too. Could you add the two full presets there?

Comment thread benchmarks/hle_diamond/README.md Outdated
@@ -810,7 +907,8 @@ new `serp_url_patterns` regex is reported as dropped until `SERP_PATTERN_SUBSTRI
```bash
pytest tests/unit_tests/test_hle_diamond.py tests/unit_tests/test_hle_diamond_search_exclusions.py \

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.

README.md:908

tests/unit_tests/test_hle_diamond.py and tests/unit_tests/test_hle_diamond_search_exclusions.py don't exist, so this block fails with "module or package not found" before it reaches the line this PR adds. This predates the PR, but since the block is edited here:

Suggested change
pytest tests/unit_tests/test_hle_diamond.py tests/unit_tests/test_hle_diamond_search_exclusions.py \
pytest resources_servers/equivalence_llm_judge/tests/test_hle_diamond.py resources_servers/tavily_search/tests/test_hle_diamond_search_exclusions.py \

yaoyu-33
yaoyu-33 previously approved these changes Oct 28, 2026

@yaoyu-33 yaoyu-33 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.

Approving. The notes from my earlier review are non-blocking: the 500 on a rejected image after the sandbox starts, the image-limit lift living in the shared adapter, tests that pin the new behavior more tightly, and the README benchmark numbers / test paths. Fine to address them here or in a follow-up.

@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test 39993e3

@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed needs-review PR is ready for code review and waiting on a reviewer labels Oct 28, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 28, 2026 22:40
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Oct 29, 2026
@weijiac0619

Copy link
Copy Markdown
Contributor

Hi @rimashahbazyan , could you take a look at the failing Unit tests / Server suite (shard 0)?

Resolve the conflicts with #5177 (HLE-Diamond reference sandbox image) in
benchmarks/hle_diamond/README.md and
resources_servers/equivalence_llm_judge/tests/test_hle_diamond.py by keeping
both sides: this branch's opencode_full / opencode_search_full presets and
main's opencode_reference preset are additive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rima Shahbazyan <[email protected]>
rimashahbazyan and others added 2 commits November 2, 2026 14:53
…config override

The OpenCode sandboxed agent now calls
_create_opencode_config(request, image_input=...) on every run. VibenchAgent
overrides that method with the old one-argument signature, so every ViBench
rollout, text-only ones included, raised TypeError, and the existing
signature-parity test failed in the server suite. Accept the keyword and pass
it to the parent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rima Shahbazyan <[email protected]>
Replace the README's "NOT YET CAPTURED" acceptance step with the 272-image-row
run of 2026-10-26, and stop claiming that every image reaches the model: the
images are sent as the dataset's bytes, and an endpoint with its own size limit
can reject one (GPT-6 Astra rejects the 14950x2780 PNG, which then scores 0
after OpenCode retries until sandbox_timeout). List the full and reference
presets in the sandbox_docker_local.yaml header. Addresses yaoyu-33's review
notes on the README and the Docker override header.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rima Shahbazyan <[email protected]>
@rimashahbazyan

Copy link
Copy Markdown
Contributor Author

Hi @rimashahbazyan , could you take a look at the failing Unit tests / Server suite (shard 0)?

Thanks @weijiac0619 . The failing server was vibench_agent, not the adapter itself: VibenchAgent overrides _create_opencode_config with the old one-argument signature, and this PR's adapter now calls it with image_input=... on every run. Its signature-parity test caught it, and every ViBench rollout (text-only included) would have raised TypeError. Fixed in a917868 by accepting the keyword and forwarding it to the parent.

Also pushed:

  • a signed merge of current main (resolves the conflicts with Rshahbazyan/hle reference sandbox image #5177 in the HLE-Diamond README and test_hle_diamond.py; both sides kept, since the _full presets and opencode_reference are additive);
  • d87dd8d for @yaoyu-33's README notes: the "NOT YET CAPTURED" step now records the 272-image-row capture, the README no longer claims every image reaches the model (one oversized image is rejected by the provider and scores 0), and the sandbox_docker_local.yaml header lists the full and reference presets.

The remaining non-blocking notes (parse the turn before the sandbox starts, stricter byte checks, tighter tests) I'll take in a follow-up so this stays reviewable.

@weijiac0619

Copy link
Copy Markdown
Contributor

/ok to test d87dd8d

@weijiac0619 weijiac0619 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.

Re-approving after @yaoyu-33’s earlier approval was dismissed by the update. The changes since then are the main merge (conflicts with #5177 resolved, both sides kept), the vibench_agent signature fix (a917868), and the README/comment updates from Yu’s notes (d87dd8d). Required CI is green.

@weijiac0619
weijiac0619 added this pull request to the merge queue Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41499277104

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41503464905

Merged via the queue into main with commit 9042779 Nov 2, 2026
68 of 71 checks passed
@weijiac0619
weijiac0619 deleted the rshahbazyan/opencode-image-attachments branch November 2, 2026 19:26
abhibha-nvidia added a commit that referenced this pull request Nov 2, 2026
…-opensandbox

main's opencode image-attachments work (#5175) touched the same file as this branch. Four
conflicts in responses_api_agents/opencode_sandboxed_agent/app.py, all kept-both:

  * imports: `hashlib` (ours) alongside `base64`/`binascii` (main).
  * the launch: main added `image_input=bool(attachments)` to _create_opencode_config; this
    branch replaced _runtime_plugins() with the unified _plugin_uploads() and the verified
    upload. Both retained.
  * the run command: main delivers the query as argv and appends `-f` attachment flags; this
    branch pipes the query on stdin when opencode_query_via_stdin is set. The `-f` flags are
    independent of how the message text is delivered, and query_arg_str is empty only on that
    opt-in path (default False), so main's argv behaviour remains the default. Kept the pipe,
    extra_env_str, and the attachment flags together.
  * the result row: opencode_plugins_loaded and opencode_terminal_reason alongside main's
    opencode_attachment_count.

Also fixes a latent bug those new tests exposed. _resolve_opencode_env looks up the search
server's Exa cache proxy through get_global_config_dict(), guarded by `except Exception` so a
missing cache can never break a rollout. That guard did not hold: Hydra reports a config
resolution failure by catching its own MissingConfigException and calling sys.exit(1), and
SystemExit is a BaseException that `except Exception` does not stop. A best-effort cache lookup
could therefore terminate the rollout it was only meant to optimise. The guard now catches
SystemExit as well.

Validation: confirmed the three new attachment tests pass on main's pristine files and failed
only against this merge, which is how the SystemExit path was found. After the fix: agent suite
plus opencode_search suite 97 passed, with the same single pre-existing failure
(test_import_only_loads_shared_opencode_modules, a subprocess timeout that also fails on
unmodified main here). ruff check and ruff format clean.

Signed-off-by: abhibhag <[email protected]>
AdamRajfer added a commit that referenced this pull request Nov 2, 2026
Brings in main up to 94545e7 (#5141, #5384, #5144, #4615, #4954, #5001,
#5175).

Textual conflict: nemo_gym/cli/env.py, imports only. This branch imports
PIPE from subprocess (the server start error capture); main imports SIGKILL
from signal (#5141, the shutdown drain). Both are kept:
"from signal import SIGINT, SIGKILL" and
"from subprocess import PIPE, Popen, TimeoutExpired".

Semantic conflict: #5141 starts each server in its own session
(run_command(..., start_new_session=True)) so shutdown can signal its
process group, while this branch starts servers through
RunHelper._spawn_server, which keeps the tail of the error stream. The
merged call passed start_new_session to _spawn_server, which did not accept
it (11 test_cli failures). _spawn_server now takes start_new_session and
forwards it to run_command, so both behaviours hold. The dry-run path keeps
this branch's process.wait(): the tail thread of _spawn_server owns the
piped stream, so main's communicate() would compete with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
rimashahbazyan added a commit that referenced this pull request Nov 9, 2026
Resolved conflicts:

- ATTRIBUTIONS.md: main moved the Harbor row to nemo_gym/data/tasks/ and
  added the NeMo Skills generic/math prompt row and note; this branch added
  the HLE with-tools blocklist row and note. Kept main's rows and notes and
  appended the blocklist row and note after them, in the table's insertion
  order.
- benchmarks/hle_diamond/README.md: main (#5175) added the
  opencode_full/opencode_search_full material and the Image questions
  through OpenCode section; this branch added the Upstream web tools section
  with its three residuals. Kept both sections (Image questions first, then
  Upstream web tools next to Search exclusions, which it refers to) and both
  test files in the Tests command. So that the lists of presets name
  everything that now exists: added opencode_hle_tools to the Scope table,
  the text-preset and unlisted-preset sentences, the reasoning-effort
  inheritance note, the harness-validation preset list and the Rows
  departure; named the full-set presets in the Sandboxed agents intro;
  scoped the Web tools and Leakage policy departures to the Tavily search
  presets with a pointer to Upstream web tools; and made the aggregate
  limitation cover every OpenCode and Pi preset.
- resources_servers/equivalence_llm_judge/tests/test_hle_diamond.py: both
  sides added presets to the judge-prompt and local-Docker
  parametrizations. Kept both: main's opencode_full and
  opencode_search_full, then opencode_hle_tools. LISTED_BENCHMARKS merged
  cleanly (opencode_hle_tools declares no dataset, so it is not listed).

Signed-off-by: Rima Shahbazyan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
public — d87dd8de Deployed Nov 2, 2026 by copy-pr-bot[bot] via release / finalize / notify #9208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants