You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: OpenCode Go as the first chat provider - #377
OpenCode Go is the first chat provider. The chat model is called in one place: the CSV branch, which summarizes a sampled table into one card.
Selection order: opencode → zai → openai → claude → vllm; the first non-empty API key wins.
OPENCODE_API_KEY selects it; OPENCODE_MODEL names the model (default deepseek-v4.1-flash). The endpoint is fixed: https://opencode.ai/inference/go/openai/v1.
The opencode client sends User-Agent: memory-base/<version> and a new x-opencode-session per chat_json call, as the OpenCode Go request policy asks. Other providers send neither.
No thinking parameter is sent to opencode: glm-5.3-flash on Go refuses thinking: disabled; sending nothing works for both measured models. z.ai keeps thinking: disabled.
zai_provider(env) builds the z.ai provider from its own keys; the LongMemEval extractor and answer model use it, so they keep working when OPENCODE_API_KEY is also set.
Provider specs are a named tuple (_KeyedSpec) instead of positional tuples.
Wiring and docs: docker-compose.yml, .env.example, docs/configuration.md, README, AGENTS.md, docs/benchmarks/longmemeval.md.
No schema change. OPENCODE_API_KEY is already in .env.
cd <main checkout>
git fetch origin
git checkout --detach origin/feat/opencode-provider
docker compose up -d --build api mcp
Runtime evidence (required for ingest / retrieval / serving behavior)
Branch deploy verified: the CSV branch summarized a 3-row CSV through OpenCode Go (chat model: opencode / deepseek-v4.1-flash, job succeeded, 0 retries); details in the evidence comment.
Verification
uv run pytest passes — unit: 1670 passed, 1 skipped.
uv run ruff format --check . and uv run ruff check . pass
docker compose build mcp passes — branch deploy built api and mcp
Runtime evidence attached above
Checklist (core principles)
Selective storage — notes stay distilled; verbatim text lives only in doc_rows and the turns lane
Source-specific logic stays out of the source-agnostic core (ingest pipeline, retrieval, serving)
No hardcoded endpoints/models — configuration lives in .env (the OpenCode Go endpoint is the vendor's fixed URL, like the z.ai default)
New/changed behavior ships a test in this PR (tests/core/test_llm_provider.py, LongMemEval builder tests, compose wiring)
Deployed b62e130 (origin/feat/opencode-provider) with docker compose up -d --build api mcp at 2026-10-19 16:54 KST. OPENCODE_API_KEY and ZAI_API_KEY are both set in .env; OPENCODE_MODEL is unset.
Stored card (memory_chunks, chunk_kind=doc), 3 rows in doc_rows:
doc|The sample is a three-column table of cities with their populations and country codes. Fields are city (text), population (integer count of residents), and country (two-letter code such as KR for South Korea and JP for Japan). The three data rows list Seoul with 9,400,000 people in KR, Busan with 3,300,000 in KR, and Tokyo with 14,000,000 in JP. Useful patterns include grouping by country to compare urban populations, ranking cities by population size, and filtering for a specific country code. Tokyo is the largest city in the sample, while Busan is the smallest. The country field uses short ISO-style abbreviations rather than full country names, so joins or lookups may be needed to display readable country labels. Population values are numeric and suitable for aggregation, sorting, and averages by country.|["city population table", "country codes", "urban demographics", "tabular data sample", "population ranking", "iso-style country abbreviations"]|
Cleanup: DELETE /ingest/documents/probe-opencode-376?namespace=default → {"deleted":1}; afterwards 0 chunks and 0 doc_rows for the document.
Health: GET /health/services → {"status":"ok","checks":{"db":true,"embedding":true,"rerank":true,"llm":true}}. No tracebacks, 5xx or ERROR lines in the api/mcp logs over the run.
Reviews: Sonnet standards, Opus spec, gpt-6.1-sol. Accepted findings are in 3bb0d47 (named provider spec fields) and b62e130 (compose wiring and fixture cover OPENCODE_*; benchmark docs name zai_provider; two header tests merged). gpt-6.1-sol: no code defects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenCode Go is the first chat provider. The chat model is called in one place: the CSV branch, which summarizes a sampled table into one card.
opencode → zai → openai → claude → vllm; the first non-empty API key wins.OPENCODE_API_KEYselects it;OPENCODE_MODELnames the model (defaultdeepseek-v4.1-flash). The endpoint is fixed:https://opencode.ai/inference/go/openai/v1.User-Agent: memory-base/<version>and a newx-opencode-sessionperchat_jsoncall, as the OpenCode Go request policy asks. Other providers send neither.glm-5.3-flashon Go refusesthinking: disabled; sending nothing works for both measured models. z.ai keepsthinking: disabled.zai_provider(env)builds the z.ai provider from its own keys; the LongMemEval extractor and answer model use it, so they keep working whenOPENCODE_API_KEYis also set._KeyedSpec) instead of positional tuples.docker-compose.yml,.env.example,docs/configuration.md, README, AGENTS.md,docs/benchmarks/longmemeval.md.Related issues
Closes #376
Deploy runbook
No schema change.
OPENCODE_API_KEYis already in.env.Runtime evidence (required for ingest / retrieval / serving behavior)
Branch deploy verified: the CSV branch summarized a 3-row CSV through OpenCode Go (
chat model: opencode / deepseek-v4.1-flash, job succeeded, 0 retries); details in the evidence comment.Verification
uv run pytestpasses — unit: 1670 passed, 1 skipped.uv run ruff format --check .anduv run ruff check .passdocker compose build mcppasses — branch deploy built api and mcpChecklist (core principles)
doc_rowsand theturnslane.env(the OpenCode Go endpoint is the vendor's fixed URL, like the z.ai default)tests/core/test_llm_provider.py, LongMemEval builder tests, compose wiring)