Repository navigation
feat: pass agent effort to OpenAI and Google models through OpenCode - #119
Conversation
🤖 AI code reviewDecision: Ready for human review (with comments) Overall PR risk: Medium. The change modifies effort level passing for OpenCode reviewers on OpenAI and Google models. 🔎 Reviewer summaries (3)
🏗️ Design (1)
This review is advisory — it never blocks a merge and never auto-approves. |
cbc16e6 to
753305d
Compare
Gemini Neon review of PR #119 (stacked on this one): sending no level on the no-tools fallback uses the provider's default, which can be higher than the agent's own level (an `effort: low` agent could fall back to a higher default). fallbackEffort now returns min(level, medium), and runClaudePrompt passes that for maxToolCalls 0: it never raises the level and still keeps a deep level off a short-capped retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`effort` reached only `anthropic/…` agents (the claude-code engine's `--effort`). OpenCode hands unknown agent-config keys to the provider as model options, so buildOpencodeConfig now adds one per reviewer with `effort`, chosen by opencodeEffortStyle from the model's provider: - openai/… (and an alias with upstream "openai"): reasoningEffort, sent as the Responses API reasoning.effort. - google/… and google-vertex/…: thinkingConfig.thinkingLevel, in place of the "high" that OpenCode sends to Gemini by default. Observed with the pinned OpenCode 1.19.5 against a local mock endpoint, using the agent entries buildOpencodeConfig produces. Other OpenCode providers still get the "has no effect" run note, which now names only those. Fixed-role passes never get a level. ecr passes the level as written; a provider that does not take it fails the pass with its own error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…I aliases Astra review of 4f6afb5: - With the pinned OpenCode 1.19.5, thinkingLevel xhigh or max fails inside the Google adapter ("invalid google provider options") before any request, on google/… and google-vertex/…, so every pass of that agent failed. GOOGLE_THINKING_LEVELS is now low, medium, high: for xhigh and max ecr sends no key, the model runs at OpenCode's default, and the run note names the agent, its level and the levels that work. - An alias with upstream "google" is built on @ai-sdk/openai-compatible, so a Google key reached the endpoint as a stray top-level field and the note stayed silent. opencodeEffortStyle now follows the adapter ecr creates: only an upstream "openai" alias takes a level. - The config template lists every route and the Google limit; the comment at selectReviewers no longer says only the claude CLI reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kudo's multi-model review of PR #118 found that a timed-out pass, retried with no tools under a short cap, kept the agent's level; #118 now sends no level there on the claude-code engine. The same holds for OpenCode, which has no per-prompt level, so buildOpencodeConfig also registers each reviewer that has an effort option as `<id>__default-effort` without it, and opencodePassAgent sends the fallback prompts (maxToolCalls 0) as that copy. Polling and activity labels keep the reviewer's own id. Observed with OpenCode 1.19.5 against a mock endpoint: the reviewer's entry sent reasoning.effort "xhigh", the copy sent no reasoning field. Also format the rebase conflict resolution (fmt:check). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemini Neon review of 753305d: - A reviewer that shares a fixed role's id (agents/cross-cutting.md) left a `<id>__default-effort` copy behind, and the built-in pass's no-tools fallback then ran as that copy, with the reviewer's model, prompt and tools. Fixed-role ids now get no level and no copy. - The handle inferred copies from any agent name ending in the suffix, so a real agent file with that name could take over another reviewer's fallback. opencodeFallbackAgents now computes the map from the loaded config, skips a copy id that is already an agent id, and runReview hands the map to startOpencode. - A copy with no level ran at the provider's default, which can be higher than the agent's own level (Gemini's default is high). The copy now carries fallbackEffort (min(level, medium), as #118 does on the claude-code engine), and exists only when that differs from the reviewer's own options. Renamed to `<id>__fallback-effort`. - The corrective re-emit of a fallback pass ran as the reviewer at its full level; it now runs as the same copy. - The run note for a fixed-role reviewer on Google xhigh/max also names the levels Google takes; a test assertion that could never fail now checks the note's end; the effort docs no longer say only the claude-code engine reads it. Observed with OpenCode 1.19.5 against a mock endpoint, using the config buildOpencodeConfig produces: xhigh OpenAI reviewer "xhigh", its copy "medium"; max Google reviewer OpenCode's default "high", its copy "medium". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
753305d to
fa22f36
Compare
Astra review of fa22f36: - The fallback copy at min(level, medium) sent a level the author never wrote, and a model can reject it (GPT-5 pro takes only `high`, per the provider's docs), which turned a working setup into failed passes. ecr cannot know which lower levels each OpenAI or Google model takes, so on OpenCode every prompt of a pass, including the no-tools fallback, finalize and corrective, now runs at the agent's own level. This removes the copy agent, its map on the handle and its start-up wiring. The claude-code engine keeps fallbackEffort (#118). - A reviewer named `compaction` replaced OpenCode's own agent, and its level then reached other reviewers' session compaction. OpenCode 1.19.5 defines build, compaction, explore, general, plan, summary and title (app.agents(), observed); buildOpencodeConfig gives these ids no level (OPENCODE_BUILTIN_AGENTS) and the run note says to rename the file. Kept from the previous commits: no level for ecr's fixed-role ids, the fixed-role note's Google levels, the alias in the provider list, and the test fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemini Neon review of fa22f36: the provider list in the note followed "a provider ecr passes no level to", so it read as a list of providers that take no level. It now says "ecr passes one only for …". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Astra final review of 3bca528 (approve with comments): - The note for an OpenCode built-in agent id said only to rename the file; on a model that takes no level, or Google xhigh/max, the next run then gave a second fix. It now gives both in one note, as the fixed-role note does. - OpenCode's Google default varies by model (Gemini 4 Neon: high; a gemini-2.5-flash request carried no thinkingLevel), so the README, the LLP and the note no longer call `high` the default for every model. - The built-in agent list comment names the field app.agents() returns (`native: true`). - The LLP fallback heading says the cap is Claude Code's; OpenCode keeps the level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemini Neon final review of 3bca528 (approve with comments): - The README now says that an OpenCode-routed file named after one of OpenCode's own agents gets no effort, as a fixed-role file does. - agentEffortNote's doc comment lists all four cases. - buildAgentEfforts' test includes `compaction`, which keeps its level on the claude-code engine. Its other nits (one note with the full fix for a built-in id, the LLP heading) were fixed in 4d4137b, whose test also fails if the duplicate- note guards are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the LLP 0006 fallback paragraph: #118 now names the CLI's default and scopes the cap to the claude-code engine (Devin review); this branch keeps that text and adds the OpenCode part. Also adds the @ref Devin asked for on OPENCODE_BUILTIN_AGENTS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Asked for in Kudo's review of #118. OpenCode's xAI adapter (@ai-sdk/xai) reads the same agent key as OpenAI: with the pinned OpenCode 1.19.5 against a mock endpoint, an `xai/grok-4.7` request to /chat/completions carried no level field with no key, and reasoningEffort "low", "high" and "xhigh" arrived as reasoning_effort. opencodeEffortStyle now maps native `xai` to an `xai` style with that key. Which levels xAI's API accepts is not verified; like the other providers, ecr passes the level as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d16c574
into
t3/evaluate-review-cli-quality-gates
| | `anthropic/…` (Claude Code CLI) | `--effort <level>` | | ||
| | `openai/…`, or an alias with `upstream: "openai"` (OpenCode) | `reasoningEffort`, sent as the Responses API `reasoning.effort` | | ||
| | `google/…`, `google-vertex/…` (OpenCode) | `thinkingConfig.thinkingLevel`, in place of the model's default (OpenCode sends `high` for Gemini 4 Neon); only `low`, `medium` or `high` (for `xhigh` and `max` ecr sends no level, and the run note says so) | | ||
| | `xai/…` (Grok, OpenCode) | `reasoningEffort`, sent as Chat Completions `reasoning_effort` | |
There was a problem hiding this comment.
🔍 Native xAI wire format mismatch
With XAI_API_KEY, OpenCode’s native xai loader uses /responses and sends reasoning.effort. The mock result covers Chat Completions, not the native loader’s request format.
Was this helpful? React with 👍 or 👎 to provide feedback.
Why
Stacked on #118. After #118,
effortreaches onlyanthropic/…agents (--efforton the Claude Code CLI). An agent on an OpenAI model (for example GPT-6.2 Astra) or a Google model (for example Gemini 4 Neon) gets the run note "efforthas no effect", although OpenCode can pass a reasoning level to both providers.How
OpenCode hands unknown agent-config keys to the provider as model options.
buildOpencodeConfignow adds one per reviewer witheffort, chosen byopencodeEffortStylefrom the adapter ecr gives the model's provider:openai/…, or an alias withupstream: "openai"(built on@ai-sdk/openai)reasoningEffort: <level>reasoning.effortgoogle/…,google-vertex/…thinkingConfig: { thinkingLevel: <level> }, only forlow,medium,highthinkingConfig.thinkingLevel, in place of the model's defaultxhighandmax: the pinned Google adapter rejects them inside OpenCode before any request, so ecr sends no level for them and the run note names the agent, its level and the levels that work (GOOGLE_THINKING_LEVELS).upstream: "google", built on the OpenAI-compatible adapter), Meta and other providers get no level and are named in the run note.NON_REVIEWER_AGENTS) and OpenCode 1.19.5's own agents (OPENCODE_BUILTIN_AGENTS: build, compaction, explore, general, plan, summary, title). A level oncompactionreached other reviewers' session compaction. The run note tells the author to rename the file, with the full fix in one note.high). The claude-code engine keeps feat: add a per-agent effort option (Claude Code and OpenCode) #118'smin(level, medium)fallback.Evidence
With the pinned OpenCode 1.19.5 and a local mock endpoint (no real provider call), using the config
buildOpencodeConfigproduces:openai/gpt-6.2-astra: no key → noreasoningfield;high,xhigh,max→reasoning.effortwith that value.google/gemini-4-neonandgoogle-vertex/gemini-4-neon: no key →thinkingLevel: "high";low/medium→ that level,includeThoughts: truekept;xhigh/max→ no request sent.app.agents()lists the seven built-in agents above withnative: true.Not observed: the ChatGPT/Codex sign-in path, and how a real provider answers each level.
Review
Reviewed in several rounds by GPT-6.2 Astra and Gemini 4 Neon (high effort). An earlier version added a
<id>__fallback-effortcopy agent atmin(level, medium)for the OpenCode fallback; review showed it could send a level a model rejects and could hijack a built-in pass, so it was removed. Both reviewers approve the final design; their last nits are in4d4137band24144b9.Test plan
bun run typecheck,bun run lint,bun run fmt:checkbun run llp:check: 0 errorsbun test: 1186 pass, 0 failopencodeEffortStyleper provider and alias;buildOpencodeConfigkeys for OpenAI and Google, none for Googlexhigh/max, Meta, fixed roles or OpenCode built-in ids;agentEffortNotenames each case once, with the full fix.🤖 Generated with Claude Code