Skip to content

fix(k8s): enforce the window of each gateway deployment - #2843

Merged
dan-petty merged 4 commits into
mainfrom
fix/2825-review-window-enforced
Oct 31, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/2825-review-window-enforced

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

LiteLLM v1.103.0 reads the window of a deployment only from its top-level model_info. The gateway config put the window under litellm_params, so the pre-call check never ran. Ollama then cut long prompts without an error.

This change:

  • Sets model_info.max_input_tokens on each ollama_chat deployment, equal to the OLLAMA_CONTEXT_LENGTH of its tier.
  • Removes the context_window_fallbacks rules. No target group has a larger window.
  • Adds tests that hold the window of each deployment and the absence of the removed rules.
  • Documents in the gateway README, the config and the OpenSpec change where a long prompt goes. A prompt longer than the window of devops-background moves on along the plain fallbacks to qwen3.8:27b. It fails only when no group of the chain holds it.

Closes #2825

LiteLLM reads max_input_tokens only from the top-level model_info of a
deployment. The config set it under litellm_params, so no window was
enforced and a long prompt could reach a smaller tier, where Ollama cuts
it without an error. Every ollama_chat deployment now sets the window of
its tier, and the two useless context_window_fallbacks rules are gone.
A prompt longer than the window of devops-background moves on along the
plain fallbacks to qwen3.8:27b. It fails only when no group of the chain
holds it. The config, the gateway README and the archived change now say
so.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Oct 31, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results and review notes.

Fail-to-pass run (devops ci fail-to-pass --base origin/main): 3 tests fail on base and pass on the branch, 66 pass on both. One failing test is test_gateway_checks_windows_and_has_no_useless_window_fallback. The other two cover the window of each deployment.

Local checks: tests/ai/benchmark/test_k8s_llm_gateway.py 69 passed. devops openspec check passed. Docs are in sync. The commit hooks passed. The full devops ci was not run again: the last commit changes prose and comments only.

Review findings, both minor, both fixed in commit 07ae288:

  • README, config and proposal said that no group could take a prompt another group refused, and that a long prompt falling back to devops-background fails with an error. The router runs the plain fallbacks for a context-window error. So the prompt moves on to qwen3.8:27b (262144 on ollama-48gib-fast) and fails only when no group of the chain holds it. The three places now say this.
  • The same statement in the OpenSpec proposal and design. Fixed in the archived change. The fallback list stays: the other choice is a failed review. The proposal records this choice.

No test came with this fix. The change is prose, and a test of comment text has no value.

@dan-petty
dan-petty marked this pull request as ready for review October 31, 2026 06:36
@dan-petty
dan-petty merged commit 2ff7d9f into main Oct 31, 2026
18 checks passed
@dan-petty
dan-petty deleted the fix/2825-review-window-enforced branch October 31, 2026 11:16
dan-petty pushed a commit that referenced this pull request Oct 31, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.26.0](v0.25.0...v0.26.0)
(2026-10-31)


### Features

* **k8s:** preview requests in dry run for cluster commands
([#2839](#2839))
([b6de1a4](b6de1a4)),
closes [#2238](#2238)
* **pr:** preview requests in dry run for pr commands
([#2835](#2835))
([2a9b746](2a9b746)),
closes [#2234](#2234)


### Bug Fixes

* **k8s:** enforce the window of each gateway deployment
([#2843](#2843))
([2ff7d9f](2ff7d9f)),
closes [#2825](#2825)
* **roadmap:** measure a task group by the files its step reads
([#2847](#2847))
([2f3986a](2f3986a)),
closes [#2838](#2838)
* **tests:** replace real test sleeps with clock
([#2169](#2169))
([#2833](#2833))
([506f769](506f769))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): devops-review has deployments with three windows and no max_input_tokens, so a long prompt can be cut

1 participant