[Bug]: OpenCode provider cannot discover models with OpenCode V2 beta CLI (opencode2)
Problem
The OpenCode provider cannot discover any models when the provider CLI is the OpenCode V2 beta binary (opencode2, e.g. v0.0.0-next-16694 installed via bun). The model picker stays empty, so I cannot bind/select the model I use with the opencode CLI.
The OpenCode provider in Claudian appears to target OpenCode V1's ACP contract. I verified three incompatibilities directly against the CLI:
--cwdflag no longer exists.OpencodeAcpSessionKernel.tsalways spawnsopencode acp --cwd=<vault>. Runningopencode2 acp --cwd=...fails immediately:ERROR Unrecognized flag: --cwd in command opencode2 acpSo when the CLI path is pointed at
opencode2, the ACP subprocess exits before the handshake completes (the metadata probe silently swallows the error, which is why the UI just shows an empty model list instead of an error).V2's
session/newno longer returns amodelsfield. I ran a JSON-RPC probe againstopencode2 acp(without--cwd).session/newresponds with only:['sessionId', 'configOptions']— no
modelsand nomodes. Claudian's model picker is populated exclusively from themodelsfield (AcpSessionModelState) viaprojectOpencodeMetadata, so the picker is always empty. In V2 the selectable models are exposed through themodelentry inconfigOptions(type: "select", options areprovider/modelids), which Claudian does not read for model discovery.Binary auto-detection only looks for
opencode.OpencodeCliResolver.tsusesbinaryName: 'opencode'and falls back toopencodefromPATH. With only the V2 beta installed there is noopencodebinary at all; the plugin is therefore dependent on manually setting the CLI path, and even then it fails for reasons 1 and 2.
Additional observation: Claudian forces its own managed config via OPENCODE_CONFIG (.claudian/opencode/.../config.json, which only contains $schema + agent overrides), so a model configured in the user's global ~/.config/opencode/opencode.json(c) is not loaded by the spawned CLI either.
Steps to reproduce
- Install OpenCode V2 beta only (e.g.
bun install -g opencode-ai@next→ binaryopencode2; noopencodebinary on PATH). - Claudian → OpenCode provider → set the CLI path to the
opencode2binary (e.g.~/.bun/bin/opencode2), or leave it unset. - Open a Claudian chat tab with the OpenCode provider and open the model picker.
- Observe: no models are listed; the session fails to start (CLI flag error).
Expected behavior
- Models available to the configured opencode CLI (e.g. the
modelselect options fromconfigOptions, including the user's configured/bound model) appear in Claudian's model picker. - The ACP session starts successfully with the V2 beta CLI.
Environment
- Claudian version: 2.0.41
- Obsidian version: 1.12.7
- Operating system: macOS
- Provider: OpenCode
- Provider CLI version: v0.0.0-next-16694
- Provider CLI installation method: bun (
~/.bun/bin/opencode2)
Logs and other evidence
Raw ACP probe output against opencode2 acp (no --cwd):
INITIALIZE keys: [ 'protocolVersion', 'agentCapabilities', 'authMethods', 'agentInfo' ]
SESSION/NEW keys: [ 'sessionId', 'configOptions' ]
CONFIG OPTIONS: [{"id":"model","name":"Model","category":"model","type":"select","currentValue":"opencode-go/qwen3.8-max","options":[{"value":"deepseek/deepseek-chat",...},{"value":"opencode-go/..."}]}, ...]With --cwd:
ERROR
Unrecognized flag: --cwd in command opencode2 acpAdditional context
Suggested fix directions for the OpenCode provider:
- Stop passing
--cwd(V2 resolves the working directory from the spawned process's cwd; spawn the subprocess with the desired cwd instead). Detect V2 vs V1 or probe for flag support. - Populate the discovered-model list from the
modelconfig option'soptionsinconfigOptionswhen the ACPmodelsfield is absent (V2), instead of relying solely onsession/new.models. - Consider deriving the current/selected model from
configOptionscurrentValueso the user's bound model is preselected.
Source: YishenTu/claudian