#1031·claudian

[Bug]: OpenCode provider cannot discover models with OpenCode V2 beta CLI (opencode2)

Author: CHUNLEUNG910Created Aug 3, 2026Updated Sep 30, 2026
Labelsstale

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:

  1. --cwd flag no longer exists. OpencodeAcpSessionKernel.ts always spawns opencode acp --cwd=<vault>. Running opencode2 acp --cwd=... fails immediately:

    ERROR
      Unrecognized flag: --cwd in command opencode2 acp

    So 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).

  2. V2's session/new no longer returns a models field. I ran a JSON-RPC probe against opencode2 acp (without --cwd). session/new responds with only:

    ['sessionId', 'configOptions']

    — no models and no modes. Claudian's model picker is populated exclusively from the models field (AcpSessionModelState) via projectOpencodeMetadata, so the picker is always empty. In V2 the selectable models are exposed through the model entry in configOptions (type: "select", options are provider/model ids), which Claudian does not read for model discovery.

  3. Binary auto-detection only looks for opencode. OpencodeCliResolver.ts uses binaryName: 'opencode' and falls back to opencode from PATH. With only the V2 beta installed there is no opencode binary 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

  1. Install OpenCode V2 beta only (e.g. bun install -g opencode-ai@next → binary opencode2; no opencode binary on PATH).
  2. Claudian → OpenCode provider → set the CLI path to the opencode2 binary (e.g. ~/.bun/bin/opencode2), or leave it unset.
  3. Open a Claudian chat tab with the OpenCode provider and open the model picker.
  4. 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 model select options from configOptions, 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 acp

Additional 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 model config option's options in configOptions when the ACP models field is absent (V2), instead of relying solely on session/new.models.
  • Consider deriving the current/selected model from configOptions currentValue so the user's bound model is preselected.