Skip to content

feat(gdp-pdf): add OpenCode environment and benchmark - #5635

Merged
dylanelu merged 44 commits into
mainfrom
dylu/gdp-pdf-opencode
Nov 12, 2026
Merged

dylanelu merged 44 commits into
mainfrom
dylu/gdp-pdf-opencode

Conversation

@dylanelu

@dylanelu dylanelu commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Add GDP.pdf evaluation with the existing OpenCode agent. Each task's raw PDF is placed in a sandbox, where OpenCode can read text, render pages and run Python. The existing GDP.pdf rubric grader scores the final answer. Rubrics and reference answers never enter the sandbox.

Adds a sandbox resources server, a benchmark config with its preparation script, and a small tools image. There are no shared code changes: opencode_agent is untouched.

Issue: none filed. This is the OpenCode follow-up to #3309.

Benchmark runs

100 tasks × one attempt, OpenCode 1.17.11, incomplete attempts scored zero.

Model Commit Sandbox Strict pass Mean rubric
Kimi K3 (API) 2f7377ac2 Docker, internal network 21.00% 76.68%
Kimi K3.1 Pro 6b3bdcab2 Apptainer, host network 36.00% 84.39%
Super 3.5 6b3bdcab2 Apptainer, host network 9.00% 51.47%

Only the first row is an isolated score. The 6b3bdcab2 rows ran on a Slurm cluster where shell network access was not blocked, and before image_input and #5548; today they would need the opt-out.

Validation

At the head, 733578074, on Linux:

  • GDP.pdf server tests, CI's changed-server command: 128 passed, 1 skipped, with data validation.
  • Core unit suite, scripts/ci/core_unit_tests.sh: 20,439 passed. Five tests fail only where the host name maps to loopback, and pass once it maps to a routable address.
  • pre-commit run --all-files and git diff --check pass.
  • gym eval prepare writes all 100 tasks and 1,275 criteria from a missing OpenCode JSONL.

At 2f7377ac2, the commit before the final merge of main:

  • 28 deliberate breaks of sandbox_app.py (containment, scoring, isolation, session bookkeeping, shutdown) each fail the sandbox tests.
  • Real Docker 29.5.2, no model: seeds on no network, a non-internal network and a missing network are rejected before any container starts. On the internal network the 34 MB PDF arrives byte-identical, alone in /workspace, with no mounts. example.com, huggingface.co and 1.1.1.1 are unreachable from the sandbox while the host reaches example.com. Close and shutdown each remove the container.

Rollouts

All through gym eval run on a Docker internal network, Kimi K3 via API with Luna grading.

  • Two benchmark tasks at the head: 5/5 and 11/11 criteria, run health healthy, no failed attempts, no containers left, 2m11s. This uses main's judge settings from #5524.
  • 100 benchmark tasks at 2f7377ac2: the first table row. All 100 scored; none failed or masked. 99 responses completed; one hit the 16,384-token output cap with an empty answer, returned incomplete, and scored 0 of 26 without a judge call. 69 episodes read a rendered page image. 74 minutes at eight concurrent episodes.
  • Image delivery: a synthetic image-only PDF with no extractable text, run three times through the custom-rows path, scored 3/3 criteria each time. The agent rendered the page with pdftoppm and read the PNG, with no OCR.
  • Misconfiguration is loud: on a non-internal network without the opt-out, the run exits non-zero and the seed failure names the fix. With allow_unisolated_sandbox: true, the warning is logged and the result records the opt-out.

Compatibility

The single-turn preparation, agent and grader are unchanged.

The Docker recipe uses an internal network: the sandbox reaches the model proxy at the network's gateway and nothing public. Other host services bound to that gateway are reachable too, so expose only the model proxy there. Apptainer and other providers need allow_unisolated_sandbox: true and their own isolation; that opt-out path was exercised on Docker, not on Apptainer.

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).

@dylanelu dylanelu added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 4, 2026
@copy-pr-bot

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

@dylanelu dylanelu changed the title feat(gdp-pdf): add OpenCode evaluation and training feat(gdp-pdf): add OpenCode evaluation environment Nov 5, 2026
@dylanelu dylanelu changed the title feat(gdp-pdf): add OpenCode evaluation environment feat(gdp-pdf): add OpenCode evaluation and training support Nov 5, 2026
@dylanelu dylanelu changed the title feat(gdp-pdf): add OpenCode evaluation and training support feat(gdp-pdf): add OpenCode environment and benchmark Nov 5, 2026
@dylanelu
dylanelu marked this pull request as ready for review November 5, 2026 23:12
dylanelu and others added 4 commits November 10, 2026 10:06
Replace the server's own per-session sandbox bookkeeping with
LentSandboxes from #5719. The server keeps what is specific to GDP.pdf:
the source_pdf containment check, the isolation check, session locks
and fences, and the scoring rule.

A session's seed is recorded before its sandbox starts, so shutdown
waits for a first seed in progress and stops the sandbox it started.

Tests cover a cancelled seed, a failed seed whose sandbox is stopped by
a later close, retirement or shutdown, and shutdown during a first seed
blocked in network inspection or sandbox start.

Signed-off-by: Dylan Lu <[email protected]>
Co-Authored-By: Claude <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test a3e918e

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

Re-reviewed at a3e918e. Every item from my last review is fixed, and I found nothing new that blocks merge. Approving.

Fixed since 6abd032

  • Image flag: the config uses main's image_input: true (opencode.yaml L40), and opencode_agent is no longer touched.
  • Only completed answers are judged: failed and incomplete both score zero with no judge call (sandbox_app.py L103-L113). The test covers failed, incomplete, a trailing tool call and incomplete_details.
  • Isolation fails closed: the seed rejects the session before any sandbox starts unless the provider is Docker on a network that docker network inspect reports as internal, with no extra mounts or run flags (sandbox_app.py L115-L140). allow_unisolated_sandbox is the only way past it, and every verification result records it. The Docker provider calls the same local docker binary, so the check inspects the daemon that runs the sandbox. LentSandboxes' network_access supports only OpenSandbox, so a separate Docker check is the right choice here.
  • Lifecycle on LentSandboxes: what remains in this server is GDP-specific: the source-PDF check, the isolation check, and seed, close and fence bookkeeping. The containment test now uses an existing PDF outside the root and a symlink that points out.
  • Notes: the source_pdf / document_manifest schema text, the benchmark README section, and the issue line in the body are all done. The score table now says which provider and network produced each row.

Not blocking

  • The full CI suite hasn't run on this head yet. I've posted /ok to test for it.
  • The 2f7377ac2 row is the only isolated full run. If the 100-task numbers are going into a report, rerun them at the merged head with image_input.

@dylanelu

Copy link
Copy Markdown
Contributor Author

/ok to test 46b2986

@dylanelu

Copy link
Copy Markdown
Contributor Author

/ok to test b664875

@dylanelu
dylanelu added this pull request to the merge queue Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit 0aedecf Nov 12, 2026
73 checks passed
@dylanelu
dylanelu deleted the dylu/gdp-pdf-opencode branch November 12, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer 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.

5 participants