Skip to content

--variant silently ignored when the value is not in the model's reasoning_options #40182

Description

@johannes-engler-mw

Description

opencode run --variant <value> accepts any string. If the value isn't among the model's declared reasoning_options values, the reasoning parameter is silently omitted from the request — exit code 0, no warning, no log line — and the run proceeds at the model's default. The unapplied value is still written into the session record, so the session claims an effort level that was never used.

This differs from #26495, #21632 and #28803, which are about variants that are available but not applied. Here the variant is not available and is swallowed rather than rejected.

OpenCode version

1.18.5 (macOS)

Steps to reproduce

opencode run --format json -m opencode-go/deepseek-v4-flash --variant totally-invalid-xyz "hi"
# exit 0, no warning, no log line

opencode export <sessionID>
# -> "model": { "id": "deepseek-v4-flash", "providerID": "opencode-go", "variant": "totally-invalid-xyz" }

The bogus value is accepted and persisted.

Evidence

I captured the outgoing request body by pointing the provider's catalog api URL at a local HTTP server. opencode-go/deepseek-v4-flash declares values = ["high", "max"]:

flag reasoning_effort in request body
--variant max "max"
--variant high "high"
--variant low absent
--variant totally-invalid-xyz absent

Declared values are forwarded correctly; undeclared ones vanish entirely.

Notably the upstream validates this field itself — forwarding the bogus value directly returns:

reasoning_effort: unknown variant `totally-invalid-xyz`,
expected one of `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`

So the client-side drop replaces a clear, actionable error with silence.

Expected

Reject an unknown --variant with a non-zero exit listing the model's valid values — or at minimum emit a warning, and don't record an unapplied value in session metadata.

Impact

A run can be labelled with an effort level it never ran at. I hit this while benchmarking effort levels across models: --variant low on deepseek-v4-flash produced runs indistinguishable from the default, because the parameter never left the CLI. In a scripted sweep that yields two "different" configurations which are identical in behaviour, with nothing to signal it — worse than a hard failure, because the results look valid.

(In that particular case low is a legitimate value for the model that is missing from its catalog entry — filed separately as anomalyco/models.dev#3962 — but the same silent drop applies equally to a plain typo.)

Related: #26495, where a fix to the reasoning_effort passthrough may touch the same code path.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions