[chore] Add OpenCode harness on local sandbox#5044
Conversation
Plain managed provider key (no Zen), planMode=false, opencode ACP agent mapping, capabilities for both provider families, golden wire fixture, unit tests, adapter doc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds first-class OpenCode harness support for the local sandbox across the Python SDK (DTOs, harness adapter, capability table) and the Node runner (ACP agent mapping + capability fallback), with contract goldens and unit tests to lock the wire shape and behavior.
Changes:
- Introduces
HarnessType.OPENCODE,OpencodeAgentTemplate, andOpencodeHarnessin the Python SDK, including capability publishing for OpenCode’sprovider/modelmodel-id contract. - Wires
harness="opencode"through the runner run-plan and capability fallback (plan mode disabled; MCP tools enabled). - Adds/updates golden fixtures and unit tests in both Python and TypeScript to assert the wire contract and runner normalization.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| services/runner/tests/unit/wire-contract.test.ts | Adds OpenCode golden coverage and opencode-specific wire invariants. |
| services/runner/tests/unit/sandbox-agent-run-plan.test.ts | Adds run-plan normalization tests for local OpenCode runs and API-key heuristic behavior. |
| services/runner/tests/unit/sandbox-agent-capabilities.test.ts | Adds capability static-fallback expectations for OpenCode (planMode off). |
| services/runner/src/engines/sandbox_agent/run-plan.ts | Documents and maps harness -> acpAgent including opencode; keeps legacy api-key heuristic plumbing. |
| services/runner/src/engines/sandbox_agent/capabilities.ts | Updates static fallback capability mapping to disable planMode for OpenCode. |
| sdks/python/oss/tests/pytest/unit/agents/test_wire_contract.py | Adds OpenCode request serialization coverage vs golden. |
| sdks/python/oss/tests/pytest/unit/agents/test_harness_identity.py | Extends harness identity set to include opencode. |
| sdks/python/oss/tests/pytest/unit/agents/test_harness_adapters.py | Adds adapter-level behavior tests for OpenCode (drop built-ins, tool wire shape, make_harness mapping). |
| sdks/python/oss/tests/pytest/unit/agents/golden/run_request.opencode.json | Adds OpenCode /run request golden fixture. |
| sdks/python/oss/tests/pytest/unit/agents/connections/test_capabilities.py | Extends capability document tests to include OpenCode providers/models/deployments. |
| sdks/python/agenta/sdk/agents/dtos.py | Adds HarnessType.OPENCODE, HARNESS_IDENTITIES entry, and OpencodeAgentTemplate. |
| sdks/python/agenta/sdk/agents/capabilities.py | Adds OpenCode harness connection-capability publishing (providers, deployments, model selection). |
| sdks/python/agenta/sdk/agents/adapters/sandbox_agent.py | Declares OPENCODE as a supported harness for the sandbox-agent backend. |
| sdks/python/agenta/sdk/agents/adapters/harnesses.py | Implements and registers OpencodeHarness adapter. |
| sdks/python/agenta/sdk/agents/adapters/init.py | Re-exports OpencodeHarness from adapters package. |
| sdks/python/agenta/sdk/agents/init.py | Re-exports OpenCode harness/template symbols from top-level agents package. |
| docs/design/agent-workflows/projects/add-harness-opencode/tasks.md | Adds implementation task breakdown for OpenCode harness work. |
| docs/design/agent-workflows/projects/add-harness-opencode/specs.md | Adds locked specs/acceptance criteria for OpenCode harness behavior. |
| docs/design/agent-workflows/projects/add-harness-opencode/research.md | Adds research notes capturing daemon behavior constraints (SSE ACP, plan-mode skip, no Zen). |
| docs/design/agent-workflows/documentation/adapters/opencode.md | Adds adapter documentation for credentials, model ids, plan-mode constraint, and tool delivery behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for provider in _OPENCODE_PROVIDERS: | ||
| if provider in supported_llm_models: | ||
| out[provider] = [f"{provider}/{m}" for m in supported_llm_models[provider]] |
| assert model_id.startswith(f"{provider}/"), ( | ||
| f"opencode model id '{model_id}' is not provider-prefixed" | ||
| ) |
Context
OpenCode was the third missing harness. Unlike Codex it's multi-provider, and unlike both Pi and Claude it speaks ACP natively over SSE rather than through an
-acpshim, so it needed its own model-id contract and capability wiring.Changes
Adds
OpencodeAgentTemplate+make_harnesswiring in the Python SDK, therun-plan.tsacpAgent mapping, andcapabilities.tsupdates for the local sandbox. OpenCode acceptsprovider/modelids (not bare, unlike Codex) since it's multi-provider; the daemon skipssession/set_modefor it, so plan-mode support is off. Uses the official upstreamanomalyco/opencoderelease (not a fork), plain managed provider keys only — no OpenCode Zen integration, since Zen is a third-party gateway the daemon marks experimental.Tests / notes
test_harness_adapters.py,test_wire_contract.py,sandbox-agent-capabilities.test.ts,sandbox-agent-run-plan.test.ts,wire-contract.test.ts, plus a golden fixturerun_request.opencode.json.chore/add-opencode-daytonaandchore/add-opencode-e2b(their PRs target this branch, notbig-agents).