fix(opencode-console): ask for 8192 output tokens on the Anthropic route
Merged
FE
14d ago+23+23+01234567890123456789-1-1-0123456789
Fixes #1013
What and why
opencodeConsole('<id>')now asks for an explicit output cap on the models the workspace config serves over Anthropic.- The Anthropic SDK does not know those ids, so a call that sets no
maxOutputTokensis limited to 4096 tokens with nothing but acompatibilitywarning: the answer comes backfinishReason: 'length'at 4096 and no part of the result says why. packages/e2e/src/oauth/opencode-console.ts:122fills in 8192, the capdocs/reference/config.mdxalready documents for a judgment, and leaves a caller's ownmaxOutputTokensuntouched.- Agent steps were never affected: the runner passes
MAX_OUTPUT_TOKENS = 8192on every call (packages/e2e/src/agent/invocation.ts:147). The issue carries that correction; the scope here is the direct call.
| main | this branch |
|---|---|
generateText({ model: opencodeConsole('go/minimax-m3'), prompt }) with no cap: 4096 output tokens, finishReason: 'length', the SDK's silent default | the same call: max_tokens: 8192 on the wire (pinned by the new unit case), and the answer is no longer cut at 4096 |
Verified
Ran it locally: yes
- New case in
tests/unit/oauth/opencode-console.test.ts: the request carriesmax_tokens: 8192when the call sets no cap and the caller's1234when it does. Onmainthat case fails withexpected 128000 to be 8192. pnpm --filter e2e test: 248 files, 3152 passed, 2 skipped.pnpm check: exit 0, includingmint validateand the broken-link check over the docs page.- Every id the issue lists accepts 8192 against the real subscription with no error (
go/minimax-m3,go/muse-spark-1.2-contributor,go/qwen3.8-flash,go/qwen3.8-max,go/space-bunny), so the value is safe to ask for. - It is still a cap: a prompt that never ends stops at 8192 with
finishReason: 'length', where it used to stop at 4096. What changes is that the number is the provider's own and documented, and a caller who needs more gets it:maxOutputTokens: 12000came back with 11001 tokens andfinishReason: 'stop'.
Checklist
- Changeset added (
e2e: patch). - Breaking change: none.
- Docs updated in the same PR:
docs/subscriptions.mdx.skills/e2e/does not describe the cap. - Contract change: none; no emitted
.d.tsand no wire schema moved. - Engine contract change: not applicable.