Skip to content

test: remove network-dependent custom_tokenizer proxy tests#29643

Open
yuneng-berri wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_/hopeful-hawking-5a7b34
Open

test: remove network-dependent custom_tokenizer proxy tests#29643
yuneng-berri wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_/hopeful-hawking-5a7b34

Conversation

@yuneng-berri
Copy link
Copy Markdown
Collaborator

@yuneng-berri yuneng-berri commented Jun 4, 2026

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Type

🧹 Refactoring
✅ Test

Changes

tests/proxy_unit_tests/test_custom_tokenizer_bug.py loaded Xenova/llama-3-tokenizer from HuggingFace Hub at test time. On shared CI runners HF periodically returns 429 Too Many Requests, after which huggingface_hub falls back to an empty local cache and re-raises a LocalEntryNotFoundError ("check your connection"); the surfaced error makes it look like a connectivity problem when the real cause is rate limiting. The failures show up on unrelated PRs because the file lands in the test_[a-j]*.py matrix group that every PR runs, so the flake is not tied to any one change.

Three of the four tests in the file are network-dependent in this way; they are integration tests sitting in a unit-test path. The fourth, test_model_without_custom_tokenizer_uses_default, exercises the no-custom-tokenizer path that resolves to the bundled OpenAI tokenizer; it passes with or without the original model_info -> custom_tokenizer fix, so it carries no regression signal and is removed along with the rest.

The file is also dropped from the explicit test list in .github/workflows/test-unit-proxy-db.yml, where it was pinned by name in addition to being picked up by the legacy workflow's glob.

If we want to keep coverage of the custom-tokenizer-from-model_info extraction without a live download, the right follow-up is a mocked test that patches the tokenizer load and asserts the configured tokenizer is selected; happy to add that here if preferred.

test_custom_tokenizer_bug.py loaded the Xenova/llama-3-tokenizer from
HuggingFace Hub at test time, so it flaked on shared CI runners whenever
HF returned 429 Too Many Requests; the surfaced LocalEntryNotFoundError
made it look like a connectivity bug. These were integration tests in a
unit-test path. The only non-network case left, a model without a custom
tokenizer, passed with or without the underlying fix, so it gave no
regression signal and went with the rest.

Also drop the file from the proxy-db workflow's explicit test list.
@yuneng-berri yuneng-berri requested a review from a team June 4, 2026 02:27
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR removes a flaky test file (tests/proxy_unit_tests/test_custom_tokenizer_bug.py) and its pinned CI entry, because the tests loaded Xenova/llama-3-tokenizer from HuggingFace at runtime — violating the project rule that forbids network calls in the proxy unit-test folder — and periodically caused 429/LocalEntryNotFoundError flakes on unrelated PRs.

  • The four deleted tests were legitimate integration tests placed in the wrong location; their removal is correct per the no-network-calls rule for this folder.
  • No mocked replacement is included in this PR, leaving the custom_tokenizer-from-model_info extraction path (the original bug fix) without any regression guard; the PR description acknowledges this and offers a follow-up.
  • The workflow change is minimal and correct — only the explicit pinned filename is removed.

Confidence Score: 4/5

Safe to merge; the deletions fix a real CI flakiness problem and correct a rule violation, with only a coverage gap as the remaining concern.

The custom_tokenizer extraction path that the original tests validated now has no automated regression guard. A future change that accidentally drops the fix would go undetected until a user reports the wrong tokenizer being used in production.

tests/proxy_unit_tests/test_custom_tokenizer_bug.py — the deleted file represents a coverage gap that should be addressed with a mocked replacement test.

Important Files Changed

Filename Overview
tests/proxy_unit_tests/test_custom_tokenizer_bug.py Entire file deleted — removes four tests that load HuggingFace tokenizers over the network, violating the proxy unit-test no-network-calls rule; leaves zero coverage for the custom_tokenizer extraction bug fix.
.github/workflows/test-unit-proxy-db.yml Removes the explicit pinned reference to the deleted test file; no other workflow logic is touched.

Comments Outside Diff (1)

  1. tests/proxy_unit_tests/test_custom_tokenizer_bug.py

    P2 No mocked replacement shipped alongside the deletion

    Removing the four tests leaves the custom_tokenizer extraction path (the bug this file was written to catch) with zero regression coverage. The PR description offers a mocked follow-up; without it, a future refactor that accidentally re-introduces the original bug — where model_info was populated but the custom_tokenizer key was never read — would have nothing to catch it. The fix itself lives somewhere in the router/proxy path and is now unguarded. Shipping the mocked patch-based replacement in the same PR, or opening a tracked issue for it, would close the gap.

    Rule Used: What: Flag any modifications to existing tests and... (source)

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/lit..." | Re-trigger Greptile

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant