Repository navigation
feat(opencode): support OpenCode v2 alongside v1 - #6001
Conversation
opencode_version 2.x selects OpenCode 2 through the same adapter; 1.17.11 stays the default. OpenCode 2 changed its config schema, plugin API, session store and export/import commands, so opencode2/ adds the v2 config and command line, one Gym plugin directory, and a translator from the v2 store into the OpenCode 1 tables the shared readers parse. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…t note Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
… read Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test fc9d9e6 |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…pinned digests Drop configs/opencode2_agent.yaml: OpenCode 2 is a value of opencode_agent's opencode_version, not a separate agent variant, so opencode_agent keeps one variant as the benchmark-profile and permission-profile tests expect. Mark the pinned release SHA-256 digests for the secrets detector. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 7dc0851 |
Signed-off-by: yaoyu-33 <[email protected]>
cmunley1
left a comment
There was a problem hiding this comment.
Thanks for keeping OpenCode 1 as the default; the v1 launch path and installer args look unchanged, SHA-256 pinning is enforced with a hard fail on mismatch, all four Linux assets match the arch selection, and every v2 command passes --standalone. A few things before this leaves draft:
sandbox.pyreadable_store(~726-746): any failure reading the label file is treated as "no labels". In continued sessions the earlier activations are then not filtered by message id (snapshot.py:37), so earlier turns come back as new output and are counted again inusage_messages. Could a read failure raise (or mark the observation incomplete) instead of falling back?opencode2/store.py(translate_store,_content_part): unknown message types, unknown part types, and tool states outside the completed/error branches are dropped silently. If a later 2.x release adds a type, turns would vanish from trajectories with no error. Suggest raising or recording an observation gap on unknown shapes.opencode2/plugin/index.jshas no test that executes it (the tests check the upload)._session_inputnow forwards temperature/top_p for v2 based on this plugin, so a wrong hook name or event shape (session.hook("context"),shell.hook("create.before"),event.subscribe) would silently sample at defaults. A smoke test against a real 2.2.7 binary, or a check that the hook actually fired, would catch this.opencode2/config.py:95: Code Modeexecutestays enabled, which exposes OpenCode's own tools (sessions, worktrees, models) beyond what v1 offered. Worth disabling by default for RL/eval parity.opencode2/config.pysession_config: onlypermission,tools,compaction,agent,attachmentare forwarded; otheropencode_configkeys are ignored without a warning.setup_opencode.pyensure_opencode2:urlretrievehas no timeout and runs under the install lock, so a stalled download blocks every local call.
Could not verify without a 2.2.7 binary: that the store always has a session_part table, that v2 usage matches _session_usage, that the OPENCODE_DISABLE_* env vars are honored, and whether --standalone spawns children in the local path (where proc.kill() only kills the parent).
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 395b4e0 |
- Store translation reports what it cannot translate (message, content, tool and compaction types outside OpenCode 2.2.7's schema, user skill text) as a harness_records_untranslated gap instead of dropping it. - Model-call labels are read only with capture on, accumulate across captures, and never rename a reply an earlier capture named; an unreadable label file becomes a model_call_labels_unavailable gap. This stops earlier turns from coming back as new output in continued sessions. - Code Mode is off: execute is denied after every other permission rule and the plugin removes the tools OpenCode offers only through Code Mode. - An error OpenCode continued after (a stream that broke after output) is kept as recoveredError, so only an error on the last reply fails the run. - A retried call's last label names its reply; completed compactions carry a step-finish part so local usage counts them. - Local OpenCode 2 calls run with the sandbox isolation and a fixed title, and the release download has a read timeout and an overall deadline. - Tests: a Node test that runs the plugin against a stand-in context, label stability across captures, untranslated-record gaps, recovered errors and the bounded download. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test e5c53c0 |
|
Thanks @cmunley1, all six are addressed in 903ae35 (README follow-up e5c53c0). I checked each against the 2.2.7 source (
On the points you could not verify without a 2.2.7 binary:
An internal review turned up a few more changes in the same commit:
Smoke after the fixes, at e5c53c0: The workstation used Docker sandboxes lent by the Terminal-Bench 2.1 Resources Server through
A local-path request (unseeded, |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
Three RISK findings affect local OpenCode 2 execution and setup. I found no additional qualifying issues in the sandbox launch and capture paths.
I inspected all 18 changed files and traced their affected callers and tests. This was static inspection; I did not execute tests or reproduce the reported model smokes. OpenCode 2's upstream source and release assets are not mounted, so I could not independently verify their contracts or digest values. Suggested code below is unexecuted and needs verification before adoption.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| if self._opencode2: | ||
| # OpenCode 2 takes its configuration from the environment, which keeps it out of a persistent repo, and | ||
| # its directory from PWD. The sandbox sessions' isolation keeps its hosted free models out of the run. | ||
| env["OPENCODE_CONFIG_CONTENT"] = json.dumps(self._build_opencode2_local_config(rollout_id, label_file)) |
There was a problem hiding this comment.
RISK: Preserve the owner's local configuration override
With opencode_version: "2.2.7", configure opencode_config.permission: {"*": "allow"} and env.OPENCODE_CONFIG_CONTENT: '{"permission":{"edit":"deny"},"compaction":{"auto":false}}'. _env carries the owner's override into the environment, but this assignment replaces it. Neither restriction reaches OpenCode. This affects unseeded requests and legacy local episodes. V1 keeps this override, and the existing replacement-config test explicitly protects that precedence.
Could you merge inherited configuration before enforcing the v2 helper's Gym-owned requirements? In _build_opencode2_local_config, add a keyword-only inherited: Mapping[str, Any] | None = None parameter and insert this immediately after building config:
self._deep_merge(config, copy.deepcopy(dict(inherited or {})))Replace the assignment here with:
inherited = json.loads(env.get("OPENCODE_CONFIG_CONTENT", "{}"))
env["OPENCODE_CONFIG_CONTENT"] = json.dumps(
self._build_opencode2_local_config(
rollout_id, label_file, inherited=inherited
)
)Keep the rest of the helper after that merge: code_mode_off must still put execute: deny last, and the Gym plugin must still be appended after owner plugins. Keep the invocation's replacement prompt applied last. The invariant is that owner configuration survives unless an explicit Gym-owned requirement overrides it.
Proposed checks, not executed: extend the local-v2 fake-binary test with the override above and nested agent.build.steps. Assert that edit: deny, compaction.auto: false and the step limit survive in the subprocess configuration in both prompt modes. In replacement mode, assert that the request prompt is added without deleting those settings. An inherited execute: allow must still become deny, owner plugins must coexist with the Gym plugin, and the existing v1 assertions must stay unchanged.
| if self._opencode2 and db_path.is_file(): | ||
| translated = data_home / "opencode" / "sessions.db" | ||
| labels = message_labels(label_file.read_text()) if label_file.is_file() else {} | ||
| untranslated = await asyncio.to_thread(translate_store, db_path, translated, labels=labels) |
There was a problem hiding this comment.
RISK: Count persisted usage from recovered streaming failures
A local v2 run with a partial reply carrying provider.transport, followed by a successful continuation, under-reports usage. The translator keeps the first reply's token counters in message info, but clears its finish and emits no step-finish part (translation). The local path then uses parse_opencode_session, which counts tokens only from those parts (reader). The broken stream's persisted usage disappears. Sandbox sessions instead count assistant-message counters through _session_usage.
Could you make local v2 accounting use those message counters, without adding a successful finish marker to a recovered reply? One scoped implementation is to add this helper to the translator module:
def local_usage(database: Path) -> dict[str, int]:
with closing(sqlite3.connect(f"file:{database}?mode=ro", uri=True)) as con:
infos = [_json(row[0]) for row in con.execute("select data from message")]
totals = {"input_tokens": 0, "output_tokens": 0, "reasoning_tokens": 0}
for info in infos:
if info.get("role") != "assistant":
continue
tokens = info.get("tokens") or {}
cache = tokens.get("cache") or {}
reasoning = int(tokens.get("reasoning") or 0)
totals["input_tokens"] += (
int(tokens.get("input") or 0)
+ int(cache.get("read") or 0)
+ int(cache.get("write") or 0)
)
totals["output_tokens"] += int(tokens.get("output") or 0) + reasoning
totals["reasoning_tokens"] += reasoning
return totalsImport it in the app and, immediately after the existing output/usage parsing, override only local v2 usage:
if self._opencode2 and not timed_out and db_path.is_file():
usage = await asyncio.to_thread(local_usage, db_path)This keeps v1 accounting and timeout behavior unchanged. Every persisted assistant call, including subagents and compactions, must contribute its measured usage once; recovery must not manufacture a successful finish or hide a final error.
Proposed checks, not executed: run the recovered-stream fixture through the local response path. Its two TOKENS values should produce 210 input, 18 output and 4 reasoning tokens, rather than 105, 9 and 2. Retain both turns and the completed recovery outcome. A single successful call should still count once. Keep the completed-compaction usage assertion and the final-error failure assertion unchanged.
| """Write ``url`` to ``target`` within the download bounds, raising ``TimeoutError`` past either.""" | ||
| deadline = time.monotonic() + _DOWNLOAD_TIMEOUT_S | ||
| with urllib.request.urlopen(url, timeout=_DOWNLOAD_READ_TIMEOUT_S) as response, target.open("wb") as file: # noqa: S310 | ||
| while chunk := response.read(1 << 20): |
There was a problem hiding this comment.
RISK: Enforce the overall deadline while a download read is pending
_download checks its 600-second deadline only after response.read(1 << 20) returns. A slow-drip response that keeps the read pending beyond that deadline is not interrupted by this check. The timeout passed to urlopen is an inactivity bound, not enforcement of this absolute deadline. Because the download runs under install_lock and local callers share the setup task, this can hold other first calls for that version past the documented ten-minute limit.
Could you enforce the absolute deadline across pending reads as well as between reads? Keep the inactivity timeout, SHA-256 verification and atomic binary publication. The exact bounded-reader implementation needs verification against the supported Python runtime, so I am not proposing an unchecked replacement. The invariant is that continued network progress cannot extend the overall installation-download budget indefinitely.
The current stall test returns immediately from every fake read, so it exercises the deadline check but not a read spanning the deadline.
Proposed regression, not executed: use a local HTTP server with a large response and a shortened overall deadline. Send bytes more frequently than the inactivity timeout while keeping the requested read incomplete past the overall deadline. Expect TimeoutError near that deadline, a released install lock and no published binary. A subsequent normal download must install successfully. Retain the successful reuse and digest-mismatch assertions, and separately verify that a response delivering no data still hits the inactivity timeout.
cmunley1
left a comment
There was a problem hiding this comment.
Thanks for the quick fixes. Re-checked against a live run (SWE-Pro rows in OpenSandbox, v1.17.11 vs v2.2.7): v2 runs end to end, store translation and message counts match, usage is populated, and v1 is unchanged. Remaining deployment notes are non-blocking.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43746057626 |
What
opencode_agentcan now run OpenCode 2 next to OpenCode 1.opencode_version: "2.2.7"on the agent selects it; OpenCode 1.17.11 stays the default, so every existing config and recipe runs unchanged. OpenCode 1 will be deprecated later, not in this PR.Why: users now reach for OpenCode 2, and one team hit a limit in OpenCode 1. Support it beside OpenCode 1 first so old recipes keep working, and move recipes over once the benchmark recipes are validated on the new path. No issue is linked: the request came from a user team directly.
What OpenCode 2 is, and the pin
Upstream (
anomalyco/opencode, formerlysst/opencode) releases OpenCode 2 as 2.x: npm@opencode/cli(platform packages@opencode/cli-linux-x64, ...) and the sameopencode-linux-*GitHub release assets as 1.x, now with aSHA256SUMS. npmopencode-aistays on 1.x (latest= 1.19.5). This PR pins 2.2.7 (released 2026-11-10), with the SHA-256 of each Linux asset inruntime.OPENCODE_RELEASE_SHA256.OpenCode 2 is a rewrite. What an integrator sees:
--version1.17.11opencode v2.2.7--standalone(andsession export/importstart one)plugin: ["file:///x.mjs"], factory withchat.headers,shell.env,chat.paramsplugins: [{package: "file:///dir", options}],export default {id, setup}, hooksmodel.request,shell create.before,session context/prompt/compaction; a file path is rejected@opencode-ai/plugininstalled into the config dir at every start (~63 MB)session,message,partsession_v2, typedsession_message(oneassistantmessage per model step, content inline),compaction,synthetic,idle, ...{name: APIError, data: {statusCode, isRetryable}},ContextOverflowErrorbash,task,list,todowrite/read, ...shell,subagent,read(lists dirs),question, Code Modeexecute(off in Gym, see below);todowriteoff in releasestemperature/top_pattachment.imagemedia.image, plus PNG→JPEG re-encoding unlessauto_resize: falseDesign: a version switch inside
opencode_agentI chose a switch selected by
opencode_versionover a separate agent:opencode2_agentinstance config. Agent variants are the configs directly inconfigs/, each a separately runnable agent, while overlays such asprofiles/andpermissions/are not variants; the benchmark-profile and permission-profile tests pinopencode_agentto its single variant. The OpenCode version is a setting on that agent like the permission profile, so a recipe selects it in its ownopencode_agentblock (README "OpenCode 2").opencode_agent/opencode2/:config.py: the OpenCode 2 configuration (provider/model/plugins/MCP/media in its own schema; the session'sopencode_configkeys stay in OpenCode 1 form, which OpenCode 2 migrates) and therun --standalonecommand line.plugin/index.js: one plugin directory replacingtask_environment.mjs,required_mcp.mjsandassistant_message_header.js.store.py: translates the OpenCode 2 store into the OpenCode 1 tables, sosnapshot,artifacts,observability, usage, output conversion andclassify_opencode_runare shared. It also has the OpenCode 2 step-limit count.app.py/sandbox.pybranch only where the interfaces differ (installer digests, plugin staging, launch config,session export/import, store translation). The v1 launch block moved into_opencode1_launchunchanged; v1 commands and files are byte-identical (the v1 suite passes unmodified).Feature parity (every v1 feature on main → OpenCode 2)
sandbox_access),network_access: inheritonlymodel_only/model_and_toolsegressAgentSeedRejectedErrorrefusalssandbox_plugin_dependencies_*and for a 2.x version without pinned digests (unless a binary is pinned)--versionhealth checkopencode v<version>; new: each 2.x download is checked against the pinned SHA-256 (v1 downloads are unchanged, still version-checked only)sandbox_executable_path/_sha256,sandbox_path_prefix(offline runtime)sandbox_ripgrep_*)XDG_CACHE_HOME/opencode/bin/rgsandbox_plugin_dependencies_*)task-environment.ready),runtime.jsonOPENCODE_DISABLE_PROJECT_CONFIG/AUTOUPDATE/MODELS_FETCH, private HOME/XDG)OPENCODE_DISABLE_FREE_MODELS, aprovider.usepolicy fornemo_gymonly, and--standaloneon every commandshell create.beforehooksystem_prompt_modeappend (instructions file) / replace (agent.build.prompt,{escaped){env:}/{file:}sandbox_model_id,thinking,interleaved reasoning_contentcapabilities.reasoning,compatibility.reasoningFieldcontext_window/max_output_tokenslimit.{context,input,output};OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAXno longer existstemperature/top_pon every call;max_output_tokens≥ configured accepted; other controls 422context/compactionhooks (OpenCode 2 ignores per-agent sampling); the 1.17.11-only agent list does not applyopencode_configallowlist (permission,tools,attachment,compaction.auto,agent.build.steps)bash→shell,task→subagent);attachment→mediaconfigs/permissions/default.yaml,configs/profiles/*webfetch/websearchhidden.skillstays listed (OpenCode 2 applies that rule per skill; the private HOME has none)session_project_configplugins[ -d ]check); OpenCode 1 plugin files cannot load in OpenCode 2split_text_and_media→stage_media→--file; 422 for system images / URLs / unsupported typesimage_input,IMAGE_INPUT_MODEL_OPTIONS, sticky across activationscapabilities.input; a text-only session now declares["text"]explicitly (OpenCode 2's default for an unknown model includes images)UNRESTRICTED_IMAGE_ATTACHMENT(bytes unchanged),attachmentoverrideUNRESTRICTED_MEDIAaddsauto_resize: false, which also stops PNG→JPEG re-encoding; probe: a 10.5 MB 2200×1600 PNG reached the model byte-identicalread, MCP image content)oauth: false, timeout; tools<grant>_<tool>mcp.servers,codemode: false(OpenCode 2 otherwise hides MCP tools behindexecute), timeout → startup/catalog/executionrequired_mcp.mjs: status before the first model call, required → fail, optional →mcp_server_skipped, unconfirmed → failprompt/contexthooks; it waits for pending servers (OpenCode 2 gives them only a 2 s grace) and writes the samemcp-status.jsonX-Session-Id(activation-scoped in continuation)model.requesthook; overrides OpenCode 2's own value, which names the parent for subagentsX-OpenCode-Assistant-Message-Id(call→turn join for capture)checked_versionsexport.json,observations.dbshellexit codes read likebashexport_dir(sessions.json, per-session export, events)opencode session export --standalone, OpenCode 2's JSON formatsession_import_pathopencode session import --standalone --directory <workdir>; takes OpenCode 2 exports onlyresume_harness_session,--session, per-activation dirs)--sessionresumes the same sessionlength/content-filterpermission_denied)APIErrorstatus →model_request_error, retryable transport →model_transport_error,ContextOverflowError→ context limitmodel_request_error/400, context-length 400 (compaction off) →model_context_limitcompaction.auto: falseagent.build.steps+harness_step_limit_reachedtool_choice: noneat the limit; compaction does not count as a step/v1/responses).opencode_runtime/<version>(checked digest);commandmay name another binary/runwithresources_server, relay configs/rungoes through the local pathBehavior that differs (visible to a recipe)
executeafter every otherpermissionrule, and the Gym plugin removes the tools OpenCode offers only through Code Mode (opencode_*: sessions, worktrees, models, schedules, artifacts, MCP resources). Denyingexecutealone would offer those tools directly, andopencode_worktree_removeuses theeditpermission, so no rule could hide it.recoveredError; only an error on the last reply fails the run.max_output_tokens, OpenCode 2 asks the model to continue, twice. A third truncated reply ends the run with anoutput-limiterror and exit code 1, so the run is reported as failed. OpenCode 1 reports a run whose last reply was truncated as incomplete (max_output_tokens).mcp_tool_timeout_secondsunset, an MCP call may run 12 hours (OpenCode 2's default).todowriteis off in OpenCode 2 releases.Validation
Checks at the current head
7dc08515f(merged withorigin/mainat33a4989380; the merge's one conflict was the harness table inintegrate-existing-agents.mdx), on a Linux workstation:responses_api_agents/opencode_agent/tests: 974 passed, 1 failed, 23 skipped. The failure,test_pinned.py::test_stage_executable_rejects_wrong_or_broken_bytes_without_installing[format], is environmental: that host's/bin/sh(dash) exits 2 on "Exec format error" where the test expects 126. This PR does not touchpinned.pyor its test.tests/unit_tests/environment/{test_session_harness_benchmark_profiles,test_agent_registry}.py,cli/test_cli_agents.py,tooling/test_agent_environment_{default_configs,session_templates}.py,test_session_contract_repo.py,models/test_token_capture_harness_notes.py, the OpenCodetest_existing_benchmarks.py): 125 passed, includingtest_profile_is_not_a_standalone_agent_variant[opencode_agent], which failed in CI atfc9d9e62b.tests/unit_tests+scripts/harness_conformance/tests) on this branch and onorigin/main, same host and environment: the same 454 failures/errors on both and none only on this branch (they need git metadata and packages that environment lacks); 22,159 passed on each.detect-secrets1.5.0 finds nothing new in the changed files; without the# pragma: allowlist secretmarks it reports exactlyruntime.py:21-24, as CI did. Its one other hit, theapiKey: "dummy_key"line of the OpenCode 1 config inapp.py, is unchanged from main.pre-commit run --files <changed files>: passed, no files modified.test_opencode2_store.py(12),test_opencode2_session.py(16), 4 OpenCode 2 installer cases intest_install_runtime.py(Linux-only).Scripted-model probes (no real model): the real OpenCode 2.2.7 binary (macOS arm64 build) with the adapter's own
session_config, plugin, translator and readers, against a loopback Chat Completions stub that logs every request:X-Session-Id= sessionfailed/tool_error, run completed; recorded error JSON = the tool message the model gotagent.build.steps: 2tool_choice: none;harness_step_limit_reacheddetectedAPIError400 →model_request_error, reported like v1compaction.auto: falseContextOverflowError→model_context_limitreadof a PNGtask_tools_lookup/task_tools_chart; text result and MCP image reach the model; statusconnectedfailed (ECONNREFUSED), run exits 1 before any model callsubagentcall; per-sessionX-Session-Idand labels; all calls joinedautomatic; primary calls joined--sessionresume,session export,session import --directoryReal-model smokes, OpenCode 1 (1.17.11) vs OpenCode 2 (2.2.7) on the same rows, this branch at
fc9d9e62b(later commits only merge main, mark the digests and drop the instance config; the smoke configs setopencode_versiondirectly): Linux workstation, Docker sandboxes, hosted NIMnvidia/nemotron-3.5-super-vl-120b-a12bthrough the vLLM Model Server (thinking off), concurrency 1, model-call capture on,gym eval health-checkandscripts/inspect_harness_conformance.py --require-sandboxon every run.regex-log(single_agent_turn, README settings:context_window: 32768,max_output_tokens: 8192)fix-gitexample_mcp_weatherget_weatherover the episode's MCP grant (resources_tool_transports: [mcp])evaluation_completed; the rest fulfilledcircle_count(PNGinput_image+ text)circle_count); TE-5 where a row makes no tool callimage_input: true, the model opens it withreadWhat was checked in the saved artifacts:
Model responses: 0 faultedon every run.bash/write/read, v2shell/execute/glob/read/edit, and the MCP toolexample_mcp_weather_get_weatheron both).readresults, on both versions.harness_execution: sandbox, the agent closed before verification, the verifier ran (evaluation_completed: true); no sandbox containers or server processes were left.get_weathercall (tool_call_seen: true) on both versions.fix-gitpass and its tool-image miscount (11 for 10, the same miscount this model gives when asked directly) are model variance.example_mcp_weatheroverridesseed_sessionwith a reply that has noresources_session_id, so a typed seed from an Environment Server fails validation for every harness (v1 and v2 failed identically). For this smoke it was ported locally to the session-state hooks; that fix is not part of this PR.Not covered
allowed_agentsdeclarations match the agent type, so OpenCode 2 inheritsopencode_agent's declarations; recipes should be revalidated on OpenCode 2 before switching.opencode_versionvariant needs a small runner change (follow-up).session.retryhook).Expected conflicts with open PRs
All build on main; none is changed here. Files they share with this PR:
app.py,runtime.py,sandbox.py,README.md— adds a v1 plugin; OpenCode 2 needs the hook-based equivalent.app.py,README.md, tests. fix(opencode): add a verified musl runtime pin and relay runtime settings to sessions #5401:app.py,install_opencode_runtime.sh,sandbox.py, installer tests. feat(opencode): resume OpenCode in place on sandboxes whose snapshots keep processes #5413:app.py,sandbox.py,README.md. feat(opencode): pause at checkpoints and resume after a crash #5268:app.py,sandbox.py,snapshot.py(its resume reads the OpenCode 1 store; OpenCode 2 sessions would need the translator). fix(opencode): optionally pass the prompt to opencode run verbatim #4284, fix(opencode): align timeout completion status #4233:app.py,test_app.py. feat(opencode): per-row sandbox inputs, model id, streamed uploads #5904, fix(opencode-agent): stable sessions under token capture #5657: onlyopencode_sandboxed_agent— no overlap._session_response: this PR moves the OpenCode 1 config block into_opencode1_launchunchanged.CI repair validation (2026-11-14)
Merged current
mainand resolved theapp.pyimport conflict: retain OpenCode 2 imports and use main's explicitlegacy_app.pyrelay. No OpenCode 2 runtime behavior changed.Linux workstation, Python 3.13.14, Node 22.22.2, frozen component environment:
python -m pytest responses_api_agents/opencode_agent/tests -q -o addopts='': 972 passed, 9 skipped, 1 failed. The sole failure is the existingtest_pinned.py::test_stage_executable_rejects_wrong_or_broken_bytes_without_installing[format]: this workstation's/bin/shreports exit 2 for invalid executable bytes; the test expects 126. The production staging helper correctly rejects the bytes with exit 3. Both the helper and the test are byte-identical to currentmain; this is the previously recorded workstation shell limitation.pre-commit run --all-files(pre-commit 4.2.0): passed.git diff --check: passed. Merge commit has DCO sign-off.Review round (2026-11-14)
Head
e5c53c047b. It merges currentmain(d4b0b61594; the same tree as395b4e0278) and addresses @cmunley1's review plus an internal review against the add-harness checklist. Each change was checked against the OpenCode source at tagv2.2.7.What changed (
903ae35d9d):translate_storereturns what it could not translate: message types, assistant content types, tool or compaction statuses outside the 2.2.7 schema, and a user message's skill text. The adapter records these as aharness_records_untranslatedgap instead of dropping them silently.model_call_labels_unavailablegap.recoveredError, so only an error on the last reply fails the run.step-finishpart, so local usage counts them.--title. The release download has a 60 s read timeout and a 10-minute deadline.Validation:
responses_api_agents/opencode_agent/testswithtest_session_contract_repo.pyandtest_token_capture_harness_notes.py, on a Linux workstation: 982 passed, 1 failed, 24 skipped.test_pinned.py::...[format]workstation-shell case described above.plugin/index.jsagainst a stand-in for the 2.2.7 plugin context.pre-commit runon the changed files: passed.Real-model smoke, same rows on both versions:
regex-logandfix-gitthroughsingle_agent_turn, in sandboxes lent by its Resources Server, with the README settings. Model: hosted NIMnvidia/nemotron-3.5-super-vl-120b-a12b, thinking off.temperature: 0.3andtop_p: 0.9. Model-call capture was on, concurrency 1.regex-log,fix-git)evaluation_completed,harness_executionsandboxsandboxinspect_harness_conformance.py --require-sandboxtemperature/top_pbash,edit,glob,grep,read,task,todowrite,writeedit,glob,grep,question,read,shell,skill,subagent,writeOn the v2 servers, a local-path request downloaded the pinned release through the bounded download and answered correctly. No sandbox containers or OpenCode processes were left after either run.
Still not covered, beyond "Not covered" above:
max_output_tokens, as OpenCode 1 reports a truncated last reply, is open.compaction_model_call_boundary_unavailable.🤖 Generated with Claude Code