Skip to content

test(e2e): bypass the proxy response cache in the mid-conversation system and fallback tests - #37915

Merged
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_e2e_no_cache_mid_conversation
Aug 22, 2026
Merged

test(e2e): bypass the proxy response cache in the mid-conversation system and fallback tests#37915
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_e2e_no_cache_mid_conversation

Conversation

@yuneng-berri

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • litellm-e2e has been red on every build since 2026-08-20: the three test_unflagged_model_converts_system_reminder_and_succeeds tests (Azure Foundry, Vertex, Bedrock Invoke) fail deterministically in _prime_prompt_cache with prompt cache never became readable in full within 60.0s
  • Build 50 also lost both TestReliabilityFallbacks tests to a single empty gpt-5.5 completion

How it solves it:

  • The priming helper re-sends an identical /v1/messages body until the usage shows the full prefix read back three times in a row. The e2e stack runs with the litellm response cache on, so every resend after the first is served from redis with the first call's usage (cache_read_input_tokens never grows) and the streak can never form. RichMessagesRequest now sends cache: {"no-cache": true}, the same bypass test_cache_control.py already uses; the key is honored by the @client cache check and filtered out before the provider request
  • The two fallback tests sent the same "say hi" / max_tokens=16 body to the gpt-5.5 fallback, so one finish_reason=length completion with empty content served the second test from the response cache and failed both. Each test now uses a unique prompt, and chat_override leaves gpt-5.5 64 tokens to emit text

Test-only change; no product code touched.

Relevant issues

Follows up #36968, which added the consecutive-read priming check. Failing builds: litellm-e2e 43–50 (e.g. https://buildkite.com/berriai-1/litellm-e2e/builds/50).

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

…stem and fallback tests

The mid-conversation system tests prime the prompt cache by re-sending an
identical /v1/messages body until its usage shows the full prefix read back
three times in a row. The e2e stack runs with the litellm response cache on,
so every resend after the first is served from redis with the first call's
usage and the streak can never form; the three unflagged-model tests have
failed on every litellm-e2e build since the consecutive-read check landed.
Send cache: {"no-cache": true} on RichMessagesRequest, as test_cache_control
already does, so each resend reaches the provider.

The two fallback tests sent the same "say hi" / max_tokens=16 body to the
gpt-5.5 fallback, so one empty (finish_reason=length) completion served the
second test from the response cache and failed both. Give each test a unique
prompt and leave gpt-5.5 enough tokens to emit text.
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This test-only PR prevents proxy response-cache entries from interfering with provider prompt-cache and reliability fallback E2E tests.

  • Adds a response-cache bypass to rich Messages API requests.
  • Gives fallback tests unique prompts so responses cannot collide in cache.
  • Raises the shared reliability helper’s output allowance to avoid empty, length-truncated completions.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable regressions identified in the changed E2E test paths.

The cache bypass targets the proxy response cache rather than the provider prompt cache under test, while unique prompts and the larger output allowance remove the documented cross-test collision and empty-completion conditions without invalidating existing callers.

Important Files Changed

Filename Overview
tests/e2e/llm_translation/endpoints_client.py Adds the established no-cache request control so repeated prompt-cache probes reach the provider instead of reusing a proxy response.
tests/e2e/router/reliability_support.py Raises the completion limit for reliability requests; existing callers do not rely on the previous token count.
tests/e2e/router/test_reliability_fallbacks_e2e.py Makes each fallback prompt unique without changing the fallback assertions or routing behavior.

Reviews (1): Last reviewed commit: "test(e2e): bypass the proxy response cac..." | Re-trigger Greptile

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yuneng-berri
yuneng-berri enabled auto-merge (squash) August 22, 2026 05:02
@yuneng-berri
yuneng-berri merged commit add2d23 into litellm_internal_staging Aug 22, 2026
67 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_e2e_no_cache_mid_conversation branch August 22, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants