fix(opencode-console): ask for 8192 output tokens on the Anthropic route

Merged
FE
14d ago
+23-1

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 maxOutputTokens is limited to 4096 tokens with nothing but a compatibility warning: the answer comes back finishReason: 'length' at 4096 and no part of the result says why.
  • packages/e2e/src/oauth/opencode-console.ts:122 fills in 8192, the cap docs/reference/config.mdx already documents for a judgment, and leaves a caller's own maxOutputTokens untouched.
  • Agent steps were never affected: the runner passes MAX_OUTPUT_TOKENS = 8192 on every call (packages/e2e/src/agent/invocation.ts:147). The issue carries that correction; the scope here is the direct call.
mainthis branch
generateText({ model: opencodeConsole('go/minimax-m3'), prompt }) with no cap: 4096 output tokens, finishReason: 'length', the SDK's silent defaultthe 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 carries max_tokens: 8192 when the call sets no cap and the caller's 1234 when it does. On main that case fails with expected 128000 to be 8192.
  • pnpm --filter e2e test: 248 files, 3152 passed, 2 skipped.
  • pnpm check: exit 0, including mint validate and 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: 12000 came back with 11001 tokens and finishReason: '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.ts and no wire schema moved.
  • Engine contract change: not applicable.