Skip to content

[BUG] v2.0.16: agent-level variant is resolved by debug agents but never applied to requests #51326

Open

Description

@1575514641-ship-it

In v2.0.16 the agent-level variant config key has no effect on outgoing requests, although the config schema documents it and opencode debug agents resolves it correctly.

Schema (https://opencode.ai/config.json, $defs/AgentConfig/properties/variant):

Default model variant for this agent (applies only when using the agent's configured model).

Config used

{
  "model": "opencode-go/deepseek-v4.1-flash",
  "agent": {
    "build":   { "model": "opencode-go/deepseek-v4.1-flash", "variant": "max" },
    "plan":    { "model": "opencode-go/deepseek-v4.1-flash", "variant": "max" },
    "general": { "model": "opencode-go/deepseek-v4.1-flash", "variant": "max" }
  }
}

opencode debug agents resolves it fine:

build -> {"id": "deepseek-v4.1-flash", "providerID": "opencode-go", "variant": "max"}

Reproduction### Reproduction

I pointed provider.opencode-go.options.baseURL at a local recording proxy (project-level opencode.json) and captured the raw POST /chat/completions bodies.

Agent config in place for these runs:

"agent": { "build": { "model": "opencode-go/deepseek-v4.1-flash", "variant": "max" } }

opencode debug agents resolves that to {"id":"deepseek-v4.1-flash","providerID":"opencode-go","variant":"max"}.

invocation effort on the wire
opencode run --auto "..." — agent build used implicitly, nothing model-related passed on the CLI none
opencode run --auto --agent build "..." — same config, agent named explicitly none
opencode run --auto -m 'opencode-go/deepseek-v4.1-flash#max' "..." "reasoning_effort": "max"
opencode run --auto -m 'opencode-go/deepseek-v4.1-flash' "..." none

A field-by-field diff of the two bodies (agent config vs explicit #max, same model, same prompt shape) shows reasoning_effort is the only top-level field present in the explicit case and absent in the agent-config case. Scanning the entire agent-config body for max outside messages finds only unrelated tool-parameter descriptions ("Very short label (max 30 chars)" etc.), so the value is not being sent under some other key.

Two extra probes, to rule out "invalid value is simply dropped":

  • The same capture was also run while the agent variant was an invalid value ("bogus") — identical result: no error, no effort field.
  • With a valid value ("max") — again no error and no effort field, while the explicit -m ...#max path in the same session does send reasoning_effort: "max".

So config-provided variants are neither validated nor applied, for valid and invalid values alike.

Expected

A session started with an agent that configures both model and variant should send the corresponding effort (e.g. reasoning_effort: "max"), as the schema description states.

Related

Environment

  • opencode v2.0.16, Windows x64, installed via npm i -g @opencode/cli
  • Provider/model: opencode-go/deepseek-v4.1-flash (the registry accepts #max and rejects #xhigh with Variant unavailable, so variants are declared for this model — it is not a "model has no variants" case)

Activity

  1. github-actions commented on Sep 25, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. 1575514641-ship-it commented on Sep 25, 2026

    @1575514641-ship-it
    Author

    Re-verified after self-checking my own capture setup: the two "agent config" rows were first captured while the agent's variant happened to hold an invalid placeholder value, so I re-ran the full capture with variant: "max" — the value opencode debug agents resolves for this agent — and got the identical result (no reasoning_effort on the wire, while -m 'opencode-go/deepseek-v4.1-flash#max' in the same session does send it). The body above now reflects the verified runs. I can re-run and share the raw capture on request.

  3. SachinD6 commented on Sep 25, 2026

    @SachinD6

    The variant was already on the agent record, but SessionRunnerModel only read session.model.variant so a matching session model never picked it up. This PR carries the agent variant through when the models match unless the session sets its own: #51385

  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I can confirm this on v2.0.16.

    What I ran:

    • opencode-go pointed at a local mock server that records request bodies.
    • agent.build set to { "model": "opencode-go/deepseek-v4.1-flash", "variant": "max" }.
    • opencode run --auto "hi".

    The captured POST /v1/chat/completions body for deepseek-v4.1-flash had no reasoning_effort field, just as you describe.

    In v2.0.16, when opencode run starts a session without -m, the runner falls back to the default model and never reads the agent's configured variant. A recent change on dev (#58355) makes the runner use the agent's model and variant when no model is given. It looks like it should cover this, but it isn't in a release yet and I haven't checked it against dev. Until then, passing -m opencode-go/deepseek-v4.1-flash#max explicitly works, as you found.

    Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions