Skip to content

fix(opencode): add a verified musl runtime pin and relay runtime settings to sessions - #5401

Open
yaoyu-33 wants to merge 6 commits into
NVIDIA-NeMo:mainfrom
yaoyu-33:codex/opencode-session-compat-20261030
Open

yaoyu-33 wants to merge 6 commits into
NVIDIA-NeMo:mainfrom
yaoyu-33:codex/opencode-session-compat-20261030

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What changed

opencode_agent sessions can now install a verified OpenCode runtime on both glibc and musl task images. They also accept opencode_sandboxed_agent's opencode_model_call_timeout.

  • Musl pin. sandbox_musl_executable_path and sandbox_musl_executable_sha256 add a second verified pin. The installer identifies the sandbox's libc. On a musl image it copies the musl pin to private staging, checks its SHA-256, runs --version, and publishes it atomically in place of the primary pin. A musl pin requires the primary pin. Restoring a session into a sandbox that lacks the runtime follows the same path.
  • No mounted installer. opencode_sandboxed_agent's mounted installer (remote_opencode_install_script_path, remote_opencode_binary_path, remote_opencode_musl_binary_path) is not supported on opencode_agent, and the agent ignores those keys. It checked the installed binary by version only, and no opencode_agent config uses it. The digest-verified pins are the only offline runtime source. opencode_sandboxed_agent keeps its installer unchanged.
  • opencode_model_call_timeout. OpenCode 1's per-request provider timeout, in milliseconds, as on the relay. It is unset by default, in which case only the run's timeout bounds a model call. It is refused for OpenCode 2 and not applied to local /run.
  • SWE-bench Pro recipe. benchmarks/swebench/pro/opencode.yaml reads both pins from an optional swebench_pro_opencode_runtime block. benchmarks/nemotron_3.5_super/sandbox_utils.yaml supplies that block with the official OpenCode 1.17.11 x64 glibc and musl release binaries. Without the overlay, the recipe still downloads OpenCode.
  • Primary digest. The primary executable digest now reaches the installer in lowercase. Before this, an uppercase sandbox_executable_sha256 passed config validation but failed every setup.
  • Docs. The opencode_agent README documents the musl pin and the timeout, and says the mounted installer is not supported. The DeepSWE migration table maps the relay's runtime keys to the verified pins and the timeout to the same key.

The session trajectory returned on close comes from main. This PR only adds assertions for it to the borrowed-sandbox flow test.

This follows #4747 and needs no separate issue.

Compatibility and benchmark impact

  • A glibc-only pin works as before. On a musl image it still fails setup, as it did before this PR.
  • Consumers who override the offline OpenCode version should supply matching pins for both libc variants.
  • The evaluator needs a Gym revision containing this change to pick up the musl selection.
  • Verifier and scoring code are unchanged.
  • SWE-bench Pro rows on Alpine images, which previously failed setup and left the denominator, can now be graded.
  • New settings default to off, so existing opencode_agent configs behave the same.

Validation

Linux, Python 3.13.14, at 0199678 (the PR head merged with main d1f6955):

  • pytest responses_api_agents/opencode_agent/tests: 1,169 passed, 25 skipped, 1 failed. The failure, test_pinned.py::test_stage_executable_rejects_wrong_or_broken_bytes_without_installing[format], is in a file this PR does not touch and fails the same way without it: dash reports status 2 for the malformed executable, and the test expects 126.

  • Revert checks. Each new test fails when its fix is reverted:

    • the seed-path musl pin;
    • the empty release-digest slot before the libc arguments;
    • the OpenCode 2 digests ahead of a musl pin;
    • the OpenCode 2 timeout rejection;
    • the lowercase primary digest.
  • Installer with real binaries. The real installer ran in Docker with the official OpenCode 1.17.11 x64 glibc and musl release binaries. Their SHA-256s match the overlay's pins.

    • alpine:3.20 with both pins installed the musl build (674a7e…), and --version reported 1.17.11.
    • debian:bookworm-slim with both pins installed the glibc build (0254a4…).
    • alpine:3.20 with only the glibc pin failed with "OpenCode executable version mismatch".
  • Configs. gym env validate passed for:

    • benchmarks/swebench/pro/opencode.yaml, with and without benchmarks/nemotron_3.5_super/sandbox_utils.yaml;
    • benchmarks/deepswe/opencode.yaml plus the overlay;
    • benchmarks/nemotron_3.5_super/eval_container_config.yaml, at the previous head b159155.

    gym env resolve of the Pro recipe, at b159155, gives both libc pins with the overlay and none without it. The mounted-installer removal does not touch either config.

  • pre-commit run on the changed files passed. All commits are signed off.

Rollouts

These rollouts ran at the earlier head 8725170. The later fixes change only seed validation, the digest case and docs. The happy path is unchanged, and the installer check above covers it with the real binaries.

Two real ProtonMail WebClients tasks ran on Alpine 3.18.3 in Enroot with Qwen3-VL-8B-Instruct. A test driver called the Gym Resources and OpenCode session APIs with the original prompts, and the official SWE-bench Pro verifier graded each run in a fresh sandbox.

  • With the glibc-only control, both images reproduced HTTP 500.
  • With the verified pair, both returned HTTP 200, installed the expected musl SHA-256, served model requests, and closed their sessions.
Instance suffix Model calls on graded attempt Activation Official verification
4feccbc9 (extended attributes) 63 Incomplete at the 300 s budget Patch applied, reward 0. The model redeclared xattr.
08bb0991 (TOTP input) 11 Completed on replay Patch applied, reward 0. The model change raised React is not defined.

The first TOTP attempt reached 63 successful model requests. Its next request exceeded the 65,536-token model context by one token. The graded replay declared 49,152 tokens and allowed up to 20 steps. Both graded attempts had evaluation_completed=true and left zero owned task sandboxes.

Not covered:

  • This smoke covers startup on two images. It does not establish an aggregate score or full-scale coverage.
  • opencode_model_call_timeout has unit tests but no real-model run. How a timed-out model call is classified has not been checked against a real OpenCode run.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Oct 31, 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 bug Something isn't working area:agent Agent harnesses and Responses API agent behavior labels Nov 1, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:mid Autobot PR risk: mid label Nov 23, 2026
yaoyu-33 and others added 3 commits November 23, 2026 10:31
…n runtime settings

- Refuse relative or non-normalized mounted-installer paths at seed, and
  raise the seed-rejection error for every mounted-installer conflict.
- Pass the primary executable digest in lowercase, since the installer
  compares sha256sum output.
- Document the musl pin, the mounted installer and
  opencode_model_call_timeout, and update the DeepSWE migration table,
  which still said the session path ignored them.
- Test the installer argument order (empty release-digest slot, musl pin,
  mounted installer), OpenCode 2 with a musl pin, and the OpenCode 2
  timeout rejection.
- Drop the per-config binding test; the recipe is checked with
  gym env validate and resolve instead.
- Name the mode "mounted installer" instead of "cached" or "native".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 changed the title fix(opencode): preserve session migration compatibility fix(opencode): add a verified musl runtime pin and relay runtime settings to sessions Nov 24, 2026
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test b159155

@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 24, 2026 00:47
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 24, 2026 00:47

@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, trusted base conventions, seed/restore callers, runtime-cache behavior, benchmark overlay consumers and existing tests. There were no prior formal reviews or inline findings to reconcile.

CI on b1591558 passed lint, core tests, all server-suite shards, sandbox tests, component locks and OpenCode conformance. The final snapshot showed 55 successful checks, 14 skipped checks and only this review still running. I did not rerun CI suites locally.

Focused probes ran against the admitted source in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, using Python 3.13.14. They confirmed libc-specific pin selection, uppercase digest handling, overlay composition, restore argument forwarding, provider-timeout configuration and preservation of previously installed bytes after rejected replacements. Installer probes used stub executables; I did not independently repeat the author’s real-model rollouts or verify real OpenCode timeout classification.

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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 24, 2026
The mounted installer checked the installed binary by version only, and no
opencode_agent config uses it. Keep the digest-verified pins, including the
musl pin, as the only offline runtime source. opencode_sandboxed_agent keeps
its own mounted installer.

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

Copy link
Copy Markdown
Contributor Author

/ok to test 0199678

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer risk:mid Autobot PR risk: mid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants