Skip to content

Add a configurable reasoning_effort for opencode models - #85

Merged
linted merged 1 commit into
mainfrom
worktree-opencode-reasoning-effort
Nov 18, 2026
Merged

linted merged 1 commit into
mainfrom
worktree-opencode-reasoning-effort

Conversation

@linted

@linted linted commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Problem

GLM-5.3 on OpenCode Go reasons like max when no effort is sent. In a live run one
call spent 16k tokens reasoning and the next spent the entire 32k max_tokens budget on
reasoning (finish_reason=length, no content, no tool call): ~4.6 minutes wasted.
OpenCode's docs don't mention it, but the gateway accepts the standard
reasoning_effort field (none/low/medium/high/max; unknown values 400).

Change

  • reasoning_effort in agents.toml, resolved like max_tokens:
    [main]/[worker] entry → top-level → unset (nothing sent).
  • Sent on the OpenAI-protocol opencode:/opencode-go: paths (Chat Completions and
    Responses); claude-* and all other providers ignore it with a warning.
  • Documented (commented out) in agents.toml.

Testing

lint, typecheck, ./scripts/test.sh pass (310). New tests cover parsing, resolver
threading, the request payload, and the ignored-provider warning. Live-checked
opencode-go:glm-5.3 with high through build_model.

GLM-5.3 on OpenCode Go reasons like `max` when no effort is sent: one call
spent 16k tokens reasoning and the next exhausted the whole 32k max_tokens
budget on reasoning alone, ending with no content or tool call. The gateway
accepts the standard `reasoning_effort` field (none/low/medium/high/max).

`reasoning_effort` resolves like `max_tokens`: [main]/[worker] entry ->
top-level -> unset. It is sent on the OpenAI-protocol opencode/opencode-go
paths; claude-* and every other provider ignore it with a warning.
@linted
linted merged commit ec472c0 into main Nov 18, 2026
2 checks passed
@linted
linted deleted the worktree-opencode-reasoning-effort branch November 18, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant