[BUG] Custom openai-compatible provider: output budget clamped to the hosted-catalog ceiling (32K for qwen3.8-27b) even though the server accepts 262K — reasoning models return empty terminal stops
Before you start
- [ ] I searched existing issues and this is not a duplicate. 我已搜索过现有 issue。
What happened? 发生了什么?
What happened?
When a provider is configured as kind = "openai-compatible" in front of an
operator-owned vLLM server (e.g. a lab proxy), the output budget sent to the
server is clamped to the hosted catalog row's limit.output — 32768 tokens
for qwen3.8-27b — even though the server itself accepts far more.
Verified against the real server (vLLM 0.32.0): max_tokens = 131072, 262144
and 262000 are all accepted (HTTP 200, finish_reason=stop). The runtime still
emits max_tokens=32768.
With a reasoning model at reasoning_effort: high or xhigh, the model spends
the entire 32K allowance on hidden reasoning and never produces visible text. The
server returns a terminal stop with no answer, and the turn fails after two
retries:
Model returned terminal stop reason
stopwith no answer or tool call (after 2 retries)
This makes long sub-agent tasks (reviews, planning, verification) fail reliably end-to-end.
Root cause (traced in the code)
-
The embedded model catalog (
crates/config/assets/models_dev.bundled.json) declares forqwen/qwen3.8-27b:"limit": { "context": 262144, "output": 32768 } -
route_budget.rs::effective_max_output_tokens_for_routeintersects the requested cap with the compatibility cap. For a Custom provider, the catalog-derivedmax_output(32768) is applied, so every request goes out withmax_tokens=32768. -
The same failure shape — reasoning consuming the entire output allowance, zero visible text — is already documented in
route_budget.rsfor another route class (#6285).
Custom providers are operator-owned endpoints, like the Ollama / SGLang / VLLM
routes that already have an operator-owned allowlist in
route_declares_unknown_output_ceiling — but Custom itself is not in that
allowlist, so a catalogued model name is still clamped by the hosted row.
Expected behavior
For custom openai-compatible endpoints in front of operator-owned engines, use
the operator's real serving ceiling instead of the hosted-catalog limit.output:
- Add
ProviderKind::Customto the operator-owned allowlist inroute_declares_unknown_output_ceiling(alongside Ollama / SGLang / VLLM). - Honor the catalog's
generation_defaultwhen present, otherwise the generic automatic cap. - Keep the window-relative
ContextBudgetclamp as the hard cap (never raise any cap, only stop under-clamping). - Unify the "custom" label with the existing
Unverified/RouteDeclaredUnknownprovenance so receipts stay truthful. - Run
cargo test route_budget(and add a regression test for the Custom route with a catalogued model name).
Steps to reproduce 复现步骤
-
Configure a provider:
[providers.myqwen] kind = "openai-compatible" base_url = "https://your-vllm-host/api" model = "qwen3.8-27b" -
Run any task at
reasoning_effort = "high"or"xhigh"(e.g. a review or planning sub-agent). -
Observe the repeated empty terminal stop and the failed turn.
-
Compare the emitted request (
max_tokens=32768) with the server's accepted values (262144works).
Environment
- Codewhale version: 0.10.2 (main @ 44007bf)
- Where: TUI + sub-agents
- OS: FreeBSD
- Channel: built from source
- Provider / model: custom openai-compatible →
qwen3.8-27b(vLLM 0.32.0)
Codewhale version 版本
Codewhale 0.10.2
Where did it happen? 在哪里出现?
TUI (terminal interface)
Operating system 操作系统
Other
How did you get Codewhale? 获取方式
Cargo (crates.io)
Provider and model 提供商和模型
No response
Terminal and shell 终端
No response
codewhale doctor (optional)
Logs, screenshots, anything else (optional)
Extra notes
- Same failure class as #6285; related budget work: #5518, #5820, #6540, #5461.
- Workaround today: set
CODEWHALE_MAX_OUTPUT_TOKENS=262144(env) or lowerreasoning_effort. - Optional separate change: correct the catalog
limit.outputforqwen/qwen3.8-27b(32768 → 262144) with fresh server evidence. - I searched existing issues: no open issue or PR covers this case (searched: qwen, qwen3.8, 27b, empty stop, output cap, vllm ceiling, custom endpoint).
Engine packet, October 31. Trace the custom endpoint output cap from route lookup to the wire. Scope is crates/engine/src/route_budget.rs and the existing config/model catalog accessors only as needed. Verify with exact wire requests on a loopback custom route and the existing route-budget checks.
Candidate landed on Engine main 1d750e5098. With a 262144-token configured window, six ordinary CLI turns across qwen3.8-27b, qwen/qwen3.8-27b, and alibaba/qwen3.8-27b now emit 65536 automatic and 131072 explicitly requested on a custom OpenAI-compatible transport. The third spelling reproduced 32768 before the fix, while the first two already honored the larger values on this base and window. The initial scoped suite had 43/44 passes. The existing assertion for the modified provenance label was updated and its rerun passed. Real FreeBSD/vLLM reasoning output is an outstanding reporter surface.
These are indeed really headache-inducing problems. I submitted a PR a few days ago, but it didn’t fully cover these issues.
It’s not just these small models—for some third-party relay/proxy services, if the model name doesn’t match the built-in list in CodeWhale, it will automatically fall back to a 128K context—that’s a disaster. Later on, I’ll submit another PR to continue pushing forward with the fix for this issue.
Please see the merged PR #7183. I attempted to fix this issue. You can try compiling the current main to see if your problem has been resolved. It seems to have been verified on my end. If the problem persists, feel free to follow up with feedback in this issue anytime.
Thank you @Gabriel-Degret for the detailed trace of the max_tokens clamp, and @SparkofSpike for following up and for PR #7183, which fixed a related catalog-lookup case. Commit 1d750e5098b on main stops named custom openai-compatible endpoints from inheriting the hosted catalog row's output ceiling. The automatic budget now follows the model's generation default (or half the declared context window), and an explicit max-output setting can go higher, still within the context window. This is on main but not in the published 0.10.2 package, so the issue stays open until 0.10.3 ships. After that (or from a main build), please retry your qwen3.8-27b setup at high/xhigh reasoning effort and tell us whether the empty terminal stops are gone.
Written by Claude Opus 5.5 for the Codewhale maintainers.
Thank you @Gabriel-Degret for tracing the 32K max_tokens clamp to the hosted catalog row and checking what your vLLM server actually accepts. The fix shipped in v0.10.3 (1d750e5098): a named custom openai-compatible endpoint no longer inherits the hosted output ceiling. Upgrade with npm install -g [email protected]. We could not test against your server, so please reopen if qwen3.8-27b at high or xhigh reasoning effort still returns empty terminal stops.