Skip to content

fix(opencode): share runtime pin and observability patch - #4288

Merged
giuliolovisotto merged 3 commits into
mainfrom
codex/opencode-shared-runtime
Oct 9, 2026
Merged

giuliolovisotto merged 3 commits into
mainfrom
codex/opencode-shared-runtime

Conversation

@giuliolovisotto

Copy link
Copy Markdown
Contributor

What changes

Local OpenCode lacked the correlation plugin already enabled by the sandboxed adapter, and the adapters separately selected their runtime versions. Both now use opencode_agent/runtime.py: one release pin, one unchanged JavaScript patch, and one apply_observability_patch(...) function. The sandbox only adds the necessary upload of that same file. Existing user plugins are preserved; the patch is enabled with model-call observability.

The shared module is 15 lines. The plugin is moved unchanged. Both YAML version duplicates are removed, and the CI installer uses the same default. Configured versions must match the executable, including preinstalled/cached sandbox binaries. Local version mismatches now raise an actionable error instead of warning and continuing. Explicit opencode_version overrides remain supported in both adapters; the default is stock 1.17.11 for the relevant platform.

Split from #4251 at Giulio's request. That PR retains the independent checker and scripted-capture header fixes; it contains no plugin-loading change. This PR targets main independently. No reward/scoring changes or binary fork.

Validation

PYTHONPATH=$PWD python -m pytest \
  responses_api_agents/opencode_agent/tests \
  responses_api_agents/opencode_sandboxed_agent/tests \
  tests/unit_tests/test_harness_conformance_ci.py \
  scripts/harness_conformance/tests -q
python -m pre_commit run --all-files
git diff --check

302 passed, 2 skipped; all-files pre-commit passed. Tests cover both adapters' plugin configuration, preserved user plugins, capture disabled, the shared CI/default version, actual plugin hooks, and rejecting mismatched binaries before task execution.

Fresh real-runtime smoke artifacts are in /Users/glovisotto/repos/notes/opencode-shared-runtime-20261009/:

  • Local stock OpenCode 1.17.11: 3 calls linked to 3 turns, two shell tools, reward 1 and evaluation_completed=true. The standalone scripted fixture supplies the normal production assistant-message capture header (the separate runner fix in fix(ci): align harness conformance checks with capture semantics #4251).
  • Docker sandbox, stock Linux OpenCode 1.17.11: injected 503 then two successes; 3 captured attempts linked to 2 turns, tool executed and requested marker returned. Plugin comes from the adapter upload, without manual plugin configuration.
  • Live inference smoke in Docker: one completed call and one correctly linked turn, usage retained. The Llama-3.1-8B response did not match the requested marker, so the smoke's task assertion failed; only runtime/correlation validation passed. No SWE-Pro benchmark qualification is claimed.

Source, scripts, logs and fresh artifacts are retained with the report. Full core/all-server suites were not run locally. No new dependencies. New module has the NVIDIA SPDX header; commit has DCO sign-off.

@giuliolovisotto giuliolovisotto added bug Something isn't working area:agent Agent harnesses and Responses API agent behavior labels Oct 9, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

bxyu-nvidia
bxyu-nvidia previously approved these changes Oct 9, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team October 9, 2026 15:23
@yaoyu-33 yaoyu-33 added complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer labels Oct 9, 2026
@giuliolovisotto
giuliolovisotto added this pull request to the merge queue Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit f2695eb Oct 9, 2026
49 of 52 checks passed
@giuliolovisotto
giuliolovisotto deleted the codex/opencode-shared-runtime branch October 9, 2026 16:06
yaoyu-33 added a commit to yaoyu-33/Gym that referenced this pull request Oct 9, 2026
…DIA-NeMo#4251)

## What does this PR do?

Align conformance with NVIDIA-NeMo#4045: retained HTTP errors belong to an
invocation and may have zero or one step reference. Successful policy
responses still require a step; compaction calls remain separate. This
corrects the P0 check introduced in NVIDIA-NeMo#4192 without inventing turns for
failed HTTP exchanges.

Also pass the configured assistant-message header to the scripted Model
Server's capture middleware, matching normal Model Server startup. Tests
cover header retention on HTTP success/failure and reject duplicate
links or missing ownership.

The OpenCode plugin-loading commit was removed and replaced by the
separate shared-runtime PR NVIDIA-NeMo#4288. This PR only changes conformance
checks, probe wiring, their tests and documentation. It is rebased on
main `77509af61`.

## Validation

After removing the plugin-loading commit:

```bash
PYTHONPATH=$PWD python -m pytest \
  tests/unit_tests/harness_capabilities \
  scripts/harness_conformance/tests \
  tests/unit_tests/test_harness_conformance_checks.py -q
```

**342 passed, 2 skipped.** Full core and all-server suites were not run
locally. The all-files pre-commit check passed on the rebased branch
before removing the isolated plugin-loading commit.

The fresh four-harness probe run on the rebased branch, before that
split, gave OpenCode 5/7, Hermes 7/7, Pi 6/7, Codex 0/7. These are not
results for this final split: OpenCode additionally needs the separate
plugin setup. Hermes benefits from NVIDIA-NeMo#4048 now on main. Pi's two
provider-error classification unit failures remain separate (NVIDIA-NeMo#4285); its
HTTP-400 health expectation also remains unresolved. Codex retains
independent evidence gaps.

No fresh generative-model benchmark is needed for this diagnostic/probe
correction. No API migration or reward/scoring change. No new source
files; existing licenses retained. All commits have DCO sign-off.

---------

Signed-off-by: yaoyu-33 <[email protected]>
Ashish-Soni08 pushed a commit to Ashish-Soni08/Gym that referenced this pull request Oct 10, 2026
## What / expected

Add sandbox sessions to `opencode_agent` using the shared execute/close
lifecycle. An agent session runs OpenCode in a borrowed or agent-owned
sandbox; no session uses the local CLI. Close confirms cleanup before
Resources verifies. Invalid/closed sessions never fall back to the host.

- Include NVIDIA-NeMo#4288's shared runtime pin and model-call attribution plugin
in both paths.
- Keep failure artifacts and cleanup observations; cap combined
diagnostics at 16k characters. Local installation is off-loop and
retryable even after all waiters cancel; sandbox ripgrep provisioning is
best-effort.
- Remove the unshipped execution selector, old-adapter bridge and
obsolete cookie. Session requests use an explicit supported-field
contract.

Existing `opencode_sandboxed_agent` benchmarks, recipes and allowlists
stay unchanged; only four required PATH-quoting fixes remain in that
adapter. Shared-helper/fixture cleanup is tracked in NVIDIA-NeMo#4306.

## Compatibility / concerns

The shipped YAML now selects `${policy_model_name}` through Gym,
removing the fixed `nvinf` provider/model example. Removed local example
keys (`openai_api_key`, `openai_base_url`, `env`, `workspace_root`,
`system_prompt`, `extra_args`, `concurrency`) remain configurable class
fields. `thinking` now defaults to **true**, timeout changes **900 →
10800s**, and `resources_server: null` means local `/run` needs an
explicit binding. Install/close budgets are **600/60s**; owned sandboxes
need an explicit provider.

Local prompt compatibility is preserved; sandbox instructions use a
separate file. Sandbox `env`, custom `command` and `extra_args` are
rejected. Default permissions apply locally too; subagents are enabled
here but remain disabled in the old benchmark profile. These differences
can affect scores. One worker; eval-only, with training token capture
off by default. No new benchmark baseline is claimed.

Missing system `rg` warns and falls back to OpenCode's on-demand
download; required runtime prerequisites still fail explicitly. Offline
images should preinstall ripgrep. A separately identified input-upload
permission issue for non-root Docker with controller umask 077 remains
outside this fix; the model smokes below use a root image.

## Validation

Current head: `5cfdbae0d6167fb055342a5ad2faf89e261975f8`; merged main
`f128d43d3`. The conflict with NVIDIA-NeMo#4172 retains its `opencode db VACUUM
INTO` snapshot and our quoted PATH.

Pytest selection: both OpenCode agent suites,
`responses_api_models/vllm_model/tests`, and core
`test_sandbox_session`, `test_sandbox_supervisor_client`,
`test_agent_sessions`, `test_agent_session_retries`,
`test_add_legacy_agent_environment_servers`, `test_global_config`, plus
`test_ray_opt_out`, `test_server_utils` and `telemetry/test_config`
after merging main. Run with `--import-mode=importlib -q -o addopts=''
-o log_cli=false`; Linux exclusions are named below.

- macOS/Python 3.13.14 after merge: **1,382 passed / 43 skips** (39
platform/runtime; four optional `nemo.lens` integration tests). Final
all-file pre-commit and whitespace checks pass. The initial restricted
pre-merge run could not bind a test port; permitted reruns pass without
exclusions.
- Linux/Python 3.13.14 after merge: **1,419 passed / 4 skipped / 2
deselected**, including real Linux process-supervision, installer and
Node plugin tests. Skipped: optional `nemo.lens` integration. Excluded:
the previously reproduced vLLM endpoint-mtime failures
(`test_publish_rebinds_clients_and_clears_sessions`,
`test_unpublished_endpoint_grace_lifecycle`); those unchanged model
files match main. Canonical isolated `gym env test` and core-wide
coverage were not rerun.
- New regressions reproduce 11 pre-fix Linux installer failures
(uncached/cached, non-root, no package manager, apt/apk failures), the
cancelled-waiter retry failure and oversized combined diagnostics. The
fixed focused Linux suite passes **55 tests**; 502 and capture errors
share the same bound without duplicating stderr.
- Regression checks against the merge-only pre-fix snapshot reproduce
plugin/input, diagnostics, cleanup-observation and synchronous-parser
defects; the future-field check also fails before the allow-list fix.
- Smoke: real OpenCode **1.17.11**, `nvidia/nemotron-3-super-120b-a12b`,
Docker sandbox and stock math verifier. On runtime candidate
`68fd15170`, owned and borrowed episodes both score **1**, retain
tools/nonzero usage, carry message-ID headers on all three model calls,
and confirm cleanup before verification. The owned driver required
fixture/capture-path corrections; evidence was retained and the
successful episode was audited without a score-driven rerun.
- Post-merge borrowed smoke also passes: **reward 1**, **3/3 correlated
model calls**, **24,214 tokens**, tool-written answer, paired tool
output, retained observations and confirmed cleanup before verification.
Resources destroys the borrowed sandbox; task-scoped inventory is empty
after the run. The earlier pre-merge smoke also passed (24,262 tokens);
neither was rerun for score selection.
- These are bounded functional checks, not SWE-Pro accuracy validation.
Full current-head CI and maintainer approval remain separate gates; no
CI trust-gate authorization is implied.

<details>
<summary>Earlier benchmark evidence (not rerun on this head)</summary>

At `da85bf9ef` (documentation-only follow-up `52d8e12df`), the HSG
SWE-Pro smoke completed official grading with **reward 0**, **161/178
tests passed**. The model hit its output limit without producing a
patch. Existing direct/local and borrowed-sandbox smoke evidence remains
revision-pinned in the PR history; it is not a score baseline for this
revision.

</details>

---------

Signed-off-by: yaoyu-33 <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 3c1a2b7e Deployed Oct 9, 2026 by copy-pr-bot[bot] via release / finalize / notify #4859
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 complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants