Skip to content

[chore] Add OpenCode harness on local sandbox#5044

Draft
junaway wants to merge 1 commit into
big-agentsfrom
chore/add-harness-opencode
Draft

[chore] Add OpenCode harness on local sandbox#5044
junaway wants to merge 1 commit into
big-agentsfrom
chore/add-harness-opencode

Conversation

@junaway

@junaway junaway commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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 -acp shim, so it needed its own model-id contract and capability wiring.

Changes

Adds OpencodeAgentTemplate + make_harness wiring in the Python SDK, the run-plan.ts acpAgent mapping, and capabilities.ts updates for the local sandbox. OpenCode accepts provider/model ids (not bare, unlike Codex) since it's multi-provider; the daemon skips session/set_mode for it, so plan-mode support is off. Uses the official upstream anomalyco/opencode release (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

  • New/updated coverage: 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 fixture run_request.opencode.json.
  • This branch is a base for chore/add-opencode-daytona and chore/add-opencode-e2b (their PRs target this branch, not big-agents).

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>
Copilot AI review requested due to automatic review settings July 2, 2026 21:40
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 2, 2026 9:40pm

Request Review

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. tests labels Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a0bf56b2-e175-49b4-a1af-648d965399ce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-harness-opencode

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

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, and OpencodeHarness in the Python SDK, including capability publishing for OpenCode’s provider/model model-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.

Comment on lines +83 to +85
for provider in _OPENCODE_PROVIDERS:
if provider in supported_llm_models:
out[provider] = [f"{provider}/{m}" for m in supported_llm_models[provider]]
Comment on lines +142 to +144
assert model_id.startswith(f"{provider}/"), (
f"opencode model id '{model_id}' is not provider-prefixed"
)
@jp-agenta jp-agenta marked this pull request as draft July 2, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants