Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions profiles/agent-opencode.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# OpenCode agent configuration.
#
# OpenCode uses ANTHROPIC_BASE_URL with inference.local/v1 (note the /v1 suffix).
# Without /v1, OpenCode sends POST /messages instead of POST /v1/messages,
# which doesn't match the inference route pattern.
# See: https://github.com/NVIDIA/OpenShell/blob/main/docs/providers/google-vertex-ai.mdx
#
# Usage:
# harness up -f agents/opencode.yaml
# harness up --agent opencode
# harness apply --agent opencode

name: opencode-agent
entrypoint: opencode
Expand All @@ -17,6 +21,7 @@ providers:
JIRA_USERNAME: ${JIRA_USERNAME}
- profile: gws

# OpenCode needs /v1 suffix on ANTHROPIC_BASE_URL (different from Claude Code).
env:
OPENAI_BASE_URL: https://inference.local/v1
OPENAI_API_KEY: sk-ant-openshell-proxy-managed
ANTHROPIC_BASE_URL: https://inference.local/v1
ANTHROPIC_API_KEY: sk-ant-openshell-proxy-managed
6 changes: 3 additions & 3 deletions profiles/images/sandbox-default/opencode.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"atlassian": {
"type": "local",
"command": "/sandbox/.venv/bin/mcp-atlassian",
"args": [],
"command": ["/sandbox/.venv/bin/mcp-atlassian"],
"enabled": true,
"env": {
"environment": {
"READ_ONLY_MODE": "true"
}
}
Expand Down
9 changes: 4 additions & 5 deletions test/configs/agent-opencode-vertex.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# OpenCode with Vertex AI via inference.local proxy.
# OpenCode uses OpenAI-compatible API at inference.local/v1.
# The proxy translates to Vertex AI Anthropic models.
# OpenCode with Vertex AI via inference.local/v1.
# OpenCode uses ANTHROPIC_BASE_URL (not OPENAI_BASE_URL) with /v1 suffix.
# Requires: gcloud auth application-default login, ANTHROPIC_VERTEX_PROJECT_ID.
name: test-opencode
entrypoint: opencode
providers:
- profile: vertex-local
env:
OPENAI_BASE_URL: https://inference.local/v1
OPENAI_API_KEY: sk-ant-openshell-proxy-managed
ANTHROPIC_BASE_URL: https://inference.local/v1
ANTHROPIC_API_KEY: sk-ant-openshell-proxy-managed
7 changes: 2 additions & 5 deletions test/suite/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ if $LIVE && "$CLI" inference get >/dev/null 2>&1; then
"$CLI" sandbox exec --name test-agent-int -- \
bash -c 'result=$(echo "respond with ok" | claude --print 2>&1); test -n "$result"'

# OpenCode uses inference.local/v1 (OpenAI-compatible) via the proxy.
# OpenCode uses ANTHROPIC_BASE_URL=inference.local/v1 (note /v1 suffix)
SANDBOXES_TO_CLEAN+=(test-opencode-int)
run_test "agent: opencode inference via vertex" \
bash -c '"$1" apply -f "$2" --name test-opencode-int >/dev/null 2>&1 && \
Expand Down Expand Up @@ -340,16 +340,15 @@ if $LIVE && "$CLI" inference get >/dev/null 2>&1; then
fi
else
skip_test "agent: claude inference via vertex" "sandbox not ready"
skip_test "agent: opencode inference via vertex" "sandbox not ready"
skip_test "agent: github via gh cli" "sandbox not ready"
skip_test "agent: claude uses jira mcp" "sandbox not ready"
skip_test "agent: gws gmail via proxy token" "sandbox not ready"
skip_test "agent: opencode built-in profile" "sandbox not ready"
fi

# Test the built-in opencode profile (--agent opencode) with all providers.
# Verifies the shipped profile works end-to-end with Vertex via inference.local/v1.
SANDBOXES_TO_CLEAN+=(test-oc-builtin)
SANDBOXES_TO_CLEAN+=(test-oc-builtin)
run_test "agent: opencode built-in profile" \
bash -c '"$1" apply --agent opencode --name test-oc-builtin >/dev/null 2>&1 && \
for i in $(seq 1 10); do "$1" describe test-oc-builtin >/dev/null 2>&1 && break; sleep 0.5; done && \
Expand All @@ -360,11 +359,9 @@ if $LIVE && "$CLI" inference get >/dev/null 2>&1; then
"$HARNESS" delete --sandboxes --providers >/dev/null 2>&1 || true
else
skip_test "agent: claude inference via vertex" "ANTHROPIC_VERTEX_PROJECT_ID not set"
skip_test "agent: opencode inference via vertex" "ANTHROPIC_VERTEX_PROJECT_ID not set"
skip_test "agent: github via gh cli" "ANTHROPIC_VERTEX_PROJECT_ID not set"
skip_test "agent: claude uses jira mcp" "ANTHROPIC_VERTEX_PROJECT_ID not set"
skip_test "agent: gws gmail via proxy token" "ANTHROPIC_VERTEX_PROJECT_ID not set"
skip_test "agent: opencode built-in profile" "ANTHROPIC_VERTEX_PROJECT_ID not set"
fi

echo ""
Expand Down
Loading