fix(catalog): cap DeepSeek V4 context window at 512K for Together/Fireworks bindings - #865
fix(catalog): cap DeepSeek V4 context window at 512K for Together/Fireworks bindings#865steventohme wants to merge 3 commits into
Conversation
…eworks bindings Together and Fireworks serve DeepSeek V4 at 512,000 tokens, not the native 1,048,576. Setting the catalog ContextWindow to 1M caused the HMM policy resolver and excludeContextOverflowModels to pass through requests >512K, which hit a 400 context_length_exceeded on Together/Fireworks after failover from Makora. Makora may serve the full 1M window, but failover walks to 512k-capped providers, so the conservative minimum matches the existing minimax pattern (PR#381) that already caps m2.7 at 204,800 and m3 at 512,000. Observed in prod: deepseek-v4-pro requests with ~581K input tokens failed with context_length_exceeded on Together after Makora failover. Also caught 490K+ requests failing on Fireworks across 29 error calls in 7 days. The max Makora-served input in the same window is ~604K (no errors).
|
Claude finished @steventohme's task —— View job Advisory comment-length review posted.
|
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3e5f173. Configure here.
What T-Rex did
|
| // cap at 512,000. Set to the minimum across all bindings, matching the | ||
| // minimax pattern (PR#381); Makora may serve the full 1M but failover to | ||
| // a 512k-capped provider with a request over 512k hard-400s. | ||
| {ID: "deepseek/deepseek-v4-flash", Tier: TierLow, ContextWindow: 512_000, ImageInput: ImageInputUnsupported, AgenticUse: AgenticLow, Providers: []ProviderBinding{ |
There was a problem hiding this comment.
Flash context pre-filter rejects usable bindings
The 512,000-token model-level limit is enforced by the production context-overflow pre-filter before routing resolves a provider binding. Consequently, a 512,001-token Flash request excludes deepseek/deepseek-v4-flash even when Makora or OpenRouter is available. Those are Flash's only configured bindings; neither is the Together or Fireworks provider cited by the adjacent minimum-window rationale.
Artifacts
- Review-authored test source directly invokes the production pre-filter at 512,001 tokens and resolves each configured Flash binding, ending with the takeaway that the test exercises the exact affected decision path.
- Executed `go test ./internal/proxy -run ^TestPR865Flash512001PreFilter$ -count=1 -v` from `/home/user/repo`; it exited 0 and shows Flash excluded at 512,001 before its Makora and OpenRouter bindings are resolved, ending with the takeaway that the current catalog makes the configured model unavailable.
- Executed `go test ./internal/proxy -run ^TestPR865FlashNativeWindowControl$ -count=1 -v` from `/home/user/repo`; it exited 0 and shows the same 512,001-token request fits a 1,048,576-token window, ending with the takeaway that the lower catalog cap causes the rejection.
Co-authored-by: workweave-bot <bot@workweave.ai>
Co-authored-by: workweave-bot <bot@workweave.ai>
|
Claude finished @steventohme's task —— View job
No added comment blocks of 3+ consecutive lines found — nothing to flag. |

Together and Fireworks serve DeepSeek V4 at 512,000 tokens, not the native 1,048,576. Setting the catalog ContextWindow to 1M caused the HMM policy resolver and excludeContextOverflowModels to pass through requests >512K, which hit a 400 context_length_exceeded on Together/Fireworks after failover from Makora.
Makora may serve the full 1M window, but failover walks to 512k-capped providers, so the conservative minimum matches the existing minimax pattern (PR#381) that already caps m2.7 at 204,800 and m3 at 512,000.
Observed in prod: deepseek-v4-pro requests with ~581K input tokens failed with context_length_exceeded on Together after Makora failover. Also caught 490K+ requests failing on Fireworks across 29 error calls in 7 days. The max Makora-served input in the same window is ~604K (no errors), confirming Makora's own capacity doesn't need the cap. But the binding-ordered failover chain means a Makora → Together/Fireworks hop on a >512K request will always 400.
🤖 Generated with Weave Router