Conversation
rexdotsh
force-pushed
the
fix/claude-opencode-output-limit
branch
from
September 27, 2026 08:26
8e529cd to
7364e6b
Compare
This was referenced Sep 28, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Document the OpenCode V2 Claude output-limit regression and a client-side, opt-in workaround. This PR does not modify the Kleis proxy or anyone's request budget. It is independent of #49.
Root cause
99490f289b(August 20) changed the Anthropic Messages transport from a model-derived output limit to a fixed 32k fallback whengeneration.maxTokensis absent. It predates V2 2.0.0, the first V2 release. Released V2 through 2.0.18 still leaves primary generation options empty by default.d9987ef9c8sets a model-based primary output limit and fits it to remaining context. It landed after the 2.0.18 release commit; do not assume 2.0.18 includes it.msg_0e19bee88001XHOV0SysxSldcH) hadrawFinish: max_tokens, 32,000 reasoning tokens, zero answer tokens, and a normal terminal response. This is not evidence of a Kleis SSE disconnect.max_tokens; Harden Claude OAuth refresh and recover pre-output 401s #43 changed token replay/refresh; chore: remove Copilot support #32 removed Copilot. The Opus 5.5 user-agent bump enabled access to that model, but did not set the output budget.Why documentation, not a proxy rewrite?
Kleis receives
max_tokens: 32000and cannot distinguish an intentional caller limit from OpenCode's fallback, nor compute OpenCode's remaining context room. The previous #52 draft silently changed some callers' budget to 128k based on a version regex; that is unsafe. The README instead shows an optional V2contexthook scoped to Kleis Opus 5.5 max-effort requests, and recommends upgrading only to a release containing the upstream fix. Installing the hook remains an explicit client-side choice.Checks
bun test(140 passing)bun typecheckbun lintNo live Claude request or service restart was performed. Leave this PR and #49 unmerged pending review.