Repository navigation
fix(providers): stop zed-hosted claude-haiku-4-5 thinking from inflating max_tokens (#13364) - #13780
Merged
diegosouzapw merged 3 commits intoSep 16, 2026
Conversation
…ing max_tokens (#13364) zed-hosted's passthrough catalog exposes the short hyphenated id "claude-haiku-4-5", but modelSpecs' registered alias is the dotted "claude-haiku-4.5" - a spelling mismatch, not a missing spec. With no zed-hosted entry in PROVIDER_MODEL_ALIASES, capMaxOutputTokens() resolved no cap for this model, so fitThinkingToMaxTokens added the response headroom directly to the requested thinking budget (32000 + 131072 = 163072) instead of fitting under the real 64000 output cap - Zed's proxy rejects the inflated request. Same class of fix already applied for the "kiro" provider in the same table. Regression test: tests/unit/issue-13364-zed-hosted-haiku-thinking-inflation.test.ts Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…4-zed-hosted-haiku-thinking-inflates
…inflates (base-red fix #13747)
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ing max_tokens (diegosouzapw#13364) (diegosouzapw#13780) Merged in the 2026-09-16 sweep of the maintainer's own open PRs, at the owner's explicit instruction. No push was made to the PR branch: the merge took the head as the owning session left it (verified OPEN, non-draft and MERGEABLE against the release tip immediately before merging).
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.
Closes #13364
Root cause (short)
zed-hosted's passthrough catalog exposes the short hyphenated Claude idclaude-haiku-4-5, butmodelSpecs' registered alias for that model is the dottedclaude-haiku-4.5— a spelling mismatch, not a missing spec. BecausePROVIDER_MODEL_ALIASEShad nozed-hostedentry,resolveCanonicalProviderModelpassed the wire id through unchanged, so
getCanonicalModelSpecIdfound neither anexact nor an alias match.
capMaxOutputTokens()then resolvednull, andfitThinkingToMaxTokenstook the "no known cap" branch — adding the responseheadroom directly to the requested thinking budget instead of fitting under the
real ceiling:
32000 + 131072 = 163072, which Zed's proxy rejects (model's realoutput cap is
64000). The codebase already has the identical fix for the sameclass of provider (
kiro, in the samePROVIDER_MODEL_ALIASEStable) —zed-hostednever got the equivalent entry.
Fix
Add a
zed-hostedentry toPROVIDER_MODEL_ALIASESinopen-sse/services/model.ts,mapping
claude-haiku-4-5→claude-haiku-4.5, same pattern as the existingkiroentry. Scoped to
claude-haiku-4-5only (the model reported and reproduced) — notguessing at Sonnet/Opus id spellings on Zed without confirming them against the live
catalog first.
This only affects capability/budget-cap lookups
(
resolveCanonicalProviderModel→getStaticSpec/capMaxOutputTokens). It nevertouches the wire
modelfield sent to Zed:zed-hosted.tspasses the raw wire modelstring straight into
openaiToClaudeRequest(model, ...), andresult.model = modelis set unconditionally from that same raw string, never rewritten by the alias table.
Regression test
tests/unit/issue-13364-zed-hosted-haiku-thinking-inflation.test.tsRun:
Before fix (RED) — matches the reporter's live-proxy numbers exactly:
After fix (GREEN):
Gates run
npx eslint --suppressions-location config/quality/eslint-suppressions.json open-sse/services/model.ts tests/unit/issue-13364-zed-hosted-haiku-thinking-inflation.test.ts→ clean, no warnings.npm run check:open-sse-typecheck→ clean.node scripts/check/check-file-size.mjs→ no new violations on touched files.node scripts/check/check-complexity.mjs/node scripts/check/check-cognitive-complexity.mjs→ no new violations (additive data-table change only).node scripts/check/check-test-discovery.mjs→ new test file discovered.tests/unit/kiro-claude-sonnet-5-2267.test.ts,tests/unit/zed-provider.test.ts,tests/unit/zed-hosted-proxy-enums-13362.test.ts,tests/unit/zed-hosted-think-close-marker.test.ts,tests/unit/zed-hosted-models-discovery-route.test.ts,tests/unit/zed-hosted-loopback-port-derivation.test.ts,tests/unit/zed-hosted-stream-error-boundary.test.ts(this one timed out once underheavy machine load running alongside the other 6 files; re-run in isolation passed
cleanly in 46s — a load-related flake, unrelated to this change, which only touches
open-sse/services/model.ts).Existing tests aligned
None — no existing assertion encoded the old buggy contract; this is a purely additive
lookup-table entry.
Not covered here
effortBudgetMap.high = 131072behavior (anyreasoning_effortabovemediummaps straight to Anthropic'sxhigh-tier thinking budget) affects everyprovider through this translation leg, not just
zed-hosted, and is out of scope forthis fix.
zed-hostedare not added here — onlyclaude-haiku-4-5isreproduced/reported. A follow-up should confirm the live Zed catalog spelling before
adding those.